ZHANGYUXUAN-zR commited on
Commit
5978621
·
verified ·
1 Parent(s): 7e3abb2

Add files using upload-large-folder tool

Browse files
parse/test/7FHrZuKogW/7FHrZuKogW.md ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/7FHrZuKogW/7FHrZuKogW_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/7FHrZuKogW/7FHrZuKogW_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/7FHrZuKogW/7FHrZuKogW_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/AFDcYJKhND/AFDcYJKhND.md ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/AFDcYJKhND/AFDcYJKhND_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/AFDcYJKhND/AFDcYJKhND_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/AFDcYJKhND/AFDcYJKhND_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/OEL4FJMg1b/OEL4FJMg1b.md ADDED
@@ -0,0 +1,247 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DRAGONDIFFUSION: ENABLING DRAG-STYLE MANIPULATION ON DIFFUSION MODELS
2
+
3
+ Chong $\mathbf { M o u } ^ { 1 , 3 }$ Xintao Wang2 Jiechong Song1 Ying Shan2 Jian Zhang1,3∗
4
+
5
+ 1School of Electronic and Computer Engineering, Shenzhen Graduate School, Peking University 2ARC Lab, Tencent PCG 3Peking University Shenzhen Graduate School-Rabbitpre AIGC Joint Research Laboratory {eechongm, xintao.alpha}@gmail.com, {songjiechong, zhangjian.sz}@pku.edu.cn
6
+
7
+ ![](images/a3774750dccc549dab677d338d76bb0b7514073bdf15242e03aade9c8bd3e58a.jpg)
8
+ Figure 1: The image editing tasks that our DragonDiffusion can achieve without training.
9
+
10
+ # ABSTRACT
11
+
12
+ Despite the ability of text-to-image (T2I) diffusion models to generate highquality images, transferring this ability to accurate image editing remains a challenge. In this paper, we propose a novel image editing method, DragonDiffusion, enabling Drag-style manipulation on Diffusion models. Specifically, we treat image editing as the change of feature correspondence in a pre-trained diffusion model. By leveraging feature correspondence, we develop energy functions that align with the editing target, transforming image editing operations into gradient guidance. Based on this guidance approach, we also construct multi-scale guidance that considers both semantic and geometric alignment. Furthermore, we incorporate a visual cross-attention strategy based on a memory bank design to ensure consistency between the edited result and original image. Benefiting from these efficient designs, all content editing and consistency operations come from the feature correspondence without extra model fine-tuning. Extensive experiments demonstrate that our method has promising performance on various image editing tasks, including within a single image (e.g., object moving, resizing, and content dragging) or across images (e.g., appearance replacing and object pasting).
13
+
14
+ Code is available at https://github.com/MC-E/DragonDiffusion.
15
+
16
+ # 1 INTRODUCTION
17
+
18
+ Thanks to the large-scale training data and huge computing power, generative models have developed rapidly, especially text-to-image (T2I) diffusion models Saharia et al. (2022); Rombach et al. (2022); Nichol et al. (2022); Ramesh et al. (2022), which aims to generate images conditioned on a given text/prompt. However, this generative capability is usually diverse, and it is challenging to design suitable prompts to generate images consistent with what the user has in mind Mou et al. (2023); Zhang et al. (2023), let alone fine-grained image editing based on the text condition.
19
+
20
+ In the community of image editing, previous methods are usually designed based on GANs Abdal et al. (2019; 2020); Alaluf et al. (2022) due to the compact and editable latent space, e.g., the $\mathcal { W }$ space in StyleGAN Karras et al. (2019). Recently, DragGAN Pan et al. (2023) proposes a pointto-point dragging scheme, which can achieve refined content dragging. However, it is limited by the capacity and generalization of GANs. Compared to GANs, diffusion model Ho et al. (2020) has higher stability and superior generation quality. Due to the lack of a concise and editable latent space, numerous diffusion-based image editing methods Hertz et al. (2022); Feng et al. (2022); Balaji et al. (2022) are built based on T2I diffusion models via correspondence between text and image features. Recently, self-guidance Epstein et al. (2024) proposes a differentiable approach that employs crossattention maps between text and image to locate and calculate the size of objects within images. Then, gradient guidance is utilized to edit these properties. However, the correspondence between text and image features is weak, heavily relying on the design of prompts. Moreover, in complex or multi-object scenarios, text struggles to build accurate correspondence with a specific object. In this paper, we aim to investigate whether the diffusion model can achieve drag-style image editing, which is a fine-grained and generalized editing ability not limited to point dragging.
21
+
22
+ In the large-scale T2I diffusion model, besides the correspondence between text features and intermediate image features, there is also a strong correspondence across image features. This characteristic is studied in DIFT Tang et al. (2023), which demonstrates that this correspondence is high-level, enabling point-to-point correspondence of relevant image content. Therefore, we are intrigued by the possibility of utilizing this strong correspondence across image features to achieve image editing. In this paper, we regard image editing as the change of feature correspondence and convert it into gradient guidance via energy functions Dhariwal & Nichol (2021) in score-based diffusion Song et al. (2020b). Additionally, the content consistency between editing results and original images is also ensured by feature correspondence in a visual cross-attention design. Here, we notice that there is a concurrent work, DragDiffusion Shi et al. (2023), studying this issue. It uses LORA Ryu (2023) to maintain consistency with the original image and optimizes the latent in a specific diffusion step to perform point dragging. Unlike DragDiffusion, our image editing is achieved by energy functions and a visual cross-attention design, without extra model fine-tuning or new blocks. In addition, we can complete various drag-style image editing tasks beyond the point dragging, as shown in Fig. 1.
23
+
24
+ In summary, the contributions of this paper are as follows:
25
+
26
+ • We achieve drag-style image editing via image feature correspondence in the pre-trained diffusion model. We also study the roles of the features in different layers and develop multi-scale guidance that considers both semantic and geometric correspondence. • We design a memory bank, further utilizing the image feature correspondence to maintain the consistency between editing results and original images. In conjunction with gradient guidance, our method allows a direct transfer of T2I generation ability in diffusion models to image editing tasks without the need for extra model fine-tuning or new blocks. Extensive experiments demonstrate that our method has promising performance in various image editing tasks, including editing within a single image (e.g., object moving, resizing, and content dragging) or across images (e.g., appearance replacing and object pasting).
27
+
28
+ # 2 RELATED WORK
29
+
30
+ # 2.1 DIFFUSION MODELS
31
+
32
+ Recently, diffusion models Ho et al. (2020) have achieved great success in the community of image synthesis. It is designed based on thermodynamics Sohl-Dickstein et al. (2015); Song & Ermon (2019), including a diffusion process and a reverse process. In the diffusion process, a natural image $\mathbf { x } _ { \mathrm { 0 } }$ is converted to a Gaussian distribution $\mathbf { x } _ { T }$ by adding random Gaussian noise with $T$ iterations. The reverse process is to recover $\mathbf { x } _ { \mathrm { 0 } }$ from $\mathbf { x } _ { T }$ by several denoising steps. Therefore, the diffusion model is to train a denoiser, conditioned on the current noisy image $\mathbf { x } _ { t }$ and time step $t$ :
33
+
34
+ $$
35
+ \begin{array} { r } { \mathbb { E } _ { \mathbf { x } _ { 0 } , t , \epsilon _ { t } \sim \mathcal { N } ( 0 , 1 ) } \left[ | | \epsilon _ { t } - \epsilon _ { \pmb { \theta } } ( \mathbf { x } _ { t } , t ) | | _ { 2 } ^ { 2 } \right] , } \end{array}
36
+ $$
37
+
38
+ where $\epsilon _ { \pmb { \theta } }$ is the function of the denoiser. Recently, some text-conditioned diffusion models (e.g., GLID Nichol et al. (2022) and StableDiffusion(SD) Rombach et al. (2022)) are proposed. Especially SD, transforming $\mathbf { x } _ { t }$ to the latent space $\mathbf { z } _ { t }$ , significantly improves the generation performance. From
39
+
40
+ the continuous perspective Song et al. (2020b), diffusion models can be viewed as a score function (i.e., $\epsilon _ { \pmb { \theta } } ( \mathbf { x } _ { t } , t ) \approx \nabla _ { \mathbf { x } _ { t } } \log q ( \mathbf { x } _ { t } ) )$ that samples from the corresponding distribution Song & Ermon (2020) according to Langevin dynamics Sohl-Dickstein et al. (2015); Song & Ermon (2019).
41
+
42
+ # 2.2 ENERGY FUNCTION IN DIFFUSION MODEL
43
+
44
+ From the continuous perspective of score-based diffusion, the external condition y can be combined by a conditional score function, i.e., $\nabla _ { \mathbf { x } _ { t } } \log q ( \mathbf { x } _ { t } | \mathbf { y } )$ , to sample from a more enriched distribution. The conditional score function can be further decomposed as:
45
+
46
+ $$
47
+ \nabla _ { \mathbf { x } _ { t } } \log q ( \mathbf { x } _ { t } | \mathbf { y } ) = \nabla _ { \mathbf { x } _ { t } } \log \left( \frac { q ( \mathbf { y } | \mathbf { x } _ { t } ) q ( \mathbf { x } _ { t } ) } { q ( \mathbf { y } ) } \right) \propto \nabla _ { \mathbf { x } _ { t } } \log q ( \mathbf { x } _ { t } ) + \nabla _ { \mathbf { x } _ { t } } \log q ( \mathbf { y } | \mathbf { x } _ { t } ) ,
48
+ $$
49
+
50
+ where the first term is the unconditional denoiser, and the second term refers to the conditional gradient produced by an energy function $\mathcal { E } ( \mathbf { x } _ { t } ; t , \mathbf { y } ) = q ( \mathbf { x } _ { t } | \mathbf { y } )$ . $\mathcal { E }$ can be selected based on the generation target, such as a classifier Dhariwal & Nichol (2021) to specify the category of generation results. Energy function has been used in various controllable generation tasks, e.g., sketch-guided generation Voynov et al. (2023), mask-guided generation Singh et al. (2023), universal guidance Yu et al. (2023); Bansal et al. (2023), and image editing Epstein et al. (2024). These methods, inspire us to transform editing operations into conditional gradients, achieving fine-grained image editing.
51
+
52
+ # 2.3 IMAGE EDITING
53
+
54
+ In image editing, numerous previous methods Abdal et al. (2019; 2020); Alaluf et al. (2022) invert images into the latent space of StyleGAN Karras et al. (2019) and then edit the image by manipulating latent vectors. Motivated by the success of diffusion model Ho et al. (2020), various diffusionbased image editing methods Avrahami et al. (2022); Hertz et al. (2022); Kawar et al. (2023); Meng et al. (2021); Brooks et al. (2023) are proposed. Most of them use text as the editing control. For example, Kawar et al. (2023); Valevski et al. (2023); Kwon & Ye (2022) perform model fine-tuning on a single image and then generate the editing result by target text. Prompt2Prompt Hertz et al. (2022) achieves specific object editing by exchanging text-image attention maps. SDEdit Meng et al. (2021) performs image editing by adding noise to the original image and then denoising under new text conditions. InstructPix2Pix Brooks et al. (2023) finetunes the diffusion model with text as the editing instruction. Recently, Self-guidance Epstein et al. (2024) transforms image editing operations into gradients through the correspondence between text and image features. However, the correspondence between text and image is weak, unable to perform fine-grained editing. Recently, DragGAN Pan et al. (2023) presents a point-to-point dragging scheme. Nevertheless, its editing quality and generalization are limited by GANs. How to utilize the high-quality and diverse generation ability of diffusion models for fine-grained image editing is still an open challenge.
55
+
56
+ # 3 METHOD
57
+
58
+ # 3.1 PRELIMINARY: HOW TO CONSTRUCT ENERGY FUNCTION IN DIFFUSION
59
+
60
+ Modeling an energy function $\mathcal { E } ( \mathbf { x } _ { t } ; t , \mathbf { y } )$ to produce the conditional gradient $\nabla _ { \mathbf { x } _ { t } } \log q ( \mathbf { y } | \mathbf { x } _ { t } )$ in Eq. 2, remains an open question. $\mathcal { E }$ measures the distance between $\mathbf { x } _ { t }$ and the condition y. Some methods Dhariwal & Nichol (2021); Voynov et al. (2023); Zhao et al. (2022) train a time-dependent distance measuring function, e.g., a classifier Dhariwal $\&$ Nichol (2021) to predict the probability that $\mathbf { x } _ { t }$ belongs to category y. However, the training cost and annotation difficulty are intractable in our image editing task. Some tuning-free methods $\mathrm { Y u }$ et al. (2023); Bansal et al. (2023) propose using the clean image $\mathbf { x } _ { 0 \mid t }$ predicted at each time step $t$ to replace $\mathbf { x } _ { t }$ for distance measuring, i.e., $\mathcal { E } ( \mathbf { x } _ { t } ; t , \mathbf { y } ) \approx \mathcal { D } ( \mathbf { x } _ { 0 \mid t } ; t , \mathbf { y } )$ . Nevertheless, there is a bias between $\mathbf { x } _ { 0 \mid t }$ and $\mathbf { x } _ { \mathrm { 0 } }$ , and there is hardly a suitable $\mathcal { D }$ for distance measuring in image editing tasks. Hence, the primary issue is whether we can circumvent the training requirement and construct an energy function to measure the distance between $\mathbf { x } _ { t }$ and the editing target. Recent work Tang et al. (2023) has shown that the feature correspondence in the diffusion UNet-denoiser $\epsilon _ { \theta }$ is high-level, enabling point-to-point correspondence measuring. Inspired by this characteristic, we propose reusing $\epsilon _ { \theta }$ as a tuning-free energy function to transform image editing operations into the change of feature correspondence.
61
+
62
+ ![](images/512b8185ae2c928b1b72c0992dfdd8d0e17a74bcafa1163a67eb774d514c837f.jpg)
63
+ Figure 2: Overview of our DragonDiffusion, containing a memory bank and score-based gradient guidance on the pre-trained SD Rombach et al. (2022) without extra training or modules.
64
+
65
+ # 3.2 OVERVIEW
66
+
67
+ The editing objective of our DragonDiffusion involves two issues: changing the content to be edited and preserving unedited content. For example, if a user wants to move the cup in an image, the generated result only needs to change the position of the cup, while the appearance of the cup and other unedited content should not change. An overview of our method is presented in Fig. 2, which is built on the pre-trained SD Rombach et al. (2022) to support image editing with and without reference images. Since SD is a latent diffusion model (LDM), we first encode the original image $\mathbf { x } _ { \mathrm { 0 } }$ into the latent space $\mathbf { z } _ { 0 }$ , which is then reversed to $\mathbf { z } _ { T }$ by DDIM inversion Song et al. (2020a). If the reference image $\mathbf { x } _ { 0 } ^ { r e f }$ exists, it will also be involved in the inversion to produce ${ \bf z } _ { T } ^ { r e f }$ In this process, we store some intermediate features and latent at each time step to build a memory bank, which is used to provide guidance for subsequent image editing. In generation, we transform the information stored in the memory bank into content editing and consistency guidance through two paths, i.e., visual cross-attention and gradient guidance. Both of these paths are built based on feature correspondence in the pre-trained SD, without extra model fine-tuning or new blocks.
68
+
69
+ # 3.3 DDIM INVERSION WITH MEMORY BANK
70
+
71
+ In our image editing process, the starting point $\mathbf { z } _ { T }$ , produced by DDIM inversion Song et al. (2020a), can provide a good generation prior to maintain consistency with the original image. However, relying solely on the final step of this approximate inversion can hardly provide accurate generation guidance. Therefore, we fully utilize the information in DDIM inversion by building a memory bank to store the latent $\mathbf { z } _ { t } ^ { g u d }$ at each inversion step $t$ , as well as corresponding keys ${ \bf K } _ { t } ^ { g u d }$ and values $\mathbf { V } _ { t } ^ { g u d }$ in the self-attention module of the decoder within the UNet denoiser. Note that in some cross-image editing tasks (e.g., appearance replacing, object pasting), reference images are required. In these tasks, the memory bank needs to be doubled to store the information of the reference images. Here, we utilize zreft , Kreft , and $\mathbf { V } _ { t } ^ { r e f }$ to represent them. The information stored in the memory bank will provide more accurate guidance for the subsequent image editing process.
72
+
73
+ # 3.4 GRADIENT-GUIDANCE-BASED EDITING DESIGN
74
+
75
+ Inspired by classifier guidance Dhariwal & Nichol (2021), we build energy functions to transform image editing operations into gradient guidance in diffusion sampling. An intuitive illustration is presented in Fig. 3, showing a continuous sampling space of the score-based diffusion Song et al. (2020b). The sampling starting point $\mathbf { z } _ { T }$ , obtained from DDIM inversion, will approximately return to the original point only according to the gradient/score predicted by the denoiser. After incorporating the gradient guidance generated by the energy function that matches the editing target, the additional guidance gradient will change the path to reach a sampling result that meets the editing target.
76
+
77
+ ![](images/2e07f217bb7cf0f1e95aa120726fe01b834afedaf4179d4c628ecfbf948713f6.jpg)
78
+ : Original Gradient : Corrected Gradient Figure 3: Illustration of continuous sampling space in score-based diffusion. Bright colors indicate areas where target data is densely distributed. The orange and green paths respectively refer to the diffusion paths without and with external gradient guidance.
79
+
80
+ # 3.4.1 ENERGY FUNCTION VIA FEATURE CORRESPONDENCE
81
+
82
+ In our DragonDiffusion, energy functions are designed to provide gradient guidance for image editing, mainly including content editing and consistency terms. Specifically, at the $t$ -th time step, we reuse the UNet denoiser $\epsilon _ { \pmb { \theta } }$ to extract intermediate features $\mathbf { F } _ { t } ^ { g e \hat { n } }$ from the latent ${ \bf z } _ { t } ^ { g e n }$ at the current time step. The same operation is used to extract guided features $\mathbf { F } _ { t } ^ { g u d }$ from $\mathbf { z } _ { t } ^ { g u d }$ in memory bank. Following DIFT Tang et al. (2023), decoder. The image editing operatio $\mathbf { F } _ { t } ^ { g e n }$ and Fgud pres come from intermediate by two binary masks (i.e., $\mathbf { m } ^ { g u d }$ s inand $\mathbf { m } ^ { g e n }$ Net) to locate the original content position and target dragging position, respectively. Therefore, the energy function is built by constraining the correspondence between these two regions in $\mathbf { F } _ { t } ^ { g u d }$ and $\mathbf { F } _ { t } ^ { g e n }$ . Here, we utilize cosine distance $\cos ( \cdot ) \in [ - 1 , 1 ]$ to measure the similarity and normalize it to $[ 0 , 1 ]$ :
83
+
84
+ $$
85
+ \begin{array} { r } { \mathcal { S } _ { l o c a l } ( \mathbf { F } _ { t } ^ { g e n } , \mathbf { m } ^ { g e n } , \mathbf { F } _ { t } ^ { g u d } , \mathbf { m } ^ { g u d } ) = 0 . 5 \cdot \cos \Big ( \mathbf { F } _ { t } ^ { g e n } [ \mathbf { m } ^ { g e n } ] , ~ \mathrm { s g } ( \mathbf { F } _ { t } ^ { g u d } [ \mathbf { m } ^ { g u d } ] ) \Big ) + 0 . 5 , } \end{array}
86
+ $$
87
+
88
+ where $\operatorname { s g } ( \cdot )$ is the gradient clipping operation. Eq. 3 is mainly used for dense constraints on the spatial location of content. In addition, a global appearance similarity is defined as:
89
+
90
+ $$
91
+ S _ { g l o b a l } ( { \bf F } _ { t } ^ { g e n } , { \bf m } ^ { g e n } , { \bf F } _ { t } ^ { g u d } , { \bf m } ^ { g u d } ) = 0 . 5 \cdot \cos \left( \frac { \sum { \bf F } _ { t } ^ { g e n } [ { \bf m } ^ { g e n } ] } { \sum { \bf m } ^ { g e n } } , ~ \mathrm { s g } ( \frac { \sum { \bf F } _ { t } ^ { g u d } [ { \bf m } ^ { g u d } ] } { \sum { \bf m } ^ { g u d } } ) \right) + 0 . 5 ,
92
+ $$
93
+
94
+ which utilizes the mean of the features in a region as a global appearance representation. When we want to have fine control over the spatial position of an object or a rough global control over its appearance, we only need to constrain the similarity in Eq. 3 and Eq. 4 to be as large as possible. Therefore, the energy function to produce editing guidance is defined as:
95
+
96
+ $$
97
+ \mathcal { E } _ { e d i t } = \frac { 1 } { \alpha + \beta \cdot \mathscr { S } ( \mathbf { F } _ { t } ^ { g e n } , \mathbf { m } ^ { g e n } , \mathbf { F } _ { t } ^ { g u d } , \mathbf { m } ^ { g u d } ) } , \quad \mathscr { S } \in \{ S _ { l o c a l } , \mathscr { S } _ { g l o b a l } \} ,
98
+ $$
99
+
100
+ where $\alpha$ and $\beta$ are two hyper-parameters, which are set as 1 and 4, respectively. In addition to editing, we hope the unedited content remains consistent with the original image. We use a mask $\mathbf { m } ^ { s h a r e }$ to locate areas without editing. The similarity between the editing result and the original image in $\mathbf { m } ^ { s h a r e }$ can also be calculated by the cosine similarity as $\{ { S _ { l o c a l } } ( { { \bf { F } } _ { t } ^ { g e n } } , { { \bf { m } } ^ { s h a r e } } , { { \bf { F } } _ { t } ^ { g u d } } , { { \bf { m } } ^ { s h a r e } } )$ . Therefore, the energy function to produce content consistency guidance is defined as:
101
+
102
+ $$
103
+ \mathcal { E } _ { c o n t e n t } = \frac { 1 } { \alpha + \beta \cdot S _ { l o c a l } ( \mathbf { F } _ { t } ^ { g e n } , \mathbf { m } ^ { s h a r e } , \mathbf { F } _ { t } ^ { g u d } , \mathbf { m } ^ { s h a r e } ) } .
104
+ $$
105
+
106
+ In addition to $\mathcal { E } _ { e d i t }$ and $\mathcal { E } _ { c o n t e n t }$ , an optional guidance term $\mathcal { E } _ { o p t }$ may need to be added in some tasks to achieve the editing goal. Finally, the base energy function is defined as:
107
+
108
+ $$
109
+ \mathcal { E } = w _ { e } \cdot \mathcal { E } _ { e d i t } + w _ { c } \cdot \mathcal { E } _ { c o n t e n t } + w _ { o } \cdot \mathcal { E } _ { o p t } ,
110
+ $$
111
+
112
+ where $w _ { e } , w _ { c }$ , and $w _ { o }$ are hyper-parameters to balance these guidance terms. They vary slightly in different editing tasks but are fixed within the same task. Finally, regarding $[ \mathbf { m } ^ { g e n } , \mathbf { \bar { m } } ^ { s h a \bar { r e } } ]$ as condition, the conditional score function in Eq. 2 can be written as:
113
+
114
+ $$
115
+ \nabla _ { \mathbf z _ { t } ^ { g e n } } \log q ( \mathbf z _ { t } ^ { g e n } | \mathbf y ) \propto \nabla _ { \mathbf z _ { t } ^ { g e n } } \log q ( \mathbf z _ { t } ^ { g e n } ) + \nabla _ { \mathbf z _ { t } ^ { g e n } } \log q ( \mathbf y | \mathbf z _ { t } ^ { g e n } ) , ~ \mathbf y = [ \mathbf m ^ { g e n } , \mathbf m ^ { s h a r e } ] .
116
+ $$
117
+
118
+ The conditional gradient $\nabla _ { \mathbf { z } _ { t } ^ { g e n } } \log q ( \mathbf { y } | \mathbf { z } _ { t } ^ { g e n } )$ can be computed by $\nabla _ { \mathbf { z } _ { t } ^ { g e n } } \mathcal { E }$ , which will also multiplies by a learning rate $\eta$ . In experiments, we find that the gradient guidance in later diffusion generation steps hinders the generation of textures. Therefore, we only add gradient guidance in the first $n$ steps of diffusion generation. Experientially, we set $n = 3 0$ in 50 sampling steps.
119
+
120
+ # 3.4.2 MULTI-SCALE FEATURE CORRESPONDANCE
121
+
122
+ The decoder of the UNet denoiser contains four blocks of different scales. DIFT Tang et al. (2023) finds that the second layer contains more semantic information, while the third layer contains more geometric information. We also studied the role of features from different layers in image editing tasks, as shown in Fig. 4. In the experiment, we set $\mathbf { z } _ { T }$ as random Gaussian noise and set $\mathbf { m } ^ { g e n }$ , $\mathbf { m } ^ { g u d }$ as zeros matrixes. $\mathbf { m } ^ { s h a r e }$ is set as a ones matrix. In this way, generation relies solely on content consistency guidance (i.e., Eq. 6) to restore image content. We can find that the guidance from the first layer is too high-level to reconstruct the original image accurately. The guidance from the fourth layer has weak feature correspondence, resulting in significant differences between the reconstructed and original images. The features from the second and third layers are more suitable to produce guidance signals, and each has its own specialty. Concretely, the features in the second layer contain more semantic information and can reconstruct images that are semantically similar to the original image but with some differences in content details. The features in the third layer tend to express low-level characteristics, but they cannot provide effective supervision for high-level texture, resulting in blurry results. In our design, we combine these two levels (i.e., high and low) of guidance by proposing a multi-scale supervision approach. Specifically, we compute gradient guidance on the second and third layers. The reconstructed results in Fig. 4 also demonstrate that this combination can balance the generation of low-level and high-level visual characteristics.
123
+
124
+ ![](images/30eeeb7b19ff899196652942bafebf335ecc459546a44a4fed1741d7f15623f6.jpg)
125
+ Figure 4: Illustration of using features from different layers as guidance to restore the original image. $\mathbf { z } _ { T }$ is randomly initialized. The generation is solely guided by content consistency guidance in Eq. 6.
126
+
127
+ # 3.4.3 IMPLEMENTATION DETAILS FOR EACH APPLICATION
128
+
129
+ Object moving. In the task of object moving, $\mathbf { m } ^ { g e n }$ and $\mathbf { m } ^ { g u d }$ locate the same object in different spatial positions. $\mathbf { m } ^ { s h a r e }$ is the complement $\left( \mathbf { C } _ { \mathbf { u } } \right)$ of the union (∪) of $\mathbf { m } ^ { g e n }$ and $\mathbf { \hat { m } } ^ { g u d }$ , i.e., $\mathbf { m } ^ { s h a r e } = \mathbf { C } _ { \mathbf { u } } ( \mathbf { m } ^ { g e n } \cup \mathbf { m } ^ { g u d } )$ . However, solely using the content editing and consistency guidance in Eq. 5 and Eq. 6 can lead to some issues, as shown in the second image of Fig. 5. Concretely, although the bread is moved according to the editing signal, some of the bread content is still preserved in its original position in the generated
130
+
131
+ ![](images/8ae72772a59624588f4f30ff8fa7977936528ccabeb486e2777a9871c8eff2b4.jpg)
132
+ Figure 5: Visualization of the effectiveness of inpainting guidance $( \mathcal { E } _ { o p t } )$ in the object moving task, presenting that $\mathcal { E } _ { o p t }$ can guide the inpainting of the area where the object is initially located.
133
+
134
+ result. This is because the energy function does not constrain the area where the moved object was initially located, causing inpainting to easily restore the original object. To rectify this issue, we use the optional energy term (i.e., $\mathcal { E } _ { o p t }$ in Eq. 7) to constrain the inpainting content to be dissimilar to the moved object and similar to a predefined reference region. Here, we use $\mathbf { m } ^ { r e f }$ to locate the reference region and define $\mathbf { m } ^ { i p t } = \hat { \{ p | p \in \mathbf { m } ^ { g u d } } $ and $p \not \in \mathbf { m } ^ { g e n } \}$ to locate the inpainting region. Finally, $\mathcal { E } _ { o p t }$ in this task is defined as:
135
+
136
+ $$
137
+ \mathcal { E } _ { o p t } = \frac { w _ { i } } { \alpha + \beta \cdot S _ { g l o b a l } ( { \bf F } _ { t } ^ { g e n } , { \bf m } ^ { i p t } , { \bf F } _ { t } ^ { g u d } , { \bf m } ^ { r e f } ) } + S _ { l o c a l } ( { \bf F } _ { t } ^ { g e n } , { \bf m } ^ { i p t } , { \bf F } _ { t } ^ { g u d } , { \bf m } ^ { i p t } ) ,
138
+ $$
139
+
140
+ where $w _ { i }$ is a weight parameter, set as 2.5 in our implementation. The third image in Fig. 5 shows that this design can effectively achieve the editing goal without impeachable artifact.
141
+
142
+ Object resizing. The score function in this task is the same as the object moving, except that a scale factor $\gamma > 0$ is added during feature extraction. Specifically, we use interpolation to transform $\mathbf { m } ^ { g u d }$ and $\mathbf { F } _ { t } ^ { g u d }$ to the target size, and then extract $\mathbf { F } _ { t } ^ { g u d } [ \mathbf { m } ^ { g u d } ]$ as the feature of the resized object. To locate the target object with the same size in $\mathbf { F } _ { t } ^ { g e n }$ , we resize $\mathbf { m } ^ { g e n }$ with the same scale factor $\gamma$ Then we extract a new of the original size from the center of the resized . Note that if $\gamma < 1$ , we use 0 to pad the vacant area.
143
+
144
+ Appearance replacing. This task aims to replace the appearance between objects of the same category across images. Therefore, the capacity of the memory bank needs to be doubled to store extra information from the image containing the reference appearance, i.e., ${ \bf z } _ { t } ^ { r e f } , { \bf K } _ { t } ^ { r e f }$ , and $\mathbf { V } _ { t } ^ { r e f }$ . $\mathbf { m } ^ { g e n }$ and $\mathbf { m } ^ { g u d }$ respectively locate the editing object in the original image and the reference object in the reference image. $\mathbf { m } ^ { s h a r e }$ is set as the complement of $\mathbf { m } ^ { g e n }$ , i.e., ${ \mathbf { C } } _ { \mathbf { u } } ( \mathbf { m } ^ { g e n } )$ . To constrain appearance, we choose $\mathscr { S } _ { g l o b a l } ( \mathbf { F } _ { t } ^ { g e n } , \mathbf { m } ^ { g e n } , \mathbf { F } _ { t } ^ { r e f } , \mathbf { m } ^ { g u d } )$ in Eq. 5. This task has no need for $\mathcal { E } _ { o p t }$ .
145
+
146
+ Object pasting. Object pasting aims to paste an object from an image onto any position in another image. Although it can be completed by simple copy-paste, it often results in inconsistencies between the paste area and other areas due to differences in light and perspective, as shown in Fig. 6. As can be seen, the result obtained by copy-paste exists discontinuities, while the result generated by our DragonDiffusion can achieve a more harmonized integration of the scene and the pasted object. In implementation, similar to the appearance replacing, the memory bank needs to store information of the reference image, which contains the target object. $\mathbf { m } ^ { g e n }$ and $\mathbf { m } ^ { g u d }$ respectively mark the position of the object in the edited image and reference image. $\mathbf { m } ^ { s h a r e }$ is set as ${ \mathbf { C } } _ { \mathbf { u } } ( \mathbf { m } ^ { g e n } )$ .
147
+
148
+ Point dragging. In this task, we want to drag image content via several points, as DragGAN Pan et al. (2023). In this case, $\mathbf { m } ^ { g e n }$ and $\mathbf { m } ^ { g u d }$ locate neighboring areas centered around the destination and starting points. Here, we extract a $3 \times 3$ previous tasks, mshare is manually defined.
149
+
150
+ ![](images/c87c2d9b00d473df5675be8bcc664932795499d0d3a3df8737451cf5799648ac.jpg)
151
+ Figure 6: Visual comparison between our DragonDiffusion and direct copypaste in cross-image object pasting.
152
+
153
+ rectangular patch centered around each point as the neighboring area. Unlike the
154
+
155
+ # 3.5 VISUAL CROSS-ATTENTION
156
+
157
+ As mentioned previously, two strategies are used to ensure the consistency between the editing result and the original image: (1) DDIM inversion to initialize $\mathbf { z } _ { T }$ ; (2) content consistency guidance in Eq. 6. However, it is still challenging to maintain high consistency. Inspired by the consistency preserving in some video and image editing works Wu et al. (2022); Cao et al. (2023); Wang et al. (2023), we design a visual cross-attention guidance. Instead of generating guidance information through an independent inference branch, we reuse the intermediate features of the inversion process stored in the memory bank. Specifically, similar to the injection of text conditions in SD Rombach et al. (2022), we replace the key and value in the self-attention module of the UNet decoder with the corresponding key and value collected by the memory bank in DDIM inversion. Note that in the appearance replacing and object pasting tasks, the memory bank stores two sets of keys and values from the original image $( \dot { \mathbf { K } } _ { t } ^ { g u \bar { d } } , \mathbf { V } _ { t } ^ { g u \bar { d } } )$ and the reference image $( \mathbf { K } _ { t } ^ { r e f } , \mathbf { V } _ { t } ^ { r e f } )$ . In this case, we concatenate the two sets of keys and values in the length dimension. The visual cross-attention at each time step is defined as follows. $\textcircled{4}$ refers to the concatenation operation.
158
+
159
+ $$
160
+ \left\{ \begin{array} { l l } { \mathbf { Q } _ { t } = \mathbf { Q } _ { t } ^ { g e n } ; \mathbf { K } _ { t } = \mathbf { K } _ { t } ^ { g u d } \operatorname { o r } \big ( \mathbf { K } _ { t } ^ { g u d } ( \widehat { \mathbf { c } } ) \mathbf { K } _ { t } ^ { r e f } \big ) ; \mathbf { V } _ { t } = \mathbf { V } _ { t } ^ { g u d } \operatorname { o r } \big ( \mathbf { V } _ { t } ^ { g u d } ( \widehat { \mathbf { c } } ) \mathbf { V } _ { t } ^ { r e f } \big ) } \\ { \operatorname { A t t } ( \mathbf { Q } _ { t } , \mathbf { K } _ { t } , \mathbf { V } _ { t } ) = \operatorname { s o f t m a x } \big ( \frac { \mathbf { Q } _ { t } \mathbf { K } _ { t } ^ { T } } { \sqrt { d } } \big ) \mathbf { V } _ { t } . } \end{array} \right.
161
+ $$
162
+
163
+ # 4 EXPERIMENTS
164
+
165
+ In experiments, we use StableDiffusion-V1.5 Rombach et al. (2022) as the base model. The inference adopts DDIM sampling with 50 steps, and we set the classifier-free guidance scale as 5.
166
+
167
+ # 4.1 COMPARISONS
168
+
169
+ In this part, we compare our DragonDiffusion with other methods on various image editing tasks.
170
+
171
+ Content dragging. In this task, we compare our method with the recent UserControllableLT Endo (2022), DragGAN Pan et al. (2023), and DragDiffusion Shi et al. (2023). We first present the time complexity of different methods in Tab. 1. Specifically, We divide the time complexity of different methods into two parts, i.e., the preparing and inference stages. The preparing stage involves Diffusion/GAN inversion and model fine-tuning. The inference stage generates the editing result. The time complexity is tested on one point dragging, with the image resolution being $5 1 2 \times 5 1 2$ .
172
+
173
+ Table 1: Quantitative evaluation on face manipulation with 68 and 17 points. The accuracy is calculated by Euclidean distance between edited points and target points. The initial distance (i.e., $5 7 . 1 9$ and $3 6 . 3 6 )$ is the upper bound, without editing. FID Seitzer (2020) is utilized to quantize the editing quality of different methods. The time complexity is computed on the ‘1 point’ dragging.
174
+
175
+ <table><tr><td></td><td>Preparing complexity↓</td><td>Inference complexity↓</td><td>Unaligned face</td><td>17 Points↓ From 57.19</td><td>68 Points↓ From 36.36</td><td>FID↓ 17/68 points</td></tr><tr><td rowspan="2">UserControllableLT DragGAN</td><td>1.2s</td><td>0.05s</td><td>X</td><td>32.32</td><td>24.15</td><td>51.20/50.32</td></tr><tr><td>52.40s</td><td>6.71s</td><td>X</td><td>15.96</td><td>10.60</td><td>39.27/39.50</td></tr><tr><td>DragDiffusion</td><td>48.25s</td><td>19.71s</td><td>√</td><td>22.95</td><td>17.32</td><td>38.06/36.55</td></tr><tr><td>DragonDiffusion(ours)</td><td>3.62s</td><td>15.93s</td><td>√</td><td>18.51</td><td>13.94</td><td>35.75/34.58</td></tr></table>
176
+
177
+ ![](images/7961da10a2d166733facd99ea653a25d4d59b36357640ae4648c5b0fe24b36b5.jpg)
178
+ Figure 7: Qualitative comparison between our DragonDiffusion and other methods in face manipulation (target points are blue), object pasting, appearance replacing, and object moving.
179
+
180
+ The experiment is conducted on an NVIDIA A100 GPU with Float32 precision. The results present that our method is relatively efficient in the preparing stage, requiring only 3.62s to prepare $\mathbf { z } _ { T }$ and memory bank. The inference complexity is also acceptable for diffusion generation.
181
+
182
+ Following DragGAN Pan et al. (2023), the performance evaluation is conducted on the face keypoint manipulation with 17 and 68 points. The test set is randomly formed by 800 aligned faces from CelebA-HQ Karras et al. (2018) training set. Note that we do not set fixed regions for all methods, due to the difficulty in manually providing a mask for each face. In addition to accuracy, we also compute the FID Seitzer (2020) between face editing results and CelebA-HQ training set to represent the editing quality. The quantitative and qualitative comparison is presented in Tab. 1 and Fig. 7, respectively. One can see that our DragonDiffusion achieves promising results in editing accuracy and content consistency. Although DragGAN achieves better editing accuracy, it has limitations in content consistency and robustness in areas outside faces (e.g., the headwear is distorted). The limitations of GAN-based DragGAN and UserControllableLT also exist in requiring alignment before editing, as shown in Fig. 8. It can be seen that if editing without alignment, the results of DragGAN will suffer from severe degradation. The alignment operation is not friendly to our editing goal, as it will change the original image content, e.g., filtering out the background. In comparison, our method has promising editing accuracy, and the generation prior from SD enables better robustness and generalization for different content. In this task, our method also has better performance than DragDiffusion. More results are shown in the appendix.
183
+
184
+ ![](images/7af73319cd05890836e8f0e6f45f20b093169a0625bb2267904709828387915d.jpg)
185
+ Figure 9: Effectiveness of different components in our DragonDiffusion in the object moving task.
186
+
187
+ Other applications. For object pasting, we compare our method with Paint-by-example Yang et al. (2023). For appearance replacing and object moving, we compare our method with SelfGuidance Epstein et al. (2024). The visual comparison in Fig. 7 shows that our method can achieve comparable performance to the training method (i.e., Paint-by-example) in object pasting.
188
+
189
+ Compared to self-guidance, our method has better editing accuracy and content consistency. Due to the lack of consistency constraints, Self-Guidance produces some unexpected artifacts. Moreover, Self-Guidance has obvious deviation in complex scenes, due to the coarse correspondence between text and image features. More results are presented in Appendix.
190
+
191
+ # 4.2 ABLATION STUDY
192
+
193
+ ![](images/615a632312a30fe05bcb0478aa9f597790eda47ed0cb8c6ce508b7e03b6f29b7.jpg)
194
+ Figure 8: Editing comparison between our DragonDiffusion and DragGAN Pan et al. (2023) on the unaligned body and face.
195
+
196
+ In this part, we demonstrate the effectiveness of some components in our DragonDiffusion, as shown in Fig. 9. We conduct the experiment on the object moving task. Specifically, (1) we verify the importance of the inversion prior by randomly initializing $\mathbf { z } _ { T }$ instead of obtaining from DDIM inversion. As can be seen, the random $\mathbf { z } _ { T }$ leads to a significant difference between the editing result and the original image. (2) We remove the content consistency guidance (i.e., $\mathcal { E } _ { { c o n t e n t } } )$ in Eq. 7, which causes local distortion in the editing result, e.g., the finger is twisted. (3) We remove the visual cross-attention. It can be seen that visual cross-attention plays an important role in maintaining the consistency between the edited object and the original object. Using a memory bank to provide $\mathbf { K } _ { t }$ and $\mathbf { V } _ { t }$ can greatly reduce the additional cost. In Appendix, we show an ablation study for memory bank. Therefore, these components work together on both edited and unedited content, forming the fine-grained image editing model DragonDiffusion, which does not require extra training or modules.
197
+
198
+ # 5 CONCLUSION
199
+
200
+ Despite the ability of existing large-scale text-to-image (T2I) diffusion models to generate highquality images from detailed textual descriptions, they often lack the ability to precisely edit the generated or real images. In this paper, we aim to develop a drag-style and general image editing scheme based on the strong correspondence of intermediate image features in the pre-trained diffusion model. To this end, we model image editing as the change of feature correspondence and design energy functions to transform the editing operations into gradient guidance. Based on the gradient guidance strategy, we also propose multi-scale guidance to consider both semantic and geometric alignment. Moreover, a visual cross-attention is added based on a memory bank design, which can enhance the consistency between the original image and the editing result. Due to the reuse of intermediate information from the inversion process, this content consistency strategy almost has no additional cost. Extensive experiments demonstrate that our proposed DragonDiffusion can perform various image editing tasks, including object moving, resizing, appearance replacing, object pasting, and content dragging. At the same time, the complexity of our DragonDiffusion is acceptable, and it does not require extra model fine-tuning or additional modules.
201
+
202
+ REFERENCES
203
+ Rameen Abdal, Yipeng Qin, and Peter Wonka. Image2stylegan: How to embed images into the stylegan latent space? In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 4432–4441, 2019.
204
+ Rameen Abdal, Yipeng Qin, and Peter Wonka. Image2stylegan $^ { + + }$ : How to edit the embedded images? In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 8296–8305, 2020.
205
+ Yuval Alaluf, Omer Tov, Ron Mokady, Rinon Gal, and Amit Bermano. Hyperstyle: Stylegan inversion with hypernetworks for real image editing. In Proceedings of the IEEE/CVF conference on computer Vision and pattern recognition, pp. 18511–18521, 2022.
206
+ Omri Avrahami, Dani Lischinski, and Ohad Fried. Blended diffusion for text-driven editing of natural images. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 18208–18218, 2022.
207
+ Yogesh Balaji, Seungjun Nah, Xun Huang, Arash Vahdat, Jiaming Song, Karsten Kreis, Miika Aittala, Timo Aila, Samuli Laine, Bryan Catanzaro, et al. ediffi: Text-to-image diffusion models with an ensemble of expert denoisers. arXiv preprint arXiv:2211.01324, 2022.
208
+ 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, pp. 843–852, 2023.
209
+ 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.
210
+ Mingdeng Cao, Xintao Wang, Zhongang Qi, Ying Shan, Xiaohu Qie, and Yinqiang Zheng. Masactrl: Tuning-free mutual self-attention control for consistent image synthesis and editing. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 22560–22570, 2023.
211
+ Prafulla Dhariwal and Alexander Nichol. Diffusion models beat gans on image synthesis. Advances in neural information processing systems, 34:8780–8794, 2021.
212
+ Yuki Endo. User-controllable latent transformer for stylegan image layout editing. In Computer Graphics Forum, volume 41, pp. 395–406. Wiley Online Library, 2022.
213
+ Dave Epstein, Allan Jabri, Ben Poole, Alexei Efros, and Aleksander Holynski. Diffusion selfguidance for controllable image generation. Advances in Neural Information Processing Systems, 36, 2024.
214
+ Weixi Feng, Xuehai He, Tsu-Jui Fu, Varun Jampani, Arjun Reddy Akula, Pradyumna Narayana, Sugato Basu, Xin Eric Wang, and William Yang Wang. Training-free structured diffusion guidance for compositional text-to-image synthesis. In Proceedings of the International Conference on Learning Representations, 2022.
215
+ Amir Hertz, Ron Mokady, Jay Tenenbaum, Kfir Aberman, Yael Pritch, and Daniel Cohen-or. Prompt-to-prompt image editing with cross-attention control. In Proceedings of the International Conference on Learning Representations, 2022.
216
+ Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Advances in Neural Information Processing Systems, 33:6840–6851, 2020.
217
+ Tero Karras, Timo Aila, Samuli Laine, and Jaakko Lehtinen. Progressive growing of gans for improved quality, stability, and variation. In Proceedings of the International Conference on Learning Representations, 2018.
218
+ Tero Karras, Samuli Laine, and Timo Aila. A style-based generator architecture for generative adversarial networks. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 4401–4410, 2019.
219
+
220
+ Bahjat Kawar, Shiran Zada, Oran Lang, Omer Tov, Huiwen Chang, Tali Dekel, Inbar Mosseri, and Michal Irani. Imagic: Text-based real image editing with diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 6007–6017, 2023.
221
+
222
+ Gihyun Kwon and Jong Chul Ye. Diffusion-based image translation using disentangled style and content representation. In Proceedings of the International Conference on Learning Representations, 2022.
223
+ 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 Proceedings of the International Conference on Learning Representations, 2021.
224
+ Chong Mou, Xintao Wang, Liangbin Xie, Jian Zhang, Zhongang Qi, Ying Shan, and Xiaohu Qie. T2i-adapter: Learning adapters to dig out more controllable ability for text-to-image diffusion models. arXiv preprint arXiv:2302.08453, 2023.
225
+ 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, 2022.
226
+ Xingang Pan, Ayush Tewari, Thomas Leimkuhler, Lingjie Liu, Abhimitra Meka, and Christian ¨ Theobalt. Drag your gan: Interactive point-based manipulation on the generative image manifold. In ACM SIGGRAPH 2023 Conference Proceedings, pp. 1–11, 2023.
227
+ Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical textconditional image generation with clip latents. arXiv preprint arXiv:2204.06125, 2022.
228
+ Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Bjorn 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.
229
+ Simo Ryu. Low-rank adaptation for fast text-to-image diffusion fine-tuning, 2023.
230
+ Chitwan Saharia, 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.
231
+ Maximilian Seitzer. pytorch-fid: FID Score for PyTorch. https://github.com/mseitzer/ pytorch-fid, August 2020. Version 0.3.0.
232
+ Yujun Shi, Chuhui Xue, Jiachun Pan, Wenqing Zhang, Vincent YF Tan, and Song Bai. Dragdiffusion: Harnessing diffusion models for interactive point-based image editing. arXiv preprint arXiv:2306.14435, 2023.
233
+ Jaskirat Singh, Stephen Gould, and Liang Zheng. High-fidelity guided image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 5997–6006, 2023.
234
+ 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.
235
+ Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. In Proceedings of the International Conference on Learning Representations, 2020a.
236
+ Yang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. Advances in neural information processing systems, 32, 2019.
237
+ Yang Song and Stefano Ermon. Improved techniques for training score-based generative models. Advances in neural information processing systems, 33:12438–12448, 2020.
238
+ Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. In Proceedings of the International Conference on Learning Representations, 2020b.
239
+ 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.
240
+ Dani Valevski, Matan Kalman, Eyal Molad, Eyal Segalis, Yossi Matias, and Yaniv Leviathan. Unitune: Text-driven image editing by fine tuning a diffusion model on a single image. ACM Transactions on Graphics (TOG), 42(4):1–10, 2023.
241
+ Andrey Voynov, Kfir Aberman, and Daniel Cohen-Or. Sketch-guided text-to-image diffusion models. In ACM SIGGRAPH 2023 Conference Proceedings, pp. 1–11, 2023.
242
+ Wen Wang, Kangyang Xie, Zide Liu, Hao Chen, Yue Cao, Xinlong Wang, and Chunhua Shen. Zeroshot video editing using off-the-shelf image diffusion models. arXiv preprint arXiv:2303.17599, 2023.
243
+ Jay Zhangjie Wu, Yixiao Ge, Xintao Wang, Weixian Lei, Yuchao Gu, 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. arXiv preprint arXiv:2212.11565, 2022.
244
+ Binxin Yang, Shuyang Gu, Bo Zhang, Ting Zhang, Xuejin Chen, Xiaoyan Sun, Dong Chen, and Fang Wen. Paint by example: Exemplar-based image editing with diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 18381– 18391, 2023.
245
+ 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, pp. 23174–23184, 2023.
246
+ 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, pp. 3836–3847, 2023.
247
+ 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.
parse/test/OEL4FJMg1b/OEL4FJMg1b_content_list.json ADDED
@@ -0,0 +1,548 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "DRAGONDIFFUSION: ENABLING DRAG-STYLE MANIPULATION ON DIFFUSION MODELS ",
5
+ "text_level": 1,
6
+ "page_idx": 0
7
+ },
8
+ {
9
+ "type": "text",
10
+ "text": "Chong $\\mathbf { M o u } ^ { 1 , 3 }$ Xintao Wang2 Jiechong Song1 Ying Shan2 Jian Zhang1,3∗ ",
11
+ "page_idx": 0
12
+ },
13
+ {
14
+ "type": "text",
15
+ "text": "1School of Electronic and Computer Engineering, Shenzhen Graduate School, Peking University 2ARC Lab, Tencent PCG 3Peking University Shenzhen Graduate School-Rabbitpre AIGC Joint Research Laboratory {eechongm, xintao.alpha}@gmail.com, {songjiechong, zhangjian.sz}@pku.edu.cn ",
16
+ "page_idx": 0
17
+ },
18
+ {
19
+ "type": "image",
20
+ "img_path": "images/a3774750dccc549dab677d338d76bb0b7514073bdf15242e03aade9c8bd3e58a.jpg",
21
+ "image_caption": [
22
+ "Figure 1: The image editing tasks that our DragonDiffusion can achieve without training. "
23
+ ],
24
+ "image_footnote": [],
25
+ "page_idx": 0
26
+ },
27
+ {
28
+ "type": "text",
29
+ "text": "ABSTRACT ",
30
+ "text_level": 1,
31
+ "page_idx": 0
32
+ },
33
+ {
34
+ "type": "text",
35
+ "text": "Despite the ability of text-to-image (T2I) diffusion models to generate highquality images, transferring this ability to accurate image editing remains a challenge. In this paper, we propose a novel image editing method, DragonDiffusion, enabling Drag-style manipulation on Diffusion models. Specifically, we treat image editing as the change of feature correspondence in a pre-trained diffusion model. By leveraging feature correspondence, we develop energy functions that align with the editing target, transforming image editing operations into gradient guidance. Based on this guidance approach, we also construct multi-scale guidance that considers both semantic and geometric alignment. Furthermore, we incorporate a visual cross-attention strategy based on a memory bank design to ensure consistency between the edited result and original image. Benefiting from these efficient designs, all content editing and consistency operations come from the feature correspondence without extra model fine-tuning. Extensive experiments demonstrate that our method has promising performance on various image editing tasks, including within a single image (e.g., object moving, resizing, and content dragging) or across images (e.g., appearance replacing and object pasting). ",
36
+ "page_idx": 0
37
+ },
38
+ {
39
+ "type": "text",
40
+ "text": "Code is available at https://github.com/MC-E/DragonDiffusion. ",
41
+ "page_idx": 0
42
+ },
43
+ {
44
+ "type": "text",
45
+ "text": "1 INTRODUCTION ",
46
+ "text_level": 1,
47
+ "page_idx": 0
48
+ },
49
+ {
50
+ "type": "text",
51
+ "text": "Thanks to the large-scale training data and huge computing power, generative models have developed rapidly, especially text-to-image (T2I) diffusion models Saharia et al. (2022); Rombach et al. (2022); Nichol et al. (2022); Ramesh et al. (2022), which aims to generate images conditioned on a given text/prompt. However, this generative capability is usually diverse, and it is challenging to design suitable prompts to generate images consistent with what the user has in mind Mou et al. (2023); Zhang et al. (2023), let alone fine-grained image editing based on the text condition. ",
52
+ "page_idx": 0
53
+ },
54
+ {
55
+ "type": "text",
56
+ "text": "In the community of image editing, previous methods are usually designed based on GANs Abdal et al. (2019; 2020); Alaluf et al. (2022) due to the compact and editable latent space, e.g., the $\\mathcal { W }$ space in StyleGAN Karras et al. (2019). Recently, DragGAN Pan et al. (2023) proposes a pointto-point dragging scheme, which can achieve refined content dragging. However, it is limited by the capacity and generalization of GANs. Compared to GANs, diffusion model Ho et al. (2020) has higher stability and superior generation quality. Due to the lack of a concise and editable latent space, numerous diffusion-based image editing methods Hertz et al. (2022); Feng et al. (2022); Balaji et al. (2022) are built based on T2I diffusion models via correspondence between text and image features. Recently, self-guidance Epstein et al. (2024) proposes a differentiable approach that employs crossattention maps between text and image to locate and calculate the size of objects within images. Then, gradient guidance is utilized to edit these properties. However, the correspondence between text and image features is weak, heavily relying on the design of prompts. Moreover, in complex or multi-object scenarios, text struggles to build accurate correspondence with a specific object. In this paper, we aim to investigate whether the diffusion model can achieve drag-style image editing, which is a fine-grained and generalized editing ability not limited to point dragging. ",
57
+ "page_idx": 1
58
+ },
59
+ {
60
+ "type": "text",
61
+ "text": "In the large-scale T2I diffusion model, besides the correspondence between text features and intermediate image features, there is also a strong correspondence across image features. This characteristic is studied in DIFT Tang et al. (2023), which demonstrates that this correspondence is high-level, enabling point-to-point correspondence of relevant image content. Therefore, we are intrigued by the possibility of utilizing this strong correspondence across image features to achieve image editing. In this paper, we regard image editing as the change of feature correspondence and convert it into gradient guidance via energy functions Dhariwal & Nichol (2021) in score-based diffusion Song et al. (2020b). Additionally, the content consistency between editing results and original images is also ensured by feature correspondence in a visual cross-attention design. Here, we notice that there is a concurrent work, DragDiffusion Shi et al. (2023), studying this issue. It uses LORA Ryu (2023) to maintain consistency with the original image and optimizes the latent in a specific diffusion step to perform point dragging. Unlike DragDiffusion, our image editing is achieved by energy functions and a visual cross-attention design, without extra model fine-tuning or new blocks. In addition, we can complete various drag-style image editing tasks beyond the point dragging, as shown in Fig. 1. ",
62
+ "page_idx": 1
63
+ },
64
+ {
65
+ "type": "text",
66
+ "text": "In summary, the contributions of this paper are as follows: ",
67
+ "page_idx": 1
68
+ },
69
+ {
70
+ "type": "text",
71
+ "text": "• We achieve drag-style image editing via image feature correspondence in the pre-trained diffusion model. We also study the roles of the features in different layers and develop multi-scale guidance that considers both semantic and geometric correspondence. • We design a memory bank, further utilizing the image feature correspondence to maintain the consistency between editing results and original images. In conjunction with gradient guidance, our method allows a direct transfer of T2I generation ability in diffusion models to image editing tasks without the need for extra model fine-tuning or new blocks. Extensive experiments demonstrate that our method has promising performance in various image editing tasks, including editing within a single image (e.g., object moving, resizing, and content dragging) or across images (e.g., appearance replacing and object pasting). ",
72
+ "page_idx": 1
73
+ },
74
+ {
75
+ "type": "text",
76
+ "text": "2 RELATED WORK ",
77
+ "text_level": 1,
78
+ "page_idx": 1
79
+ },
80
+ {
81
+ "type": "text",
82
+ "text": "2.1 DIFFUSION MODELS ",
83
+ "text_level": 1,
84
+ "page_idx": 1
85
+ },
86
+ {
87
+ "type": "text",
88
+ "text": "Recently, diffusion models Ho et al. (2020) have achieved great success in the community of image synthesis. It is designed based on thermodynamics Sohl-Dickstein et al. (2015); Song & Ermon (2019), including a diffusion process and a reverse process. In the diffusion process, a natural image $\\mathbf { x } _ { \\mathrm { 0 } }$ is converted to a Gaussian distribution $\\mathbf { x } _ { T }$ by adding random Gaussian noise with $T$ iterations. The reverse process is to recover $\\mathbf { x } _ { \\mathrm { 0 } }$ from $\\mathbf { x } _ { T }$ by several denoising steps. Therefore, the diffusion model is to train a denoiser, conditioned on the current noisy image $\\mathbf { x } _ { t }$ and time step $t$ : ",
89
+ "page_idx": 1
90
+ },
91
+ {
92
+ "type": "equation",
93
+ "img_path": "images/0aaf46e5545b5409f9eba09115b127b3ec3eaf5f150909f031ae69594e503e16.jpg",
94
+ "text": "$$\n\\begin{array} { r } { \\mathbb { E } _ { \\mathbf { x } _ { 0 } , t , \\epsilon _ { t } \\sim \\mathcal { N } ( 0 , 1 ) } \\left[ | | \\epsilon _ { t } - \\epsilon _ { \\pmb { \\theta } } ( \\mathbf { x } _ { t } , t ) | | _ { 2 } ^ { 2 } \\right] , } \\end{array}\n$$",
95
+ "text_format": "latex",
96
+ "page_idx": 1
97
+ },
98
+ {
99
+ "type": "text",
100
+ "text": "where $\\epsilon _ { \\pmb { \\theta } }$ is the function of the denoiser. Recently, some text-conditioned diffusion models (e.g., GLID Nichol et al. (2022) and StableDiffusion(SD) Rombach et al. (2022)) are proposed. Especially SD, transforming $\\mathbf { x } _ { t }$ to the latent space $\\mathbf { z } _ { t }$ , significantly improves the generation performance. From ",
101
+ "page_idx": 1
102
+ },
103
+ {
104
+ "type": "text",
105
+ "text": "the continuous perspective Song et al. (2020b), diffusion models can be viewed as a score function (i.e., $\\epsilon _ { \\pmb { \\theta } } ( \\mathbf { x } _ { t } , t ) \\approx \\nabla _ { \\mathbf { x } _ { t } } \\log q ( \\mathbf { x } _ { t } ) )$ that samples from the corresponding distribution Song & Ermon (2020) according to Langevin dynamics Sohl-Dickstein et al. (2015); Song & Ermon (2019). ",
106
+ "page_idx": 2
107
+ },
108
+ {
109
+ "type": "text",
110
+ "text": "2.2 ENERGY FUNCTION IN DIFFUSION MODEL ",
111
+ "text_level": 1,
112
+ "page_idx": 2
113
+ },
114
+ {
115
+ "type": "text",
116
+ "text": "From the continuous perspective of score-based diffusion, the external condition y can be combined by a conditional score function, i.e., $\\nabla _ { \\mathbf { x } _ { t } } \\log q ( \\mathbf { x } _ { t } | \\mathbf { y } )$ , to sample from a more enriched distribution. The conditional score function can be further decomposed as: ",
117
+ "page_idx": 2
118
+ },
119
+ {
120
+ "type": "equation",
121
+ "img_path": "images/ea3c7ac3e7c4f40206ab0b19b32a378e6f56a2869bf9b0128ea765b60c5ad8d2.jpg",
122
+ "text": "$$\n\\nabla _ { \\mathbf { x } _ { t } } \\log q ( \\mathbf { x } _ { t } | \\mathbf { y } ) = \\nabla _ { \\mathbf { x } _ { t } } \\log \\left( \\frac { q ( \\mathbf { y } | \\mathbf { x } _ { t } ) q ( \\mathbf { x } _ { t } ) } { q ( \\mathbf { y } ) } \\right) \\propto \\nabla _ { \\mathbf { x } _ { t } } \\log q ( \\mathbf { x } _ { t } ) + \\nabla _ { \\mathbf { x } _ { t } } \\log q ( \\mathbf { y } | \\mathbf { x } _ { t } ) ,\n$$",
123
+ "text_format": "latex",
124
+ "page_idx": 2
125
+ },
126
+ {
127
+ "type": "text",
128
+ "text": "where the first term is the unconditional denoiser, and the second term refers to the conditional gradient produced by an energy function $\\mathcal { E } ( \\mathbf { x } _ { t } ; t , \\mathbf { y } ) = q ( \\mathbf { x } _ { t } | \\mathbf { y } )$ . $\\mathcal { E }$ can be selected based on the generation target, such as a classifier Dhariwal & Nichol (2021) to specify the category of generation results. Energy function has been used in various controllable generation tasks, e.g., sketch-guided generation Voynov et al. (2023), mask-guided generation Singh et al. (2023), universal guidance Yu et al. (2023); Bansal et al. (2023), and image editing Epstein et al. (2024). These methods, inspire us to transform editing operations into conditional gradients, achieving fine-grained image editing. ",
129
+ "page_idx": 2
130
+ },
131
+ {
132
+ "type": "text",
133
+ "text": "2.3 IMAGE EDITING ",
134
+ "text_level": 1,
135
+ "page_idx": 2
136
+ },
137
+ {
138
+ "type": "text",
139
+ "text": "In image editing, numerous previous methods Abdal et al. (2019; 2020); Alaluf et al. (2022) invert images into the latent space of StyleGAN Karras et al. (2019) and then edit the image by manipulating latent vectors. Motivated by the success of diffusion model Ho et al. (2020), various diffusionbased image editing methods Avrahami et al. (2022); Hertz et al. (2022); Kawar et al. (2023); Meng et al. (2021); Brooks et al. (2023) are proposed. Most of them use text as the editing control. For example, Kawar et al. (2023); Valevski et al. (2023); Kwon & Ye (2022) perform model fine-tuning on a single image and then generate the editing result by target text. Prompt2Prompt Hertz et al. (2022) achieves specific object editing by exchanging text-image attention maps. SDEdit Meng et al. (2021) performs image editing by adding noise to the original image and then denoising under new text conditions. InstructPix2Pix Brooks et al. (2023) finetunes the diffusion model with text as the editing instruction. Recently, Self-guidance Epstein et al. (2024) transforms image editing operations into gradients through the correspondence between text and image features. However, the correspondence between text and image is weak, unable to perform fine-grained editing. Recently, DragGAN Pan et al. (2023) presents a point-to-point dragging scheme. Nevertheless, its editing quality and generalization are limited by GANs. How to utilize the high-quality and diverse generation ability of diffusion models for fine-grained image editing is still an open challenge. ",
140
+ "page_idx": 2
141
+ },
142
+ {
143
+ "type": "text",
144
+ "text": "3 METHOD ",
145
+ "text_level": 1,
146
+ "page_idx": 2
147
+ },
148
+ {
149
+ "type": "text",
150
+ "text": "3.1 PRELIMINARY: HOW TO CONSTRUCT ENERGY FUNCTION IN DIFFUSION ",
151
+ "text_level": 1,
152
+ "page_idx": 2
153
+ },
154
+ {
155
+ "type": "text",
156
+ "text": "Modeling an energy function $\\mathcal { E } ( \\mathbf { x } _ { t } ; t , \\mathbf { y } )$ to produce the conditional gradient $\\nabla _ { \\mathbf { x } _ { t } } \\log q ( \\mathbf { y } | \\mathbf { x } _ { t } )$ in Eq. 2, remains an open question. $\\mathcal { E }$ measures the distance between $\\mathbf { x } _ { t }$ and the condition y. Some methods Dhariwal & Nichol (2021); Voynov et al. (2023); Zhao et al. (2022) train a time-dependent distance measuring function, e.g., a classifier Dhariwal $\\&$ Nichol (2021) to predict the probability that $\\mathbf { x } _ { t }$ belongs to category y. However, the training cost and annotation difficulty are intractable in our image editing task. Some tuning-free methods $\\mathrm { Y u }$ et al. (2023); Bansal et al. (2023) propose using the clean image $\\mathbf { x } _ { 0 \\mid t }$ predicted at each time step $t$ to replace $\\mathbf { x } _ { t }$ for distance measuring, i.e., $\\mathcal { E } ( \\mathbf { x } _ { t } ; t , \\mathbf { y } ) \\approx \\mathcal { D } ( \\mathbf { x } _ { 0 \\mid t } ; t , \\mathbf { y } )$ . Nevertheless, there is a bias between $\\mathbf { x } _ { 0 \\mid t }$ and $\\mathbf { x } _ { \\mathrm { 0 } }$ , and there is hardly a suitable $\\mathcal { D }$ for distance measuring in image editing tasks. Hence, the primary issue is whether we can circumvent the training requirement and construct an energy function to measure the distance between $\\mathbf { x } _ { t }$ and the editing target. Recent work Tang et al. (2023) has shown that the feature correspondence in the diffusion UNet-denoiser $\\epsilon _ { \\theta }$ is high-level, enabling point-to-point correspondence measuring. Inspired by this characteristic, we propose reusing $\\epsilon _ { \\theta }$ as a tuning-free energy function to transform image editing operations into the change of feature correspondence. ",
157
+ "page_idx": 2
158
+ },
159
+ {
160
+ "type": "image",
161
+ "img_path": "images/512b8185ae2c928b1b72c0992dfdd8d0e17a74bcafa1163a67eb774d514c837f.jpg",
162
+ "image_caption": [
163
+ "Figure 2: Overview of our DragonDiffusion, containing a memory bank and score-based gradient guidance on the pre-trained SD Rombach et al. (2022) without extra training or modules. "
164
+ ],
165
+ "image_footnote": [],
166
+ "page_idx": 3
167
+ },
168
+ {
169
+ "type": "text",
170
+ "text": "3.2 OVERVIEW ",
171
+ "text_level": 1,
172
+ "page_idx": 3
173
+ },
174
+ {
175
+ "type": "text",
176
+ "text": "The editing objective of our DragonDiffusion involves two issues: changing the content to be edited and preserving unedited content. For example, if a user wants to move the cup in an image, the generated result only needs to change the position of the cup, while the appearance of the cup and other unedited content should not change. An overview of our method is presented in Fig. 2, which is built on the pre-trained SD Rombach et al. (2022) to support image editing with and without reference images. Since SD is a latent diffusion model (LDM), we first encode the original image $\\mathbf { x } _ { \\mathrm { 0 } }$ into the latent space $\\mathbf { z } _ { 0 }$ , which is then reversed to $\\mathbf { z } _ { T }$ by DDIM inversion Song et al. (2020a). If the reference image $\\mathbf { x } _ { 0 } ^ { r e f }$ exists, it will also be involved in the inversion to produce ${ \\bf z } _ { T } ^ { r e f }$ In this process, we store some intermediate features and latent at each time step to build a memory bank, which is used to provide guidance for subsequent image editing. In generation, we transform the information stored in the memory bank into content editing and consistency guidance through two paths, i.e., visual cross-attention and gradient guidance. Both of these paths are built based on feature correspondence in the pre-trained SD, without extra model fine-tuning or new blocks. ",
177
+ "page_idx": 3
178
+ },
179
+ {
180
+ "type": "text",
181
+ "text": "3.3 DDIM INVERSION WITH MEMORY BANK ",
182
+ "text_level": 1,
183
+ "page_idx": 3
184
+ },
185
+ {
186
+ "type": "text",
187
+ "text": "In our image editing process, the starting point $\\mathbf { z } _ { T }$ , produced by DDIM inversion Song et al. (2020a), can provide a good generation prior to maintain consistency with the original image. However, relying solely on the final step of this approximate inversion can hardly provide accurate generation guidance. Therefore, we fully utilize the information in DDIM inversion by building a memory bank to store the latent $\\mathbf { z } _ { t } ^ { g u d }$ at each inversion step $t$ , as well as corresponding keys ${ \\bf K } _ { t } ^ { g u d }$ and values $\\mathbf { V } _ { t } ^ { g u d }$ in the self-attention module of the decoder within the UNet denoiser. Note that in some cross-image editing tasks (e.g., appearance replacing, object pasting), reference images are required. In these tasks, the memory bank needs to be doubled to store the information of the reference images. Here, we utilize zreft , Kreft , and $\\mathbf { V } _ { t } ^ { r e f }$ to represent them. The information stored in the memory bank will provide more accurate guidance for the subsequent image editing process. ",
188
+ "page_idx": 3
189
+ },
190
+ {
191
+ "type": "text",
192
+ "text": "3.4 GRADIENT-GUIDANCE-BASED EDITING DESIGN ",
193
+ "text_level": 1,
194
+ "page_idx": 3
195
+ },
196
+ {
197
+ "type": "text",
198
+ "text": "Inspired by classifier guidance Dhariwal & Nichol (2021), we build energy functions to transform image editing operations into gradient guidance in diffusion sampling. An intuitive illustration is presented in Fig. 3, showing a continuous sampling space of the score-based diffusion Song et al. (2020b). The sampling starting point $\\mathbf { z } _ { T }$ , obtained from DDIM inversion, will approximately return to the original point only according to the gradient/score predicted by the denoiser. After incorporating the gradient guidance generated by the energy function that matches the editing target, the additional guidance gradient will change the path to reach a sampling result that meets the editing target. ",
199
+ "page_idx": 3
200
+ },
201
+ {
202
+ "type": "image",
203
+ "img_path": "images/2e07f217bb7cf0f1e95aa120726fe01b834afedaf4179d4c628ecfbf948713f6.jpg",
204
+ "image_caption": [
205
+ ": Original Gradient : Corrected Gradient Figure 3: Illustration of continuous sampling space in score-based diffusion. Bright colors indicate areas where target data is densely distributed. The orange and green paths respectively refer to the diffusion paths without and with external gradient guidance. "
206
+ ],
207
+ "image_footnote": [],
208
+ "page_idx": 3
209
+ },
210
+ {
211
+ "type": "text",
212
+ "text": "3.4.1 ENERGY FUNCTION VIA FEATURE CORRESPONDENCE ",
213
+ "text_level": 1,
214
+ "page_idx": 4
215
+ },
216
+ {
217
+ "type": "text",
218
+ "text": "In our DragonDiffusion, energy functions are designed to provide gradient guidance for image editing, mainly including content editing and consistency terms. Specifically, at the $t$ -th time step, we reuse the UNet denoiser $\\epsilon _ { \\pmb { \\theta } }$ to extract intermediate features $\\mathbf { F } _ { t } ^ { g e \\hat { n } }$ from the latent ${ \\bf z } _ { t } ^ { g e n }$ at the current time step. The same operation is used to extract guided features $\\mathbf { F } _ { t } ^ { g u d }$ from $\\mathbf { z } _ { t } ^ { g u d }$ in memory bank. Following DIFT Tang et al. (2023), decoder. The image editing operatio $\\mathbf { F } _ { t } ^ { g e n }$ and Fgud pres come from intermediate by two binary masks (i.e., $\\mathbf { m } ^ { g u d }$ s inand $\\mathbf { m } ^ { g e n }$ Net) to locate the original content position and target dragging position, respectively. Therefore, the energy function is built by constraining the correspondence between these two regions in $\\mathbf { F } _ { t } ^ { g u d }$ and $\\mathbf { F } _ { t } ^ { g e n }$ . Here, we utilize cosine distance $\\cos ( \\cdot ) \\in [ - 1 , 1 ]$ to measure the similarity and normalize it to $[ 0 , 1 ]$ : ",
219
+ "page_idx": 4
220
+ },
221
+ {
222
+ "type": "equation",
223
+ "img_path": "images/9e9e68ea494840b887a7e124fb4f2bd6275c5dafc5c27acf232a134512fbcfa6.jpg",
224
+ "text": "$$\n\\begin{array} { r } { \\mathcal { S } _ { l o c a l } ( \\mathbf { F } _ { t } ^ { g e n } , \\mathbf { m } ^ { g e n } , \\mathbf { F } _ { t } ^ { g u d } , \\mathbf { m } ^ { g u d } ) = 0 . 5 \\cdot \\cos \\Big ( \\mathbf { F } _ { t } ^ { g e n } [ \\mathbf { m } ^ { g e n } ] , ~ \\mathrm { s g } ( \\mathbf { F } _ { t } ^ { g u d } [ \\mathbf { m } ^ { g u d } ] ) \\Big ) + 0 . 5 , } \\end{array}\n$$",
225
+ "text_format": "latex",
226
+ "page_idx": 4
227
+ },
228
+ {
229
+ "type": "text",
230
+ "text": "where $\\operatorname { s g } ( \\cdot )$ is the gradient clipping operation. Eq. 3 is mainly used for dense constraints on the spatial location of content. In addition, a global appearance similarity is defined as: ",
231
+ "page_idx": 4
232
+ },
233
+ {
234
+ "type": "equation",
235
+ "img_path": "images/2cfd3d25d276e31ee3655d18f79add57758e141dae84272da9825f438d08390f.jpg",
236
+ "text": "$$\nS _ { g l o b a l } ( { \\bf F } _ { t } ^ { g e n } , { \\bf m } ^ { g e n } , { \\bf F } _ { t } ^ { g u d } , { \\bf m } ^ { g u d } ) = 0 . 5 \\cdot \\cos \\left( \\frac { \\sum { \\bf F } _ { t } ^ { g e n } [ { \\bf m } ^ { g e n } ] } { \\sum { \\bf m } ^ { g e n } } , ~ \\mathrm { s g } ( \\frac { \\sum { \\bf F } _ { t } ^ { g u d } [ { \\bf m } ^ { g u d } ] } { \\sum { \\bf m } ^ { g u d } } ) \\right) + 0 . 5 ,\n$$",
237
+ "text_format": "latex",
238
+ "page_idx": 4
239
+ },
240
+ {
241
+ "type": "text",
242
+ "text": "which utilizes the mean of the features in a region as a global appearance representation. When we want to have fine control over the spatial position of an object or a rough global control over its appearance, we only need to constrain the similarity in Eq. 3 and Eq. 4 to be as large as possible. Therefore, the energy function to produce editing guidance is defined as: ",
243
+ "page_idx": 4
244
+ },
245
+ {
246
+ "type": "equation",
247
+ "img_path": "images/64136c4d6d69b812e17519cb97adf07fb10fb530d7d31ed514992bf61532e74d.jpg",
248
+ "text": "$$\n\\mathcal { E } _ { e d i t } = \\frac { 1 } { \\alpha + \\beta \\cdot \\mathscr { S } ( \\mathbf { F } _ { t } ^ { g e n } , \\mathbf { m } ^ { g e n } , \\mathbf { F } _ { t } ^ { g u d } , \\mathbf { m } ^ { g u d } ) } , \\quad \\mathscr { S } \\in \\{ S _ { l o c a l } , \\mathscr { S } _ { g l o b a l } \\} ,\n$$",
249
+ "text_format": "latex",
250
+ "page_idx": 4
251
+ },
252
+ {
253
+ "type": "text",
254
+ "text": "where $\\alpha$ and $\\beta$ are two hyper-parameters, which are set as 1 and 4, respectively. In addition to editing, we hope the unedited content remains consistent with the original image. We use a mask $\\mathbf { m } ^ { s h a r e }$ to locate areas without editing. The similarity between the editing result and the original image in $\\mathbf { m } ^ { s h a r e }$ can also be calculated by the cosine similarity as $\\{ { S _ { l o c a l } } ( { { \\bf { F } } _ { t } ^ { g e n } } , { { \\bf { m } } ^ { s h a r e } } , { { \\bf { F } } _ { t } ^ { g u d } } , { { \\bf { m } } ^ { s h a r e } } )$ . Therefore, the energy function to produce content consistency guidance is defined as: ",
255
+ "page_idx": 4
256
+ },
257
+ {
258
+ "type": "equation",
259
+ "img_path": "images/81ef4d1c5ee33a2a00fabd0825f82834768c5a3d3519fb5aa12b0cc1c7d77e5c.jpg",
260
+ "text": "$$\n\\mathcal { E } _ { c o n t e n t } = \\frac { 1 } { \\alpha + \\beta \\cdot S _ { l o c a l } ( \\mathbf { F } _ { t } ^ { g e n } , \\mathbf { m } ^ { s h a r e } , \\mathbf { F } _ { t } ^ { g u d } , \\mathbf { m } ^ { s h a r e } ) } .\n$$",
261
+ "text_format": "latex",
262
+ "page_idx": 4
263
+ },
264
+ {
265
+ "type": "text",
266
+ "text": "In addition to $\\mathcal { E } _ { e d i t }$ and $\\mathcal { E } _ { c o n t e n t }$ , an optional guidance term $\\mathcal { E } _ { o p t }$ may need to be added in some tasks to achieve the editing goal. Finally, the base energy function is defined as: ",
267
+ "page_idx": 4
268
+ },
269
+ {
270
+ "type": "equation",
271
+ "img_path": "images/f7681d3c37a3793b6949dea18117909aca11464c2240beb76b23d181a18ceee6.jpg",
272
+ "text": "$$\n\\mathcal { E } = w _ { e } \\cdot \\mathcal { E } _ { e d i t } + w _ { c } \\cdot \\mathcal { E } _ { c o n t e n t } + w _ { o } \\cdot \\mathcal { E } _ { o p t } ,\n$$",
273
+ "text_format": "latex",
274
+ "page_idx": 4
275
+ },
276
+ {
277
+ "type": "text",
278
+ "text": "where $w _ { e } , w _ { c }$ , and $w _ { o }$ are hyper-parameters to balance these guidance terms. They vary slightly in different editing tasks but are fixed within the same task. Finally, regarding $[ \\mathbf { m } ^ { g e n } , \\mathbf { \\bar { m } } ^ { s h a \\bar { r e } } ]$ as condition, the conditional score function in Eq. 2 can be written as: ",
279
+ "page_idx": 4
280
+ },
281
+ {
282
+ "type": "equation",
283
+ "img_path": "images/ed9276b70f0132c3b87a9759e78de55a3bef99ed304452025e45b63c865a04d5.jpg",
284
+ "text": "$$\n\\nabla _ { \\mathbf z _ { t } ^ { g e n } } \\log q ( \\mathbf z _ { t } ^ { g e n } | \\mathbf y ) \\propto \\nabla _ { \\mathbf z _ { t } ^ { g e n } } \\log q ( \\mathbf z _ { t } ^ { g e n } ) + \\nabla _ { \\mathbf z _ { t } ^ { g e n } } \\log q ( \\mathbf y | \\mathbf z _ { t } ^ { g e n } ) , ~ \\mathbf y = [ \\mathbf m ^ { g e n } , \\mathbf m ^ { s h a r e } ] .\n$$",
285
+ "text_format": "latex",
286
+ "page_idx": 4
287
+ },
288
+ {
289
+ "type": "text",
290
+ "text": "The conditional gradient $\\nabla _ { \\mathbf { z } _ { t } ^ { g e n } } \\log q ( \\mathbf { y } | \\mathbf { z } _ { t } ^ { g e n } )$ can be computed by $\\nabla _ { \\mathbf { z } _ { t } ^ { g e n } } \\mathcal { E }$ , which will also multiplies by a learning rate $\\eta$ . In experiments, we find that the gradient guidance in later diffusion generation steps hinders the generation of textures. Therefore, we only add gradient guidance in the first $n$ steps of diffusion generation. Experientially, we set $n = 3 0$ in 50 sampling steps. ",
291
+ "page_idx": 4
292
+ },
293
+ {
294
+ "type": "text",
295
+ "text": "3.4.2 MULTI-SCALE FEATURE CORRESPONDANCE ",
296
+ "text_level": 1,
297
+ "page_idx": 4
298
+ },
299
+ {
300
+ "type": "text",
301
+ "text": "The decoder of the UNet denoiser contains four blocks of different scales. DIFT Tang et al. (2023) finds that the second layer contains more semantic information, while the third layer contains more geometric information. We also studied the role of features from different layers in image editing tasks, as shown in Fig. 4. In the experiment, we set $\\mathbf { z } _ { T }$ as random Gaussian noise and set $\\mathbf { m } ^ { g e n }$ , $\\mathbf { m } ^ { g u d }$ as zeros matrixes. $\\mathbf { m } ^ { s h a r e }$ is set as a ones matrix. In this way, generation relies solely on content consistency guidance (i.e., Eq. 6) to restore image content. We can find that the guidance from the first layer is too high-level to reconstruct the original image accurately. The guidance from the fourth layer has weak feature correspondence, resulting in significant differences between the reconstructed and original images. The features from the second and third layers are more suitable to produce guidance signals, and each has its own specialty. Concretely, the features in the second layer contain more semantic information and can reconstruct images that are semantically similar to the original image but with some differences in content details. The features in the third layer tend to express low-level characteristics, but they cannot provide effective supervision for high-level texture, resulting in blurry results. In our design, we combine these two levels (i.e., high and low) of guidance by proposing a multi-scale supervision approach. Specifically, we compute gradient guidance on the second and third layers. The reconstructed results in Fig. 4 also demonstrate that this combination can balance the generation of low-level and high-level visual characteristics. ",
302
+ "page_idx": 4
303
+ },
304
+ {
305
+ "type": "image",
306
+ "img_path": "images/30eeeb7b19ff899196652942bafebf335ecc459546a44a4fed1741d7f15623f6.jpg",
307
+ "image_caption": [
308
+ "Figure 4: Illustration of using features from different layers as guidance to restore the original image. $\\mathbf { z } _ { T }$ is randomly initialized. The generation is solely guided by content consistency guidance in Eq. 6. "
309
+ ],
310
+ "image_footnote": [],
311
+ "page_idx": 5
312
+ },
313
+ {
314
+ "type": "text",
315
+ "text": "",
316
+ "page_idx": 5
317
+ },
318
+ {
319
+ "type": "text",
320
+ "text": "3.4.3 IMPLEMENTATION DETAILS FOR EACH APPLICATION ",
321
+ "text_level": 1,
322
+ "page_idx": 5
323
+ },
324
+ {
325
+ "type": "text",
326
+ "text": "Object moving. In the task of object moving, $\\mathbf { m } ^ { g e n }$ and $\\mathbf { m } ^ { g u d }$ locate the same object in different spatial positions. $\\mathbf { m } ^ { s h a r e }$ is the complement $\\left( \\mathbf { C } _ { \\mathbf { u } } \\right)$ of the union (∪) of $\\mathbf { m } ^ { g e n }$ and $\\mathbf { \\hat { m } } ^ { g u d }$ , i.e., $\\mathbf { m } ^ { s h a r e } = \\mathbf { C } _ { \\mathbf { u } } ( \\mathbf { m } ^ { g e n } \\cup \\mathbf { m } ^ { g u d } )$ . However, solely using the content editing and consistency guidance in Eq. 5 and Eq. 6 can lead to some issues, as shown in the second image of Fig. 5. Concretely, although the bread is moved according to the editing signal, some of the bread content is still preserved in its original position in the generated ",
327
+ "page_idx": 5
328
+ },
329
+ {
330
+ "type": "image",
331
+ "img_path": "images/8ae72772a59624588f4f30ff8fa7977936528ccabeb486e2777a9871c8eff2b4.jpg",
332
+ "image_caption": [
333
+ "Figure 5: Visualization of the effectiveness of inpainting guidance $( \\mathcal { E } _ { o p t } )$ in the object moving task, presenting that $\\mathcal { E } _ { o p t }$ can guide the inpainting of the area where the object is initially located. "
334
+ ],
335
+ "image_footnote": [],
336
+ "page_idx": 5
337
+ },
338
+ {
339
+ "type": "text",
340
+ "text": "result. This is because the energy function does not constrain the area where the moved object was initially located, causing inpainting to easily restore the original object. To rectify this issue, we use the optional energy term (i.e., $\\mathcal { E } _ { o p t }$ in Eq. 7) to constrain the inpainting content to be dissimilar to the moved object and similar to a predefined reference region. Here, we use $\\mathbf { m } ^ { r e f }$ to locate the reference region and define $\\mathbf { m } ^ { i p t } = \\hat { \\{ p | p \\in \\mathbf { m } ^ { g u d } } $ and $p \\not \\in \\mathbf { m } ^ { g e n } \\}$ to locate the inpainting region. Finally, $\\mathcal { E } _ { o p t }$ in this task is defined as: ",
341
+ "page_idx": 5
342
+ },
343
+ {
344
+ "type": "equation",
345
+ "img_path": "images/9c3ffd6ff91989bb68e24d8dcbc745513adb43c36c71c93f4f7a06142fe9c38a.jpg",
346
+ "text": "$$\n\\mathcal { E } _ { o p t } = \\frac { w _ { i } } { \\alpha + \\beta \\cdot S _ { g l o b a l } ( { \\bf F } _ { t } ^ { g e n } , { \\bf m } ^ { i p t } , { \\bf F } _ { t } ^ { g u d } , { \\bf m } ^ { r e f } ) } + S _ { l o c a l } ( { \\bf F } _ { t } ^ { g e n } , { \\bf m } ^ { i p t } , { \\bf F } _ { t } ^ { g u d } , { \\bf m } ^ { i p t } ) ,\n$$",
347
+ "text_format": "latex",
348
+ "page_idx": 5
349
+ },
350
+ {
351
+ "type": "text",
352
+ "text": "where $w _ { i }$ is a weight parameter, set as 2.5 in our implementation. The third image in Fig. 5 shows that this design can effectively achieve the editing goal without impeachable artifact. ",
353
+ "page_idx": 5
354
+ },
355
+ {
356
+ "type": "text",
357
+ "text": "Object resizing. The score function in this task is the same as the object moving, except that a scale factor $\\gamma > 0$ is added during feature extraction. Specifically, we use interpolation to transform $\\mathbf { m } ^ { g u d }$ and $\\mathbf { F } _ { t } ^ { g u d }$ to the target size, and then extract $\\mathbf { F } _ { t } ^ { g u d } [ \\mathbf { m } ^ { g u d } ]$ as the feature of the resized object. To locate the target object with the same size in $\\mathbf { F } _ { t } ^ { g e n }$ , we resize $\\mathbf { m } ^ { g e n }$ with the same scale factor $\\gamma$ Then we extract a new of the original size from the center of the resized . Note that if $\\gamma < 1$ , we use 0 to pad the vacant area. ",
358
+ "page_idx": 5
359
+ },
360
+ {
361
+ "type": "text",
362
+ "text": "Appearance replacing. This task aims to replace the appearance between objects of the same category across images. Therefore, the capacity of the memory bank needs to be doubled to store extra information from the image containing the reference appearance, i.e., ${ \\bf z } _ { t } ^ { r e f } , { \\bf K } _ { t } ^ { r e f }$ , and $\\mathbf { V } _ { t } ^ { r e f }$ . $\\mathbf { m } ^ { g e n }$ and $\\mathbf { m } ^ { g u d }$ respectively locate the editing object in the original image and the reference object in the reference image. $\\mathbf { m } ^ { s h a r e }$ is set as the complement of $\\mathbf { m } ^ { g e n }$ , i.e., ${ \\mathbf { C } } _ { \\mathbf { u } } ( \\mathbf { m } ^ { g e n } )$ . To constrain appearance, we choose $\\mathscr { S } _ { g l o b a l } ( \\mathbf { F } _ { t } ^ { g e n } , \\mathbf { m } ^ { g e n } , \\mathbf { F } _ { t } ^ { r e f } , \\mathbf { m } ^ { g u d } )$ in Eq. 5. This task has no need for $\\mathcal { E } _ { o p t }$ . ",
363
+ "page_idx": 5
364
+ },
365
+ {
366
+ "type": "text",
367
+ "text": "",
368
+ "page_idx": 6
369
+ },
370
+ {
371
+ "type": "text",
372
+ "text": "Object pasting. Object pasting aims to paste an object from an image onto any position in another image. Although it can be completed by simple copy-paste, it often results in inconsistencies between the paste area and other areas due to differences in light and perspective, as shown in Fig. 6. As can be seen, the result obtained by copy-paste exists discontinuities, while the result generated by our DragonDiffusion can achieve a more harmonized integration of the scene and the pasted object. In implementation, similar to the appearance replacing, the memory bank needs to store information of the reference image, which contains the target object. $\\mathbf { m } ^ { g e n }$ and $\\mathbf { m } ^ { g u d }$ respectively mark the position of the object in the edited image and reference image. $\\mathbf { m } ^ { s h a r e }$ is set as ${ \\mathbf { C } } _ { \\mathbf { u } } ( \\mathbf { m } ^ { g e n } )$ . ",
373
+ "page_idx": 6
374
+ },
375
+ {
376
+ "type": "text",
377
+ "text": "Point dragging. In this task, we want to drag image content via several points, as DragGAN Pan et al. (2023). In this case, $\\mathbf { m } ^ { g e n }$ and $\\mathbf { m } ^ { g u d }$ locate neighboring areas centered around the destination and starting points. Here, we extract a $3 \\times 3$ previous tasks, mshare is manually defined. ",
378
+ "page_idx": 6
379
+ },
380
+ {
381
+ "type": "image",
382
+ "img_path": "images/c87c2d9b00d473df5675be8bcc664932795499d0d3a3df8737451cf5799648ac.jpg",
383
+ "image_caption": [
384
+ "Figure 6: Visual comparison between our DragonDiffusion and direct copypaste in cross-image object pasting. "
385
+ ],
386
+ "image_footnote": [],
387
+ "page_idx": 6
388
+ },
389
+ {
390
+ "type": "text",
391
+ "text": "rectangular patch centered around each point as the neighboring area. Unlike the ",
392
+ "page_idx": 6
393
+ },
394
+ {
395
+ "type": "text",
396
+ "text": "3.5 VISUAL CROSS-ATTENTION ",
397
+ "text_level": 1,
398
+ "page_idx": 6
399
+ },
400
+ {
401
+ "type": "text",
402
+ "text": "As mentioned previously, two strategies are used to ensure the consistency between the editing result and the original image: (1) DDIM inversion to initialize $\\mathbf { z } _ { T }$ ; (2) content consistency guidance in Eq. 6. However, it is still challenging to maintain high consistency. Inspired by the consistency preserving in some video and image editing works Wu et al. (2022); Cao et al. (2023); Wang et al. (2023), we design a visual cross-attention guidance. Instead of generating guidance information through an independent inference branch, we reuse the intermediate features of the inversion process stored in the memory bank. Specifically, similar to the injection of text conditions in SD Rombach et al. (2022), we replace the key and value in the self-attention module of the UNet decoder with the corresponding key and value collected by the memory bank in DDIM inversion. Note that in the appearance replacing and object pasting tasks, the memory bank stores two sets of keys and values from the original image $( \\dot { \\mathbf { K } } _ { t } ^ { g u \\bar { d } } , \\mathbf { V } _ { t } ^ { g u \\bar { d } } )$ and the reference image $( \\mathbf { K } _ { t } ^ { r e f } , \\mathbf { V } _ { t } ^ { r e f } )$ . In this case, we concatenate the two sets of keys and values in the length dimension. The visual cross-attention at each time step is defined as follows. $\\textcircled{4}$ refers to the concatenation operation. ",
403
+ "page_idx": 6
404
+ },
405
+ {
406
+ "type": "equation",
407
+ "img_path": "images/8712db135215a643d3996304ece998e398dd94e992402528020e6735a2398350.jpg",
408
+ "text": "$$\n\\left\\{ \\begin{array} { l l } { \\mathbf { Q } _ { t } = \\mathbf { Q } _ { t } ^ { g e n } ; \\mathbf { K } _ { t } = \\mathbf { K } _ { t } ^ { g u d } \\operatorname { o r } \\big ( \\mathbf { K } _ { t } ^ { g u d } ( \\widehat { \\mathbf { c } } ) \\mathbf { K } _ { t } ^ { r e f } \\big ) ; \\mathbf { V } _ { t } = \\mathbf { V } _ { t } ^ { g u d } \\operatorname { o r } \\big ( \\mathbf { V } _ { t } ^ { g u d } ( \\widehat { \\mathbf { c } } ) \\mathbf { V } _ { t } ^ { r e f } \\big ) } \\\\ { \\operatorname { A t t } ( \\mathbf { Q } _ { t } , \\mathbf { K } _ { t } , \\mathbf { V } _ { t } ) = \\operatorname { s o f t m a x } \\big ( \\frac { \\mathbf { Q } _ { t } \\mathbf { K } _ { t } ^ { T } } { \\sqrt { d } } \\big ) \\mathbf { V } _ { t } . } \\end{array} \\right.\n$$",
409
+ "text_format": "latex",
410
+ "page_idx": 6
411
+ },
412
+ {
413
+ "type": "text",
414
+ "text": "4 EXPERIMENTS ",
415
+ "text_level": 1,
416
+ "page_idx": 6
417
+ },
418
+ {
419
+ "type": "text",
420
+ "text": "In experiments, we use StableDiffusion-V1.5 Rombach et al. (2022) as the base model. The inference adopts DDIM sampling with 50 steps, and we set the classifier-free guidance scale as 5. ",
421
+ "page_idx": 6
422
+ },
423
+ {
424
+ "type": "text",
425
+ "text": "4.1 COMPARISONS ",
426
+ "text_level": 1,
427
+ "page_idx": 6
428
+ },
429
+ {
430
+ "type": "text",
431
+ "text": "In this part, we compare our DragonDiffusion with other methods on various image editing tasks. ",
432
+ "page_idx": 6
433
+ },
434
+ {
435
+ "type": "text",
436
+ "text": "Content dragging. In this task, we compare our method with the recent UserControllableLT Endo (2022), DragGAN Pan et al. (2023), and DragDiffusion Shi et al. (2023). We first present the time complexity of different methods in Tab. 1. Specifically, We divide the time complexity of different methods into two parts, i.e., the preparing and inference stages. The preparing stage involves Diffusion/GAN inversion and model fine-tuning. The inference stage generates the editing result. The time complexity is tested on one point dragging, with the image resolution being $5 1 2 \\times 5 1 2$ . ",
437
+ "page_idx": 6
438
+ },
439
+ {
440
+ "type": "table",
441
+ "img_path": "images/872952903373e62ddac9bb2c79afa7404426d010096388b1675ee323be4392dc.jpg",
442
+ "table_caption": [
443
+ "Table 1: Quantitative evaluation on face manipulation with 68 and 17 points. The accuracy is calculated by Euclidean distance between edited points and target points. The initial distance (i.e., $5 7 . 1 9$ and $3 6 . 3 6 )$ is the upper bound, without editing. FID Seitzer (2020) is utilized to quantize the editing quality of different methods. The time complexity is computed on the ‘1 point’ dragging. "
444
+ ],
445
+ "table_footnote": [],
446
+ "table_body": "<table><tr><td></td><td>Preparing complexity↓</td><td>Inference complexity↓</td><td>Unaligned face</td><td>17 Points↓ From 57.19</td><td>68 Points↓ From 36.36</td><td>FID↓ 17/68 points</td></tr><tr><td rowspan=\"2\">UserControllableLT DragGAN</td><td>1.2s</td><td>0.05s</td><td>X</td><td>32.32</td><td>24.15</td><td>51.20/50.32</td></tr><tr><td>52.40s</td><td>6.71s</td><td>X</td><td>15.96</td><td>10.60</td><td>39.27/39.50</td></tr><tr><td>DragDiffusion</td><td>48.25s</td><td>19.71s</td><td>√</td><td>22.95</td><td>17.32</td><td>38.06/36.55</td></tr><tr><td>DragonDiffusion(ours)</td><td>3.62s</td><td>15.93s</td><td>√</td><td>18.51</td><td>13.94</td><td>35.75/34.58</td></tr></table>",
447
+ "page_idx": 7
448
+ },
449
+ {
450
+ "type": "image",
451
+ "img_path": "images/7961da10a2d166733facd99ea653a25d4d59b36357640ae4648c5b0fe24b36b5.jpg",
452
+ "image_caption": [
453
+ "Figure 7: Qualitative comparison between our DragonDiffusion and other methods in face manipulation (target points are blue), object pasting, appearance replacing, and object moving. "
454
+ ],
455
+ "image_footnote": [],
456
+ "page_idx": 7
457
+ },
458
+ {
459
+ "type": "text",
460
+ "text": "The experiment is conducted on an NVIDIA A100 GPU with Float32 precision. The results present that our method is relatively efficient in the preparing stage, requiring only 3.62s to prepare $\\mathbf { z } _ { T }$ and memory bank. The inference complexity is also acceptable for diffusion generation. ",
461
+ "page_idx": 7
462
+ },
463
+ {
464
+ "type": "text",
465
+ "text": "Following DragGAN Pan et al. (2023), the performance evaluation is conducted on the face keypoint manipulation with 17 and 68 points. The test set is randomly formed by 800 aligned faces from CelebA-HQ Karras et al. (2018) training set. Note that we do not set fixed regions for all methods, due to the difficulty in manually providing a mask for each face. In addition to accuracy, we also compute the FID Seitzer (2020) between face editing results and CelebA-HQ training set to represent the editing quality. The quantitative and qualitative comparison is presented in Tab. 1 and Fig. 7, respectively. One can see that our DragonDiffusion achieves promising results in editing accuracy and content consistency. Although DragGAN achieves better editing accuracy, it has limitations in content consistency and robustness in areas outside faces (e.g., the headwear is distorted). The limitations of GAN-based DragGAN and UserControllableLT also exist in requiring alignment before editing, as shown in Fig. 8. It can be seen that if editing without alignment, the results of DragGAN will suffer from severe degradation. The alignment operation is not friendly to our editing goal, as it will change the original image content, e.g., filtering out the background. In comparison, our method has promising editing accuracy, and the generation prior from SD enables better robustness and generalization for different content. In this task, our method also has better performance than DragDiffusion. More results are shown in the appendix. ",
466
+ "page_idx": 7
467
+ },
468
+ {
469
+ "type": "image",
470
+ "img_path": "images/7af73319cd05890836e8f0e6f45f20b093169a0625bb2267904709828387915d.jpg",
471
+ "image_caption": [
472
+ "Figure 9: Effectiveness of different components in our DragonDiffusion in the object moving task. "
473
+ ],
474
+ "image_footnote": [],
475
+ "page_idx": 8
476
+ },
477
+ {
478
+ "type": "text",
479
+ "text": "",
480
+ "page_idx": 8
481
+ },
482
+ {
483
+ "type": "text",
484
+ "text": "Other applications. For object pasting, we compare our method with Paint-by-example Yang et al. (2023). For appearance replacing and object moving, we compare our method with SelfGuidance Epstein et al. (2024). The visual comparison in Fig. 7 shows that our method can achieve comparable performance to the training method (i.e., Paint-by-example) in object pasting. ",
485
+ "page_idx": 8
486
+ },
487
+ {
488
+ "type": "text",
489
+ "text": "Compared to self-guidance, our method has better editing accuracy and content consistency. Due to the lack of consistency constraints, Self-Guidance produces some unexpected artifacts. Moreover, Self-Guidance has obvious deviation in complex scenes, due to the coarse correspondence between text and image features. More results are presented in Appendix. ",
490
+ "page_idx": 8
491
+ },
492
+ {
493
+ "type": "text",
494
+ "text": "4.2 ABLATION STUDY ",
495
+ "text_level": 1,
496
+ "page_idx": 8
497
+ },
498
+ {
499
+ "type": "image",
500
+ "img_path": "images/615a632312a30fe05bcb0478aa9f597790eda47ed0cb8c6ce508b7e03b6f29b7.jpg",
501
+ "image_caption": [
502
+ "Figure 8: Editing comparison between our DragonDiffusion and DragGAN Pan et al. (2023) on the unaligned body and face. "
503
+ ],
504
+ "image_footnote": [],
505
+ "page_idx": 8
506
+ },
507
+ {
508
+ "type": "text",
509
+ "text": "In this part, we demonstrate the effectiveness of some components in our DragonDiffusion, as shown in Fig. 9. We conduct the experiment on the object moving task. Specifically, (1) we verify the importance of the inversion prior by randomly initializing $\\mathbf { z } _ { T }$ instead of obtaining from DDIM inversion. As can be seen, the random $\\mathbf { z } _ { T }$ leads to a significant difference between the editing result and the original image. (2) We remove the content consistency guidance (i.e., $\\mathcal { E } _ { { c o n t e n t } } )$ in Eq. 7, which causes local distortion in the editing result, e.g., the finger is twisted. (3) We remove the visual cross-attention. It can be seen that visual cross-attention plays an important role in maintaining the consistency between the edited object and the original object. Using a memory bank to provide $\\mathbf { K } _ { t }$ and $\\mathbf { V } _ { t }$ can greatly reduce the additional cost. In Appendix, we show an ablation study for memory bank. Therefore, these components work together on both edited and unedited content, forming the fine-grained image editing model DragonDiffusion, which does not require extra training or modules. ",
510
+ "page_idx": 8
511
+ },
512
+ {
513
+ "type": "text",
514
+ "text": "",
515
+ "page_idx": 8
516
+ },
517
+ {
518
+ "type": "text",
519
+ "text": "5 CONCLUSION ",
520
+ "text_level": 1,
521
+ "page_idx": 8
522
+ },
523
+ {
524
+ "type": "text",
525
+ "text": "Despite the ability of existing large-scale text-to-image (T2I) diffusion models to generate highquality images from detailed textual descriptions, they often lack the ability to precisely edit the generated or real images. In this paper, we aim to develop a drag-style and general image editing scheme based on the strong correspondence of intermediate image features in the pre-trained diffusion model. To this end, we model image editing as the change of feature correspondence and design energy functions to transform the editing operations into gradient guidance. Based on the gradient guidance strategy, we also propose multi-scale guidance to consider both semantic and geometric alignment. Moreover, a visual cross-attention is added based on a memory bank design, which can enhance the consistency between the original image and the editing result. Due to the reuse of intermediate information from the inversion process, this content consistency strategy almost has no additional cost. Extensive experiments demonstrate that our proposed DragonDiffusion can perform various image editing tasks, including object moving, resizing, appearance replacing, object pasting, and content dragging. At the same time, the complexity of our DragonDiffusion is acceptable, and it does not require extra model fine-tuning or additional modules. ",
526
+ "page_idx": 8
527
+ },
528
+ {
529
+ "type": "text",
530
+ "text": "REFERENCES \nRameen Abdal, Yipeng Qin, and Peter Wonka. Image2stylegan: How to embed images into the stylegan latent space? In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 4432–4441, 2019. \nRameen Abdal, Yipeng Qin, and Peter Wonka. Image2stylegan $^ { + + }$ : How to edit the embedded images? In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 8296–8305, 2020. \nYuval Alaluf, Omer Tov, Ron Mokady, Rinon Gal, and Amit Bermano. Hyperstyle: Stylegan inversion with hypernetworks for real image editing. In Proceedings of the IEEE/CVF conference on computer Vision and pattern recognition, pp. 18511–18521, 2022. \nOmri Avrahami, Dani Lischinski, and Ohad Fried. Blended diffusion for text-driven editing of natural images. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 18208–18218, 2022. \nYogesh Balaji, Seungjun Nah, Xun Huang, Arash Vahdat, Jiaming Song, Karsten Kreis, Miika Aittala, Timo Aila, Samuli Laine, Bryan Catanzaro, et al. ediffi: Text-to-image diffusion models with an ensemble of expert denoisers. arXiv preprint arXiv:2211.01324, 2022. \nArpit 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, pp. 843–852, 2023. \nTim 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. \nMingdeng Cao, Xintao Wang, Zhongang Qi, Ying Shan, Xiaohu Qie, and Yinqiang Zheng. Masactrl: Tuning-free mutual self-attention control for consistent image synthesis and editing. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 22560–22570, 2023. \nPrafulla Dhariwal and Alexander Nichol. Diffusion models beat gans on image synthesis. Advances in neural information processing systems, 34:8780–8794, 2021. \nYuki Endo. User-controllable latent transformer for stylegan image layout editing. In Computer Graphics Forum, volume 41, pp. 395–406. Wiley Online Library, 2022. \nDave Epstein, Allan Jabri, Ben Poole, Alexei Efros, and Aleksander Holynski. Diffusion selfguidance for controllable image generation. Advances in Neural Information Processing Systems, 36, 2024. \nWeixi Feng, Xuehai He, Tsu-Jui Fu, Varun Jampani, Arjun Reddy Akula, Pradyumna Narayana, Sugato Basu, Xin Eric Wang, and William Yang Wang. Training-free structured diffusion guidance for compositional text-to-image synthesis. In Proceedings of the International Conference on Learning Representations, 2022. \nAmir Hertz, Ron Mokady, Jay Tenenbaum, Kfir Aberman, Yael Pritch, and Daniel Cohen-or. Prompt-to-prompt image editing with cross-attention control. In Proceedings of the International Conference on Learning Representations, 2022. \nJonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Advances in Neural Information Processing Systems, 33:6840–6851, 2020. \nTero Karras, Timo Aila, Samuli Laine, and Jaakko Lehtinen. Progressive growing of gans for improved quality, stability, and variation. In Proceedings of the International Conference on Learning Representations, 2018. \nTero Karras, Samuli Laine, and Timo Aila. A style-based generator architecture for generative adversarial networks. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 4401–4410, 2019. ",
531
+ "page_idx": 9
532
+ },
533
+ {
534
+ "type": "text",
535
+ "text": "Bahjat Kawar, Shiran Zada, Oran Lang, Omer Tov, Huiwen Chang, Tali Dekel, Inbar Mosseri, and Michal Irani. Imagic: Text-based real image editing with diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 6007–6017, 2023. ",
536
+ "page_idx": 10
537
+ },
538
+ {
539
+ "type": "text",
540
+ "text": "Gihyun Kwon and Jong Chul Ye. Diffusion-based image translation using disentangled style and content representation. In Proceedings of the International Conference on Learning Representations, 2022. \nChenlin 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 Proceedings of the International Conference on Learning Representations, 2021. \nChong Mou, Xintao Wang, Liangbin Xie, Jian Zhang, Zhongang Qi, Ying Shan, and Xiaohu Qie. T2i-adapter: Learning adapters to dig out more controllable ability for text-to-image diffusion models. arXiv preprint arXiv:2302.08453, 2023. \nAlexander 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, 2022. \nXingang Pan, Ayush Tewari, Thomas Leimkuhler, Lingjie Liu, Abhimitra Meka, and Christian ¨ Theobalt. Drag your gan: Interactive point-based manipulation on the generative image manifold. In ACM SIGGRAPH 2023 Conference Proceedings, pp. 1–11, 2023. \nAditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical textconditional image generation with clip latents. arXiv preprint arXiv:2204.06125, 2022. \nRobin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Bjorn 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. \nSimo Ryu. Low-rank adaptation for fast text-to-image diffusion fine-tuning, 2023. \nChitwan Saharia, 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. \nMaximilian Seitzer. pytorch-fid: FID Score for PyTorch. https://github.com/mseitzer/ pytorch-fid, August 2020. Version 0.3.0. \nYujun Shi, Chuhui Xue, Jiachun Pan, Wenqing Zhang, Vincent YF Tan, and Song Bai. Dragdiffusion: Harnessing diffusion models for interactive point-based image editing. arXiv preprint arXiv:2306.14435, 2023. \nJaskirat Singh, Stephen Gould, and Liang Zheng. High-fidelity guided image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 5997–6006, 2023. \nJascha 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. \nJiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. In Proceedings of the International Conference on Learning Representations, 2020a. \nYang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. Advances in neural information processing systems, 32, 2019. \nYang Song and Stefano Ermon. Improved techniques for training score-based generative models. Advances in neural information processing systems, 33:12438–12448, 2020. \nYang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. In Proceedings of the International Conference on Learning Representations, 2020b. \nLuming 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. \nDani Valevski, Matan Kalman, Eyal Molad, Eyal Segalis, Yossi Matias, and Yaniv Leviathan. Unitune: Text-driven image editing by fine tuning a diffusion model on a single image. ACM Transactions on Graphics (TOG), 42(4):1–10, 2023. \nAndrey Voynov, Kfir Aberman, and Daniel Cohen-Or. Sketch-guided text-to-image diffusion models. In ACM SIGGRAPH 2023 Conference Proceedings, pp. 1–11, 2023. \nWen Wang, Kangyang Xie, Zide Liu, Hao Chen, Yue Cao, Xinlong Wang, and Chunhua Shen. Zeroshot video editing using off-the-shelf image diffusion models. arXiv preprint arXiv:2303.17599, 2023. \nJay Zhangjie Wu, Yixiao Ge, Xintao Wang, Weixian Lei, Yuchao Gu, 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. arXiv preprint arXiv:2212.11565, 2022. \nBinxin Yang, Shuyang Gu, Bo Zhang, Ting Zhang, Xuejin Chen, Xiaoyan Sun, Dong Chen, and Fang Wen. Paint by example: Exemplar-based image editing with diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 18381– 18391, 2023. \nJiwen 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, pp. 23174–23184, 2023. \nLvmin 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, pp. 3836–3847, 2023. \nMin 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. ",
541
+ "page_idx": 10
542
+ },
543
+ {
544
+ "type": "text",
545
+ "text": "",
546
+ "page_idx": 11
547
+ }
548
+ ]
parse/test/OEL4FJMg1b/OEL4FJMg1b_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/OEL4FJMg1b/OEL4FJMg1b_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/SqW42eR2wC/SqW42eR2wC.md ADDED
@@ -0,0 +1,856 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Offline Inverse Constrained Reinforcement Learning for Safe-Critical Decision Making in Healthcare
2
+
3
+ Anonymous Author(s)
4
+ Affiliation
5
+ Address
6
+ email
7
+
8
+ # Abstract
9
+
10
+ 1 Reinforcement Learning (RL) applied in healthcare can lead to unsafe medical
11
+ 2 decisions and treatment, such as excessive dosages or abrupt changes, often due
12
+ 3 to agents overlooking common-sense constraints. Consequently, Constrained
13
+ 4 Reinforcement Learning (CRL) is a natural choice for safe decisions. However,
14
+ 5 specifying the exact cost function is inherently difficult in healthcare. Recent
15
+ 6 Inverse Constrained Reinforcement Learning (ICRL) is a promising approach that
16
+ 7 infers constraints from expert demonstrations. ICRL algorithms model Markovian
17
+ 8 decisions in an interactive environment. These settings do not align with the
18
+ 9 practical requirement of a decision-making system in healthcare, where decisions
19
+ 10 rely on historical treatment recorded in an offline dataset. To tackle these issues, we
20
+ 11 propose the Constraint Transformer (CT). Specifically, 1) utilize causal attention
21
+ 12 mechanism to incorporate historical decisions and observations into the constraint
22
+ 13 modeling and employ a non-Markovian layer for weighted constraints to capture
23
+ 14 critical states, 2) generative world model to perform exploratory data augmentation,
24
+ 15 thereby enabling offline RL methods to generate unsafe decision sequences. In
25
+ 16 multiple medical scenarios, empirical results demonstrate that CT can capture
26
+ 17 unsafe states and achieve strategies that approximate lower mortality rates, reducing
27
+ 18 the occurrence probability of unsafe behaviors.
28
+
29
+ # 19 1 Introduction
30
+
31
+ 20 In recent years, the doctor-to-patient ratio imbalance has drawn attention, with the U.S. having
32
+ 21 only 223.1 physicians per 100,000 people [1]. AI-assisted therapy emerges as a promising solution,
33
+ 22 offering timely diagnosis, personalized care, and reducing dependence on experienced physicians.
34
+ 23 Therefore, the development of an effective AI healthcare assistant is crucial.
35
+ 24 Reinforcement learning (RL) offers a promising approach
36
+ 25 to develop AI assistants by addressing sequential decision
37
+ 26 making tasks. However, this method can still lead to
38
+ 27 unsafe behaviors, such as administering excessive drug
39
+ 28 dosages, inappropriate adjustments of medical parameters,
40
+ 29 or abrupt changes in medication dosages. These behaviors,
41
+ 30 such as “too high” or “sudden change” can significantly
42
+ 31 endanger patients, potentially resulting in acute hypoten
43
+ 32 sion, hypertension, arrhythmias, and organ damage, with
44
+ 33 fatal consequences [4, 5, 6]. For example, in sepsis treat
45
+ 34 ment, patients receiving vasopressors (vaso) at dosages
46
+ 35 exceeding $1 \mu g / ( k g \cdot m i n )$ have a mortality rate of $9 0 \%$
47
+ 36 [7]. Moreover, the “sudden change” in vaso can rapidly
48
+ 37 affect blood vessels, causing acute fluctuations in blood
49
+
50
+ Table 1: The proportion of unsafe behaviors occurrences in vaso suggested by physician and DDPG. The typical range for vaso is $0 . 1 \sim 0 . 2 \mu g / ( k g \cdot m i n )$ , with doses exceeding 0.5 considered high [2]. A cutoff value of 0.75 is identified as a critical threshold associated with increased mortality [3].
51
+
52
+ <table><tr><td colspan="2">Drug dosage (μg/(kg ·min)) Physician</td><td>DDPG</td></tr><tr><td>vaso &gt;0.75</td><td>2.27%</td><td>7.44%个</td></tr><tr><td>vaso &gt;0.9</td><td>1.71%</td><td>7.40%</td></tr><tr><td>△vaso &gt;0.75</td><td></td><td>2.45%21.00%个</td></tr><tr><td>△vaso&gt;0.9</td><td></td><td>1.88%20.62%个</td></tr></table>
53
+
54
+ $\Delta$ vaso: The change in vaso between two-time points.
55
+
56
+ 38 pressure and posing life-threatening risks to patients [8]. Our experiments demonstrate that the work
57
+
58
+ 39 [9] applying the Deep Deterministic Policy Gradient (DDPG) algorithm in sepsis indeed exhibits “too high” and “sudden change” 140 unsafe behaviors in vaso recommendations, as shown in Table 1.
59
+
60
+ 41 This paper aims to achieve safe healthcare policy learning to mitigate unsafe behaviors. The most
61
+ 42 common method for learning safe policies is Constrained Reinforcement Learning (CRL) [10, 11],
62
+ 43 with the key to its success lying in the constraints representation. However, in healthcare, we can
63
+ 44 only design the cost function based on prior knowledge, which limits its application due to a lack of
64
+ 45 personalization, universality, and reliance on prior knowledge. For more details about issues, please
65
+ 46 refer to Appendix A. Therefore, Inverse Constrained Reinforcement Learning (ICRL) [12] emerges as
66
+ 47 a promising approach, as it can infer the constraints adhered to by experts from their demonstrations.
67
+ 48 However, directly applying ICRL in healthcare presents several challenges:
68
+ 49 1) The Markov decision is not compatible with medi
69
+ 50 cal decisions. ICRL algorithms model Markov decisions,
70
+ 51 where the next state depends only on the current state and
71
+ 52 not on the history [13, 14]. However, in healthcare, the
72
+ 53 historical states of patients are crucial for medical decision
73
+ 54 making [15], as demonstrated in the experiments shown
74
+ 55 in Figure 1. Therefore, ICRL algorithms based on Markov
75
+ 56 assumption can not capture patient history, and ignore in
76
+ 57 dividual patient differences, thereby limiting effectiveness.
77
+ 58 2) Interactive environment is not available for health
78
+ 59 care or medical decisions. ICRL algorithms [12, 16]
79
+ 60 follow an online learning paradigm, allowing agents to
80
+ 61 explore and learn from interactive environments. How
81
+ 62 ever, unrestricted exploration in healthcare often entails
82
+ 63 unsafe behaviors that could breach constraints and result
83
+
84
+ ![](images/52063f0c61f0041308737dcf7ddf2d51841610e276a4b750d44fb40cdace1036.jpg)
85
+ Figure 1: The distribution of vaso for patients with the same state. The physician makes different decisions due to referencing historical information, while the agent based on Markov decision-making can only make the same decision.
86
+
87
+ 64 in substantial losses. Therefore, it is necessary to infer constraints using only offline datasets.
88
+
89
+ 65 In this paper, we introduce offline Constraint Transformer (CT), a novel ICRL framework that
90
+ 66 incorporates patients’ historical information into constraint modeling and learns from offline data to
91
+ 67 infer constraints in healthcare. Specifically,
92
+ 68 1) Inspired by the recent success of transformers in sequence modeling [17, 18, 19], we incorporate
93
+ 69 historical decisions and observations into constraint modeling using a causal attention mechanism. To
94
+ 70 capture key events in trajectories, we introduce a non-Markovian transformer to generate constraints
95
+ 71 and importance weights, and then define constraints using weighted sums. CT takes trajectories as
96
+ 72 input, allowing for the observation of patients’ historical information and evaluation of key states.
97
+ 73 2) To learn from an offline dataset, we introduce a model-based offline RL method that simultaneously
98
+ 74 learns a policy model and a generative world model via auto-regressive imitation of the actions and
99
+ 75 observations in medical decisions. The policy model employs a stochastic policy with entropy
100
+ 76 regularization to prevent it from overfitting and improve its robustness. Utilizing expert datasets,
101
+ 77 the generative world model uses an auto-regressive exploration generation paradigm to effectively
102
+ 78 discover a set of violating trajectories. Then, CT can infer constraints in healthcare through these
103
+ 79 unsafe trajectories and expert trajectories.
104
+ 80 In the medical scenarios of sepsis and mechanical ventilation, we conduct experimental evaluations of
105
+ 1 offline CT. Experimental evaluations demonstrate that offline CT can capture patients’ unsafe states
106
+ 82 and assign higher penalties, thereby providing more interpretable constraints compared to previous
107
+ 83 works [9, 20, 21]. Compared to unconstrained and custom constraints, CT achieves strategies that
108
+ 84 closely approximate lower mortality rates with a higher probability (improving by $8 . 8 5 \%$ compared to
109
+ 85 DDPG). To investigate the avoidance of unsafe behaviors with offline CT, we evaluate the probabilities
110
+ 86 of “too high” and “sudden changes” occurring in the sepsis. The experimental results show that CRL
111
+ 87 with CT can reduce the probability of unsafe behaviors to zero.
112
+
113
+ # 2 Related Works
114
+
115
+ Reinforcement Learning in Healthcare. RL has made great progress in the realm of healthcare, such as sepsis treatment [9, 20, 21, 22], mechanical ventilation [23, 24, 25], sedation [26] and anesthesia [27, 28]. However, these works mentioned above have not addressed potential safety issues such as sudden changes or too high doses of medication. Therefore, the development of policies that are both safe and applicable across various healthcare domains is crucial.
116
+
117
+ 94 Inverse Constrained Reinforcement Learning. Previous works inferred constraint functions by
118
+ 95 determining the feasibility of actions under current states. In discrete state-action spaces, Chou et al.
119
+ 96 [29] and Park et al. [30] learned constraint sets to differentiate constrained state-action pairs. Scobee
120
+ 97 & Sastry [31] proposed inferring constraint sets based on the principle of maximum entropy, while
121
+ 98 some studies [32, 33] extended this approach to stochastic environments using maximum causal
122
+ 99 entropy [34]. In continuous domains, Malik et al. [12], Gaurav et al. [16], and Qiao et al. [35] used
123
+ 100 neural networks to approximate constraints. Some works [11, 29] applied Bayesian Monte Carlo and
124
+ 101 variational inference to infer the posterior distribution of constraints in high-dimensional state spaces.
125
+ 102 Xu et al. [36] modeled uncertainty perception constraints for arbitrary and epistemic uncertainties.
126
+ 103 However, these methods can only be applied online and lack historical dependency.
127
+ 104 Transformers for Reinforcement Learning. Transformer has produced exciting progress on RL
128
+ 105 sequential decision problems [17, 18, 37, 38]. These works no longer explicitly learn Q-functions
129
+ 106 or policy gradients, but focus on action sequence prediction models driven by target rewards. Chen
130
+ 107 et al. [18] and Janner et al. [37] perform auto-regressive modeling of trajectories to achieve policy
131
+ 108 learning in an offline environment. Furthermore, Zheng et al. [17] unify offline pretraining and
132
+ 109 online fine-tuning within the Transformer framework. Liu et al. [38] and Kim et al. [19] integrate the
133
+ 110 transformer architecture into constraint learning and preference learning. The transformer architecture,
134
+ 111 with its sequence modeling capability and independence from the Markov assumption, can capture
135
+ 112 temporal dependencies in medical decision-making. Thus, it is well-suited for trajectory learning and
136
+ 113 personalized learning in medical settings.
137
+
138
+ # 3 Problem Formulation
139
+
140
+ 115 We model the medical environment with a Constrained Markov Decision Process (CMDP) $\mathcal { M } ^ { c }$ [39],
141
+ 116 which can be defined by a tuple $( \mathcal { S } , \mathcal { A } , \mathcal { P } , \mathcal { R } , \mathcal { C } , \gamma , \kappa , \rho _ { 0 } )$ . Similar to studies [23, 40], we extract data
142
+ 117 within 72 hours of patient admission, with each 4-hour interval constituting a window or time step.
143
+ 118 The state indicators of the patient at each time step are denoted as $s \in S$ . The administered drug
144
+ 119 doses or instrument parameters of interest are considered as actions $a \in { \mathcal { A } }$ , while reward function
145
+ 120 $\mathcal { R }$ is used to describe the quality of the patient’s condition and provided by experts based on prior
146
+ 121 work [9, 23]. At each time step $t$ , an agent performs an action $a _ { t }$ at a patient’s state $s _ { t }$ . This process
147
+ 122 generates the reward $\boldsymbol { r } _ { t } \sim \mathcal { R } ( \boldsymbol { s } _ { t } , \boldsymbol { a } _ { t } )$ , the cost $c _ { t } \sim \mathcal { C }$ and the next state $s _ { t + 1 } \sim \mathcal { P } \left( \cdot \mid s _ { t } , a _ { t } \right)$ , where
148
+ 123 $\mathcal { P }$ defines the transition probabilities. $\gamma$ denotes the discount factor. $\kappa \in \mathbb { R } _ { + }$ denotes the bound of
149
+ 124 cumulative costs. $\rho _ { 0 }$ defines the initial state distribution. The goal of the CRL policy $\pi$ is to maximize
150
+ 125 the reward return while limiting the cost in a threshold $\kappa$ :
151
+
152
+ $$
153
+ \arg \operatorname* { m a x } _ { \pi } \mathbb { E } _ { \pi , \rho _ { 0 } } [ \sum _ { t = 1 } ^ { T } \gamma ^ { t } r _ { t } ] , \mathrm { s . t . } \mathbb { E } _ { \pi , \rho _ { 0 } } [ \sum _ { t = 1 } ^ { T } \gamma ^ { t } c _ { t } ] \leq \kappa .
154
+ $$
155
+
156
+ 126 where $T$ is the length of the trajectory $\tau$ . CRL commonly assumes that constraint signals are directly
157
+ 127 observable. However, in healthcare, such signals are not easily obtainable. Therefore, Our objective
158
+ 128 is to infer reasonable constraints for CRL to achieve safe policy learning in healthcare.
159
+ 129 Safe-Critical Decision Making with Constraint Inference in Healthcare. Our general goal is for
160
+ 130 our policy to approximate the optimal policy, which refers to the strategy under which the patient’s
161
+ 131 mortality rate is minimized (achieving a zero mortality rate is often difficult since there are patients
162
+ 132 who can not recover, regardless of all potential future treatment sequences [41]). Decision-making
163
+ 133 with constraints can formulate safer strategies by discovering and avoiding unsafe states, thereby
164
+ 134 approaching the optimal policy.
165
+ 135 However, most offline RL algorithms rely on online evaluation, where the agent is evaluated in
166
+ 136 an interactive environment, whereas in medical scenarios, only offline evaluation can be utilized.
167
+ 137 In previous works [5, 9, 40, 42], they qualitatively analyzed by comparing the differences (DIFF)
168
+ 138 between the drug dosage recommended by our policy $\pi$ and the dosage administered by clinical
169
+ 139 physicians $\hat { \pi }$ , and its relationship with mortality rates, through graphical analysis. In the graph
170
+ 140 depicting the relationship between the DIFF and mortality rate, at the point when DIFF is zero, the
171
+ 141 lower the mortality rate of patients, the better the performance of the policy [40]. To provide a more
172
+ 142 accurate quantitative evaluation, we introduce the concept of the probability of approaching the
173
+ 143 optimal policy, defined as $\omega$ :
174
+
175
+ $$
176
+ \omega = { \frac { \mathrm { N u m b e r ~ o f ~ s u r v i v o r s ~ a m o n g ~ t h e ~ t o p ~ } N \mathrm { ~ p a t i e n t s } } { N } }
177
+ $$
178
+
179
+ 144 We randomly collect $2 N$ patients (with an equal number of known survivors and non-survivors under
180
+ 145 doctor’s policy $\hat { \pi }$ ) from the offline dataset. We then calculate the DIFF and sort it in ascending order.
181
+ 146 The optimality of the policy can be evaluated through the following two points: 1) The higher the
182
+ 147 survival probability (i.e., $\omega$ ) of the top $N$ patients, the lower the mortality rate can be achieved by
183
+ 148 executing $\pi ; 2$ ) The smaller the DIFF among the surviving patients in the top $N$ , the greater the
184
+ 149 probability that $\pi$ is optimal.
185
+
186
+ # 4 Method
187
+
188
+ To infer constraints and achieve safe decision-making in healthcare, we introduce the Offline Constraint Transformer (Figure 2), a novel ICRL framework.
189
+
190
+ 153 Inverse Constrained Reinforcement Learning. ICRL aims to recover the cost function $\mathcal { C } ^ { * }$ by
191
+ 154 leveraging a set of trajectories $\mathcal { D } _ { e } = \{ \tau _ { e } ^ { ( i ) } \} _ { i } ^ { N }$ sampled from an expert policy $\pi _ { e }$ , where $N$ denotes
192
+ 155 the number of the trajectories. ICRL is commonly based on the Maximum Entropy framework [31],
193
+ 156 and the likelihood function is articulated as [12]:
194
+
195
+ $$
196
+ p ( \mathcal D _ { e } \mid \mathcal C ) = \frac { 1 } { \left( Z _ { \mathcal M } c \right) ^ { N } } \prod _ { i = 1 } ^ { N } \exp \Big [ R ( \tau ^ { ( i ) } ) \Big ] \mathbb { I } ^ { \mathcal { M } ^ { c } } ( \tau ^ { ( i ) } )
197
+ $$
198
+
199
+ 157 Here, $\begin{array} { r } { Z _ { \mathcal { M } } = \int \exp ( \beta r ( \tau ) ) \mathbb { I } ^ { \mathcal { M } } ( \tau ) d \tau } \end{array}$ is the normalizing term. The indicator $\mathbb { I } ^ { \mathcal { M } ^ { c } } ( \tau ^ { ( i ) } )$ signifies the
200
+ 158 extent to which the trajectory $\tau ^ { ( i ) }$ satisfies the constraints. It can be approximated using a neural
201
+ 159 network $\zeta _ { \theta } ( \tau ^ { \left( i \right) } )$ parameterized with $\theta$ , defined as $\begin{array} { r } { \zeta _ { \theta } ( \tau ^ { ( i ) } ) = \prod _ { t = 0 } ^ { T } \zeta _ { \theta } ( s _ { t } ^ { i } , a _ { t } ^ { i } ) } \end{array}$ . Consequently, the
202
+ 160 cost function can be formulated as $C _ { \theta } = 1 - \zeta _ { \theta }$ . Substituting the neural network for the indicator, we
203
+ 161 can update $\theta$ through the gradient of the log-likelihood function:
204
+
205
+ $$
206
+ \nabla _ { \theta } \mathcal { L } \left( \theta \right) = \mathbb { E } _ { \tau ^ { ( i ) } \sim \pi _ { e } } \left[ \nabla _ { \theta } \log [ \zeta _ { \theta } ( \tau ^ { ( i ) } ) ] \right] - \mathbb { E } _ { \hat { \tau } \sim \pi _ { \mathcal { M } } \hat { \zeta } _ { \theta } } \left[ \nabla _ { \theta } \log [ \zeta _ { \theta } ( \hat { \tau } ^ { ( i ) } ) ] \right]
207
+ $$
208
+
209
+ 162 where $\mathcal { M } ^ { \hat { \zeta } _ { \theta } }$ denotes the MDP obtained after augmenting $\mathcal { M }$ with the cost function $C _ { \theta }$ , using the
210
+ 163 executing policy $\pi _ { \mathcal { M } } \hat { \varsigma } _ { \theta }$ . And $\hat { \tau }$ are sampled from the policy. In practice, ICRL can be conceptualized
211
+ 164 as a bi-level optimization task [11]. We can 1) update this policy based on Equation 1, and 2) employ
212
+ 165 Equation 4 for constraint learning. Intuitively, the objective of Equation 4 is to distinguish between
213
+ 166 trajectories generated by expert policies and imitation policies that may violate the constraints.
214
+ 167 Specifically, task 1) involves updating the policy using advanced CRL methods. Significant progress
215
+ 168 has been made in some works such as BCQ-Lagrangian (BCQ-Lag), COpiDICE [43], VOCE [44],
216
+ 169 and CDT [38]. Meanwhile, task 2) focuses on learning the constraint function, as shown in Figure
217
+ 170 2. Our research primarily improves the latter process due to two main challenges facing ICRL
218
+ 171 in healthcare: Challenge 1) pertains to the limitations of the Markov property, and Challenge 2)
219
+ 172 involves the issue of inferring constraints only from offline datasets. To address these challenges, we
220
+ 173 propose the offline CT as our solution.
221
+ 174 Offline Constraint Transformer. To address the first challenge, we delve into the inherent issues of
222
+ 175 applying the Markov property to healthcare and draw inspiration from the successes of Transformer
223
+ 176 in decision-making, redefining the representation of the constraints. To realize the offline training, we
224
+ 177 consider the essence of ICRL updates, proposing a model-based RL to generate unsafe behaviors
225
+ 178 used to train CT. We outline three parts: establishing the constraint representation model (Section
226
+ 179 4.1), creating an offline RL for violating data (Section 4.2), and learning safe policies (Section 4.3).
227
+
228
+ ![](images/21024b4146c5ff548da0a10818382cefdd4ddbadd2f2619449408dea0777fc47.jpg)
229
+ Figure 2: The overview of the safe healthcare policy learning with offline CT.
230
+
231
+ # 4.1 Constraint Transformer
232
+
233
+ ICRL methods relying on the Markov property overlook patients’ historical information, focusing only on the current state. However, both current and historical states, along with vital sign changes are crucial for a human doctor’s decision-making process [15]. To emulate the observational approach of humans, we draw inspiration from the Decision Transformer (DT) [18] to incorporate historical information into constraints for a more comprehensive observation and judgment. We propose a constraint modeling approach based on a
234
+
235
+ ![](images/c77d31dd2c4d0d017ef47f6b13ef6e7a4e373a4fd7aa7d18952232d65c32a4e0.jpg)
236
+ Figure 3: The structure of the Constraint Transformer.
237
+
238
+ causal attention mechanism, as shown in Figure 3. The structure comprises a causal Transformer for sequential modeling and a non-Markovian layer for weighted constraints learning.
239
+
240
+ 196 Sequential Modeling for Constraints Inference. For a trajectory segment of length $T$ , $2 T$ input
241
+ 197 embeddings are generated, with each position containing state $s$ and action $a$ embeddings. Addi
242
+ 198 tionally, these embeddings undergo linear and normalization layers before being fed into the causal
243
+ 199 Transformer, which produces output embeddings $\{ d _ { t } \} _ { t = 1 } ^ { T }$ determined by preceding input embeddings
244
+ 200 from $( s _ { 1 } , a _ { 1 } , . . . , s _ { T } , a _ { T } )$ . Here, $d _ { t }$ depends only on the previous $t$ states and actions.
245
+ 201 Modeling Non-Markovian for Weighted Constraints Learning. Although $d _ { t }$ represents the cost
246
+ 202 function $c _ { t }$ derived from observations over long trajectories, it doesn’t pinpoint which previous key
247
+ 203 actions or states led to its increase. In healthcare, identifying key actions or states is vital for analyzing
248
+ 204 risky behaviors and status, and enhancing model interpretability. To address this, we draw inspiration
249
+ 205 from the design of the preference attention layer in [19] and introduce an additional attention layer.
250
+ 206 This layer is employed to define the cost weight for non-Markovians. It takes the output embeddings
251
+ 207 from the causality transformer as input and generates the corresponding cost and importance weights.
252
+ 208 The output of the attention layer is computed by weighting the values through the normalized dot
253
+ 209 product between the query and other keys:
254
+
255
+ $$
256
+ \sum _ { t = 1 } ^ { T } \mathrm { s o f t m a x } \left( \{ \langle q _ { t } , k _ { t ^ { \prime } } \rangle \} _ { t ^ { \prime } = 1 } ^ { T } \right) _ { t } \cdot c _ { t } = \sum _ { t = 1 } ^ { T } w _ { t } \cdot c _ { t }
257
+ $$
258
+
259
+ 210 Here, the key $\boldsymbol { k } _ { t } \in \mathbb { R } ^ { m }$ , query $q _ { t } \in \mathbb { R } ^ { m }$ , and value $c _ { t } \in \mathbb { R } ^ { m }$ are derived from the $t$ -th input $d _ { t }$
260
+ 211 through linear transformations, where $m$ denotes the embedding dimension. Furthermore, for each
261
+ 212 time step $t$ , since $d _ { t }$ depends only on the previous state-action pairs $\{ ( s _ { i } , a _ { i } ) \} _ { i = 1 } ^ { t }$ and serves as the
262
+ 213 input embedding for the attention layer, $c _ { t }$ is also associated solely with the preceding $t$ time steps.
263
+ 214 The representation of the cost function as a weighted sum is defined as $\begin{array} { r } { C \left( \tau \right) = \sum _ { t = 1 } ^ { T } w _ { t } \cdot c _ { t } } \end{array}$ . Then,
264
+ 215 we can also determine the constraint function values for each preceding subsequence. Introducing the
265
+ 216 newly defined cost function, we redefine Equation 4 for CT as:
266
+
267
+ $$
268
+ \nabla _ { \phi } \mathcal { L } \left( \phi \right) = \mathbb { E } _ { \hat { \tau } \sim \mathcal { D } _ { v } } \left[ \nabla _ { \phi } \log [ C _ { \phi } ( \hat { \tau } ) ] \right] - \mathbb { E } _ { \tau \sim \mathcal { D } _ { e } } \left[ \nabla _ { \phi } \log [ C _ { \phi } ( \tau ) ] \right]
269
+ $$
270
+
271
+ 217 where $\phi$ is the parameter of CT, $\mathcal { D } _ { e }$ and $\mathcal { D } _ { v }$ represent the expert data and the violating data. This
272
+ 218 formulation implies that the constraint should be minimized on the expert policy and maximized on
273
+ 219 the violating policy. We construct an expert and a violating dataset to evaluate Equation 6 in offline.
274
+ 220 The expert data can be acquired from existing medical datasets or hospitals. Regarding the violating
275
+ 221 dataset, we introduce a generative model to establish it, as detailed in Section 4.2.
276
+ 223 To train CT offline, we introduce a model
277
+ 224 based offline RL method (Figure 4) to gen
278
+ 225 erate violating data that refers to unsafe
279
+ 226 behavioral data and can be represented as
280
+ 227 $\tau _ { v } = ( s _ { 1 } , a _ { 1 } , r _ { 1 } , s _ { 2 } , \ldots ) \in \mathcal { D } _ { v }$ . The model
281
+ 228 simultaneously learns a policy model and a
282
+ 229 generative world model via auto-regressive imitation of the actions and observations in healthcare.
283
+ 230 The model processes a trajectory, $\tau _ { e } \in \mathcal { D } _ { e }$ , as a sequence of tokens encompassing the return-to-go,
284
+ 231 $t$ tates, and actions, defined as is the sum of future rewar $( \hat { R } _ { 1 } , s _ { 1 } , a _ { 1 } , . . . , \hat { R } _ { T } , s _ { T } , a _ { T } )$ $\begin{array} { r } { \hat { R } _ { t } \ = \ \sum _ { t ^ { \prime } = t } ^ { T } r _ { t ^ { \prime } } } \end{array}$ b. the return-to-go t each timestep $\hat { R } _ { t }$ $t$ at timestep it employs
285
+ 233 the tokens from the preceding $K$ timesteps as its input, where $K$ represents the context length.
286
+ 234 Thus, the input tokens for it at timestep $t$ are denoted as $h _ { t } = \{ \hat { R } _ { - K : t } , s _ { - K : t } , a _ { - K : t - 1 } \}$ , where
287
+ 235 $\hat { R } _ { - K : t } = \{ \hat { R } _ { K } , . . . , \hat { R } _ { t } \}$ , $\boldsymbol { s } _ { - K : t } = \{ \boldsymbol { s } _ { K } , . . . , \boldsymbol { s } _ { t } \}$ and $a _ { - K : t - 1 } = \{ a _ { K } , . . . , a _ { t - 1 } \}$ .
288
+
289
+ ![](images/20658a62101260d34ae581aac82e71b8e37a228209f934408d7e17eeb5c47168.jpg)
290
+ Figure 4: The structure of the model-based offline RL.
291
+
292
+ Policy Model. The input tokens are encoded through a linear layer for each modality. Subsequently, the encoded tokens pass through a casual transformer to predict future action tokens. We use a stochastic policy [38] to achieve policy learning. Additionally, we utilize a Shannon entropy regularizer $\mathcal { H } \left[ \pi _ { \vartheta } ( \cdot \vert h ) \right]$ to prevent policy overfitting and enhance robustness. The optimization objective is to minimize the negative log-likelihood loss while maximizing the entropy with weight $\lambda$ :
293
+
294
+ $$
295
+ \operatorname* { m i n } _ { \vartheta } \quad \mathbb { E } _ { h _ { t } \sim \mathcal { D } _ { e } } [ - \log \pi _ { \vartheta } ( \cdot \vert h _ { t } ) - \lambda \mathcal { H } \left[ \pi _ { \vartheta } ( \cdot \vert h _ { t } ) \right] ]
296
+ $$
297
+
298
+ where the policy $\pi _ { \vartheta } \left( \cdot \mid h _ { t } \right) = \mathcal { N } \left( \mu _ { \vartheta } \left( h _ { t } \right) , \Sigma _ { \vartheta } \left( h _ { t } \right) \right)$ adopts the stochastic Gaussian policy representation and $\vartheta$ is the parameter.
299
+
300
+ 244 Generative World Model. To predict states and rewards, we use $x _ { t } = \{ h _ { t } \cup a _ { t } \}$ as input encoded
301
+ 245 by linear layers. The encoded tokens pass through the casual transformer to predict hidden tokens.
302
+ 246 Then we utilize two linear layers to fit the rewards and states. The optimization objective for the two
303
+ 247 linear layers $\ell$ with the parameters $\varphi$ and $\mu$ can be defined as:
304
+
305
+ $$
306
+ \operatorname* { m i n } _ { \varphi , \mu } \quad \mathbb { E } _ { s _ { t } , r _ { t - 1 } \in x _ { t } \sim \mathcal { D } _ { e } } [ ( s _ { t } - \ell _ { \varphi } ( x _ { t } ) ) ^ { 2 } + ( r _ { t - 1 } - \ell _ { \mu } ( x _ { t } ) ) ^ { 2 } ]
307
+ $$
308
+
309
+ 48 Generating Violating Data. In RL, excessively high rewards, surpassing those provided by domain
310
+ 49 experts, may incentivize agents to violate the constraints in order to maximize the total reward [11].
311
+ 50 Therefore, we set a high initial target reward $\hat { R } _ { 1 }$ to obtain violation data. We feed $\hat { R } _ { 1 }$ and initial state
312
+ 51 $s _ { 1 } ^ { ( i ) }$ into the model-based offline RL to generate $\tau _ { v } ^ { \left( i \right) }$ in an auto-regressive manner, as depicted in
313
+ 52 model-based offline RL of Figure 2, where $\widetilde { a }$ , $\widetilde { r }$ and $\widetilde s$ are predicted by the model. The target reward
314
+ 53 $\hat { R }$ e edecreases incrementally and can be represented as $\hat { R } _ { t + 1 } = \hat { R } _ { t } - \widetilde { r } _ { t }$ . Considering the average error
315
+ 54 in trajectory prediction, we generate trajectories with the length $K = 1 0$ , as detailed in Appendix
316
+ 55 B.3. Repeating $N$ initial states, we can get violating data $\mathcal { D } _ { v } = \{ \tau _ { v } ^ { ( i ) } \} _ { i = 1 } ^ { N }$ .
317
+
318
+ Note that certain other generative models, such as Variational Auto-Encoder (VAE) [45], Generative Adversarial Networks (GAN) [46, 47], and Denoising Diffusion Probabilistic Models (DDPM) [48, 49], may be better at generating data. We introduce the model-based offline RL primarily because it has been shown to generate violating data with exploration [38] and possess the ability to process time-series features efficiently.
319
+
320
+ # 4.3 Safe-Critical Decision Making with Constraints.
321
+
322
+ To train offline CT, we gather the medical expert dataset $\mathcal { D } _ { e }$ from the environment. Then, we employ gradient descent to train the model-based offline RL, guided by Equation 7 and Equation 8, continuing until the model converges. Using this RL model, we automatically generate violating data denoted as $\mathcal { D } _ { v }$ . Subsequently, CT is optimized based on Equation 6 to get the cost function $C$ , leveraging samples from both $\mathcal { D } _ { e }$ and $\mathcal { D } _ { v }$ . To learn a safe policy, we train the policy $\pi$ using $C$ until it converges based on Equation 1. The detailed training procedure is presented in Algorithm 1.
323
+
324
+ # 5 Experiment
325
+
326
+ In this section, we first provide a brief overview of the task, as well as data extraction and preprocessing. Subsequently, in Section 5.1, we demonstrate that CT can describe constraints in healthcare and capture critical patient states. We emphasize its applicability to various CRL methods and its ability to approach the optimal policy for reducing mortality rates in Section 5.2. Finally, Section 5.3 discusses the realization of the objective of safe medical policies.
327
+
328
+ Input: Expert trajectories $\mathcal { D } _ { e }$ , context length $K$ , target reward $\hat { R } _ { 1 }$ , samples $N$ , episode length $T$
329
+ 1: Train model-based offline RL $\mathcal { M }$ : Update $\vartheta$ , $\varphi$ and $\mu$ using the Equation (7) and Equation (8)
330
+ 2: for $\mathrm { t } = 1 , . . . , \mathrm { T }$ do
331
+ 3: Sample initial states $S _ { 1 }$ from $\mathcal { D } _ { e }$
332
+ 4: Generate the violating dataset: $\mathcal { D } _ { v } \mathcal { M }$ .generate_data $( S _ { 1 } , \hat { R } _ { 1 } , K )$
333
+ 5: Sample set of trajectories $\{ \tau _ { e } ^ { ( i ) } \} _ { i = 1 } ^ { N }$ and $\{ \tau _ { v } ^ { ( i ) } \} _ { i = 1 } ^ { N }$ from $\mathcal { D } _ { e }$ and $\mathcal { D } _ { v }$
334
+ 6: Train offline CT: Use $\{ \tau _ { e } ^ { ( i ) } \} _ { i = 1 } ^ { N }$ and $\{ \tau _ { v } ^ { ( i ) } \} _ { i = 1 } ^ { N }$ to update $\phi$ based on Equation (6)
335
+ 7: Safe policy learning: Update $\pi$ using the cost function $C _ { \phi } ( \tau )$ based on Equation (1)
336
+ 8: end for
337
+
338
+ Output: $\pi$ and $C ( \tau )$
339
+
340
+ Tasks. We primarily use the sepsis task that is commonly used in previous works [9, 20, 42, 22], and supplement some experiments on the mechanical ventilator task [23, 50]. The detailed definition of the two tasks mentioned above can be found in Appendix B.1 and B.2.
341
+
342
+ Data Extraction and Pre-processing. Our medical dataset is derived from the Medical Information Mart for Intensive Care III (MIMIC-III) database [51]. For each patient, we gather relevant physiological parameters, including demographics, lab values, vital signs, and intake/output events. Data is grouped into 4-hour windows, with each window representing a time step. In cases of multiple data points within a step, we record either the average or the sum. We eliminate variables with significant missing values and use the $k$ -nearest neighbors method to fill in the rest. Notably, the training dataset consists of data from surviving patients, while the validation set includes survivors and non-survivors.
343
+
344
+ Model-based Offline RL Evaluation. To ensure the rigor of the experiments, we evaluate the validity of the model-based offline RL, as detailed in Appendix B.3.
345
+
346
+ # 5.1 Can Offline CT Learn Effective Constraints?
347
+
348
+ In this section, we primarily assess the efficacy of the cost function learned by offline CT in sepsis, focusing particularly on its capability to evaluate patient mortality rates and capture critical events. First, we employ the cost function to compute cost values for the validation dataset. Subsequently, we statistically analyze the relationship between these cost values and mortality rates. As shown in Figure 5, there is an increase in patient mortality rates with rising cost values. It’s noteworthy that such increases in mortality rates are often attributed to suboptimal medical decisions. Therefore, these experimental findings affirm that the cost values effectively reflect the quality of medical decision-making. To observe the impact of the attention layer (non-Markovian layer), we conduct experiments by removing the attention layer from CT. The results reveal that the penalty values do not correlate proportionally with mortality rates. This indicates that the attention layer plays a crucial role in assessing constraints.
349
+
350
+ ![](images/8215a4b7f13ad806f8772e90f3077e474b04c140b2eb70ee418826c46c293bfd.jpg)
351
+ Figure 5: The relationship between cost and mortality.
352
+
353
+ ![](images/370058f2a16e2c2fa7f43362dc4d40f54af17bfbe159fd2aeff53d06733d2819.jpg)
354
+ Figure 6: The relationship between physiological indicators and cost values. As SOFA and lactate levels become increasingly unsafe, the cost increases. Mean BP and HR at lower values within the safe range incur a lower cost, but as they move into unsafe ranges, the cost increases, penalizing previous state-action pairs. The cost can differentiate between relatively safe and unsafe regions.
355
+
356
+ 301 To assess the capability of the cost function to capture key events, we analyze the relationship
357
+ 302 between physiological indicators and cost values. We focus on four key indicators in sepsis treatment:
358
+ 303 Sequential Organ Failure Assessment (SOFA) score [52], lactate levels [53], Mean Arterial Pressure
359
+ 304 (MeanBP) [54], and Heart Rate (HR) [55]. The SOFA score and lactate levels are critical indicators
360
+ 305 for assessing sepsis severity, with higher values indicating greater patient risk. MeanBP and HR
361
+ 306 are essential physiological metrics, typically ranging from 70 to $\boldsymbol { 1 0 0 } \ \mathrm { m m H g }$ and 60 to 100 beats,
362
+ 307 respectively. Deviations from these ranges can signify patient risk. As depicted in Figure 6, the cost
363
+ 308 values effectively distinguish between high-risk and safe conditions, reflecting changes in patient
364
+ 309 status. Additional details on other parameters’ relationship with cost are in Appendix B.4.
365
+
366
+ # 5.2 Can Offline CT Improve the Performance of CRL?
367
+
368
+ Baselines. We adopt the DDPG method as the baseline in sepsis research [9], and the Double Deep Q-Learning (DDQN) and Conservative Q-Learning (CQL) methods as baselines in ventilator research [23]. Since there are no other offline inverse reinforcement learning works available for reference, we have included two additional settings: no cost and custom cost. In the case of no cost, the cost is set to zero, while the design of custom constraints is outlined in Appendix A. These settings help evaluate whether CT can infer effective constraints.
369
+
370
+ Metrics. To assess effectiveness, we use $\omega$ to indicate the probability that the policy is optimal and analyze the relationship between DIFF and mortality rate through a graph. Recently, Kondrup et al. [23] use the Fitted Q Evaluation (FQE) [56] to evaluate the policy in healthcare. However, the value estimates of FQE depend solely on the dataset $\mathcal { D }$ and the actions chosen by the policy $\pi$ used to train FQE. This reliance can lead to inaccurate estimates when evaluating unseen state-action pairs. Therefore, we do not adopt this method as an evaluation metric.
371
+
372
+ Results. We combine our method CT with common CRL algorithms (e.g., VOCE, COpiDICE, BCQ-Lag, and CDT), and compare them with both no-cost and custom cost settings. Each CRL model is trained using no cost, custom cost, and CT separately, with other parameters set the same during training. For evaluation metrics, we use IV difference (IV DIFF), vaso difference (VASO DIFF), and combined [IV, VASO] difference (ACTION DIFF) as the metrics to be ranked. We measure the mean and variance of $\omega \%$ in 10 sets of random seeds, and the results are shown in Table 2. From the results, we can conclude: (1) In different CRL methods, CT consistently makes the strategy closer to the one with lower mortality rates, with a probability $8 . 8 5 \%$ higher than DDPG. (2) We find that $\mathrm { C D T + C T }$ achieves better results on all three metrics. CDT is also a transformer-based method, which indicates that transformer-based architecture indeed exhibits more outstanding performance in healthcare.
373
+
374
+ Figure 7 illustrates the relationship between IV and VASO DIFF with mortality rates under the DDPG and $\mathrm { C D T + C T }$ methods in sepsis. In VASO DIFF, when the gap is zero, the mortality rate under $\mathrm { C D T + C T }$ is lower than that under DDPG, indicating that following the former strategy could lead to a lower mortality rate. Similarly, in IV DIFF, the same trend is observed. Notably, for the IV strategy, the lowest mortality rate for DDPG does not occur at the point where the difference is zero, indicating a significant estimation bias.
375
+
376
+ Table 2: Performance of sepsis strategies under various offline CRL models and different constraints.
377
+
378
+ <table><tr><td>w%</td><td>COST</td><td></td><td></td><td>IV DIFF↑ VASO DIFF↑ACTION DIFF↑</td></tr><tr><td>DDPG</td><td>=</td><td>50.95±1.34</td><td>51.45±0.75</td><td>51.15±1.15</td></tr><tr><td rowspan="3">VOCE</td><td>No cost</td><td>47.45±0.52</td><td>46.35±1.82</td><td>51.00±0.86</td></tr><tr><td>Custom cost</td><td>46.45±0.46</td><td>52.00±0.98</td><td>49.40±1.04</td></tr><tr><td>CT</td><td></td><td>53.33±0.94 59.04±1.13</td><td>56.15±1.08</td></tr><tr><td rowspan="3">CopiDICE</td><td>No cost</td><td>48.30±0.91</td><td>60.10±0.6</td><td>51.25±0.70</td></tr><tr><td>Custom cost</td><td>53.05±1.35</td><td>55.20±0.24</td><td>53.90±1.04</td></tr><tr><td>CT</td><td>51.95±0.41</td><td>60.85±1.08</td><td>54.60±0.60</td></tr><tr><td rowspan="3">BCQ-Lag</td><td>No cost</td><td>47.50±1.32</td><td>51.05±0.61</td><td>49.35±1.08</td></tr><tr><td>Custom cost</td><td></td><td>51.54±0.16 56.23±1.43</td><td>53.69±1.62</td></tr><tr><td>CT</td><td>52.45±1.01</td><td>55.34±1.20</td><td>54.39±0.86</td></tr><tr><td rowspan="3">CDT</td><td>No cost</td><td>56.50±0.81</td><td>62.45±1.20</td><td>58.90±1.34</td></tr><tr><td>Custom cost</td><td>54.70±1.12</td><td>59.85±1.51</td><td>57.80±1.00</td></tr><tr><td>CT</td><td>57.15±1.67</td><td>65.20±1.22</td><td>60.00±1.49</td></tr><tr><td>CDT</td><td>Without CT</td><td>56.50±0.81</td><td>62.45±1.20</td><td>58.90±1.34</td></tr><tr><td>CDT</td><td></td><td>No attention layer 55.25±1.46 64.00±1.54</td><td></td><td>57.90±0.78</td></tr><tr><td>Gemerative</td><td></td><td></td><td>55.49±2.55 56.60±1.33</td><td>57.00±2.06</td></tr></table>
379
+
380
+ ![](images/fe1f85b83df8c73a0636323119e406a3f253c26e31740c7903d122f5c07debba.jpg)
381
+ Blue: Safe policy is closer to the optimal policy. ↑: higher is better.
382
+ Figure 7: The relationship between DIFF and the mortality rate in sepsis. The $\mathbf { X }$ -axis represents the DIFF. The y-axis indicates the mortality rate of patients at a given DIFF. The solid line represents the mean, while the shaded area indicates the Standard Error of the Mean (SEM).
383
+
384
+ In addition, corresponding experiments are conducted on the mechanical ventilator, as shown in Figure 8. Compared to previous methods DDQN and CQL, under the $\mathrm { C D T + C T }$ approach, a noticeable trend is observed where the proportion of mortality rates increases with increasing differences. When
385
+
386
+ 360 there is a significant difference in DIFF, the results may be unreliable, possibly due to the limited data distribution in the tail.
387
+
388
+ ![](images/313f4f6da1da8993991184ea6955103eb596df07656f585b230b94c865af0f40.jpg)
389
+ Figure 8: The relationship between the DIFF of actions and mortality in mechanical ventilator. The actions mainly consist of Positive End Expiratory Pressure (PEEP) and Fraction of Inspired Oxygen (FiO2), which are crucial parameters in ventilator settings.
390
+
391
+ # 5.3 Can CRL with Offline CT Learn Safe Policies?
392
+
393
+ We have confirmed the existence of two unsafe strategy issues, namely “too high” and “sudden change” in the treatment of sepsis, particularly in vaso in Section 1. To validate whether the $\mathrm { C R L + C T }$ approach could address these concerns, we employ the same statistical methods to
394
+
395
+ Table 3: The proportion of “too high” and “sudden change” occurrences in drug dosage recommended by RL methods.
396
+
397
+ <table><tr><td>Drug dosage (μg/(𝑘g: min) Physician DDPG No cost</td><td></td><td></td><td colspan="3">CDT</td></tr><tr><td></td><td></td><td></td><td></td><td>Custom cost</td><td>CT</td></tr><tr><td>vaso &gt; 0.75</td><td>2.27%</td><td></td><td>7.44%0.13%</td><td>0%</td><td>0%</td></tr><tr><td>vaso &gt;0.9</td><td>1.71%</td><td></td><td>7.40%0.09%</td><td>(max = 0.00)</td><td>(max = 0.11)</td></tr><tr><td>△vaso&gt;0.75</td><td></td><td></td><td>2.45%21.00%0.64%</td><td>0%</td><td>0%</td></tr><tr><td>△vaso &gt;0.9</td><td></td><td></td><td></td><td></td><td>1.88% 20.62% 0.48% (max△=0.00) (max△=0.10)</td></tr></table>
398
+
399
+ evaluate our methodology, shown in Table 3. To elucidate the efficacy of CT, we compare it with CDT+No-cost and CDT $^ +$ Custom-cost approaches. We find that only the custom cost and CT methods successfully mitigated the risks associated with “too high” and “sudden change” behaviors. However, the custom cost approach opts to avoid administering drugs to mitigate these risks. Without these drugs, the patient’s condition may not be alleviated, potentially leading to patient mortality. The $\mathrm { C D T + C T }$ approach can give a more appropriate drug dosage.
400
+
401
+ Ablation Study. To investigate the impact of each component on the model’s performance, we conducted experiments by sequentially removing each component from the $\mathrm { C D T + C T }$ model. The results are presented in the lower half of Table 2. Both CT and its non-Markovian layer (attention layer) are indispensable and crucial components; removing either one results in a decrease in performance. Additionally, we observed that even a pure generative model outperforms DDPG in terms of performance. This is primarily because it inherently operates as a sequence-based reinforcement learning model, possessing exploration and consideration for long-term history. Therefore, this further underscores the effectiveness of sequence-based approaches in healthcare applications.
402
+
403
+ # 6 Conclusion
404
+
405
+ In this paper, we propose offline CT, a novel ICRL algorithm designed to address safety issues in healthcare. This method utilizes a causal attention mechanism to observe patients’ historical information, similar to the approach taken by actual doctors and employs non-Markovian importance weights to effectively capture critical states. To achieve offline learning, we introduce a model-based offline RL for exploratory data augmentation to discover unsafe decisions and train CT. Experiments in sepsis and mechanical ventilation demonstrate that our method avoids risky behaviors while achieving strategies that closely approximate the lowest mortality rates.
406
+
407
+ Limitations. There are also several limitations of offline CT: (1) Lack of rigorous theoretical analysis: We did not precisely define the types of constraint sets, thereby conducting rigorous theoretical analysis on constraint sets remains challenging; (2) Need for more computational resources: Due to the Transformer architecture, more computational resources are required; (3) Fewer evaluation metrics: There is a lack of more medical-specific evaluation metrics in the experimental evaluation section; (4) Unrealistic assumptions of expert demonstrations: we assume that expert demonstrations are optimal in both constraint satisfaction and reward maximization. However, in reality, this assumption may not always hold. Therefore, researching a more effective approach to address the aforementioned issues holds promise for the field of secure medical reinforcement learning.
408
+
409
+ References
410
+ [1] Stephen Petterson, Robert McNellis, Kathleen Klink, David Meyers, and Andrew Bazemore. The state of primary care in the united states: A chartbook of facts and statistics. Washington, DC: Robert Graham Center, 2018.
411
+ [2] Estevão Bassi, Marcelo Park, Luciano Cesar Pontes Azevedo, et al. Therapeutic strategies for high-dose vasopressor-dependent shock. Critical care research and practice, 2013, 2013.
412
+ [3] Thomas Auchet, Marie-Alix Regnier, Nicolas Girerd, and Bruno Levy. Outcome of patients with septic shock and high-dose vasopressor therapy. Annals of Intensive Care, 7:1–9, 2017.
413
+ [4] Davide Tommaso Andreis and Mervyn Singer. Catecholamines for inflammatory shock: a jekyll-and-hyde conundrum. Intensive care medicine, 42:1387–1397, 2016.
414
+ [5] Yan Jia, John Burden, Tom Lawton, and Ibrahim Habli. Safe reinforcement learning for sepsis treatment. In 2020 IEEE International conference on healthcare informatics (ICHI), pages 1–7. IEEE, 2020.
415
+ [6] Rui Shi, Olfa Hamzaoui, Nello De Vita, Xavier Monnet, and Jean-Louis Teboul. Vasopressors in septic shock: which, when, and how much? Annals of Translational Medicine, 8(12), 2020.
416
+ [7] Claude Martin, Sophie Medam, Francois Antonini, Julie Alingrin, Malik Haddam, Emmanuelle Hammad, Bertrand Meyssignac, Coralie Vigne, Laurent Zieleskiewicz, and Marc Leone. Norepinephrine: not too much, too long. Shock, 44(4):305–309, 2015.
417
+ [8] Kristin Lavigne Fadale, Denise Tucker, Jennifer Dungan, and Valerie Sabol. Improving nurses’ vasopressor titration skills and self-efficacy via simulation-based learning. Clinical Simulation in Nursing, 10(6):e291–e299, 2014.
418
+ [9] Yong Huang, Rui Cao, and Amir Rahmani. Reinforcement learning for sepsis treatment: A continuous action space solution. In Machine Learning for Healthcare Conference, pages 631–647. PMLR, 2022.
419
+ [10] Yongshuai Liu, Avishai Halev, and Xin Liu. Policy learning with constraints in model-free reinforcement learning: A survey. In The 30th International Joint Conference on Artificial Intelligence (IJCAI), 2021.
420
+ [11] Guiliang Liu, Yudong Luo, Ashish Gaurav, Kasra Rezaee, and Pascal Poupart. Benchmarking constraint inference in inverse reinforcement learning. arXiv preprint arXiv:2206.09670, 2022.
421
+ [12] Shehryar Malik, Usman Anwar, Alireza Aghasi, and Ali Ahmed. Inverse constrained reinforcement learning. In International conference on machine learning, pages 7390–7399. PMLR, 2021.
422
+ [13] Masaaki Kijima. Markov processes for stochastic modeling. Springer, 2013.
423
+ [14] Zhiyue Zhang, Hongyuan Mei, and Yanxun Xu. Continuous-time decision transformer for healthcare applications. In International Conference on Artificial Intelligence and Statistics, pages 6245–6262. PMLR, 2023.
424
+ [15] Catherine Plaisant, Brett Milash, Anne Rose, Seth Widoff, and Ben Shneiderman. Lifelines: visualizing personal histories. In Proceedings of the SIGCHI conference on Human factors in computing systems, pages 221–227, 1996.
425
+ [16] Ashish Gaurav, Kasra Rezaee, Guiliang Liu, and Pascal Poupart. Learning soft constraints from constrained expert demonstrations. arXiv preprint arXiv:2206.01311, 2022.
426
+ [17] Qinqing Zheng, Amy Zhang, and Aditya Grover. Online decision transformer. In international conference on machine learning, pages 27042–27059. PMLR, 2022.
427
+ [18] Lili Chen, Kevin Lu, Aravind Rajeswaran, Kimin Lee, Aditya Grover, Misha Laskin, Pieter Abbeel, Aravind Srinivas, and Igor Mordatch. Decision transformer: Reinforcement learning via sequence modeling. Advances in neural information processing systems, 34:15084–15097, 2021.
428
+
429
+ [19] Changyeon Kim, Jongjin Park, Jinwoo Shin, Honglak Lee, Pieter Abbeel, and Kimin Lee. Preference transformer: Modeling human preferences using transformers for rl. arXiv preprint arXiv:2303.00957, 2023. [20] Aniruddh Raghu, Matthieu Komorowski, Imran Ahmed, Leo Celi, Peter Szolovits, and Marzyeh Ghassemi. Deep reinforcement learning for sepsis treatment. arXiv preprint arXiv:1711.09602, 2017. [21] Xuefeng Peng, Yi Ding, David Wihl, Omer Gottesman, Matthieu Komorowski, H Lehman Liwei, Andrew Ross, Aldo Faisal, and Finale Doshi-Velez. Improving sepsis treatment strategies by combining deep and kernel-based reinforcement learning. In AMIA Annual Symposium Proceedings, volume 2018, page 887. American Medical Informatics Association, 2018. [22] Thanh Cong Do, Hyung Jeong Yang, Seok Bong Yoo, and In-Jae Oh. Combining reinforcement learning with supervised learning for sepsis treatment. In The 9th International Conference on Smart Media and Applications, pages 219–223, 2020. [23] Flemming Kondrup, Thomas Jiralerspong, Elaine Lau, Nathan de Lara, Jacob Shkrob, My Duc Tran, Doina Precup, and Sumana Basu. Towards safe mechanical ventilation treatment using deep offline reinforcement learning. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 37, pages 15696–15702, 2023. [24] Wei Gong, Linxiao Cao, Yifei Zhu, Fang Zuo, Xin He, and Haoquan Zhou. Federated inverse reinforcement learning for smart icus with differential privacy. IEEE Internet of Things Journal, 2023. [25] Chao Yu, Guoqi Ren, and Yinzhao Dong. Supervised-actor-critic reinforcement learning for intelligent mechanical ventilation and sedative dosing in intensive care units. BMC medical informatics and decision making, 20:1–8, 2020. [26] Niloufar Eghbali, Tuka Alhanai, and Mohammad M Ghassemi. Patient-specific sedation management via deep reinforcement learning. Frontiers in Digital Health, 3:608893, 2021. [27] Giulia Calvi, Eleonora Manzoni, and Mirco Rampazzo. Reinforcement q-learning for closedloop hypnosis depth control in anesthesia. In 2022 30th Mediterranean Conference on Control and Automation (MED), pages 164–169. IEEE, 2022. [28] Gabriel Schamberg, Marcus Badgeley, Benyamin Meschede-Krasa, Ohyoon Kwon, and Emery N Brown. Continuous action deep reinforcement learning for propofol dosing during general anesthesia. Artificial Intelligence in Medicine, 123:102227, 2022. [29] Glen Chou, Dmitry Berenson, and Necmiye Ozay. Learning constraints from demonstrations. In Algorithmic Foundations of Robotics XIII: Proceedings of the 13th Workshop on the Algorithmic Foundations of Robotics 13, pages 228–245. Springer, 2020. [30] Daehyung Park, Michael Noseworthy, Rohan Paul, Subhro Roy, and Nicholas Roy. Inferring task goals and constraints using bayesian nonparametric inverse reinforcement learning. In Conference on robot learning, pages 1005–1014. PMLR, 2020. [31] Dexter RR Scobee and S Shankar Sastry. Maximum likelihood constraint inference for inverse reinforcement learning. arXiv preprint arXiv:1909.05477, 2019. [32] David L McPherson, Kaylene C Stocking, and S Shankar Sastry. Maximum likelihood constraint inference from stochastic demonstrations. In 2021 IEEE Conference on Control Technology and Applications (CCTA), pages 1208–1213. IEEE, 2021. 492 [33] Mattijs Baert, Pietro Mazzaglia, Sam Leroux, and Pieter Simoens. Maximum causal entropy inverse constrained reinforcement learning. arXiv preprint arXiv:2305.02857, 2023. [34] Brian D Ziebart, J Andrew Bagnell, and Anind K Dey. Modeling interaction via the principle of maximum causal entropy. 2010. [35] Guanren Qiao, Guiliang Liu, Pascal Poupart, and Zhiqiang Xu. Multi-modal inverse constrained reinforcement learning from a mixture of demonstrations. Advances in Neural Information Processing Systems, 36, 2024.
430
+
431
+ [36] Sheng Xu and Guiliang Liu. Uncertainty-aware constraint inference in inverse constrained reinforcement learning. In The Twelfth International Conference on Learning Representations, 2023.
432
+ 502 [37] Michael Janner, Qiyang Li, and Sergey Levine. Offline reinforcement learning as one big sequence modeling problem. Advances in neural information processing systems, 34:1273– 1286, 2021. [38] Zuxin Liu, Zijian Guo, Yihang Yao, Zhepeng Cen, Wenhao Yu, Tingnan Zhang, and Ding Zhao. Constrained decision transformer for offline safe reinforcement learning. arXiv preprint arXiv:2302.07351, 2023. [39] Eitan Altman. Constrained markov decision processes with total cost criteria: Lagrangian approach and dual linear program. Mathematical methods of operations research, 48:387–417, 1998. [40] Aniruddh Raghu, Matthieu Komorowski, Leo Anthony Celi, Peter Szolovits, and Marzyeh Ghassemi. Continuous state-space models for optimal sepsis treatment: a deep reinforcement learning approach. In Machine Learning for Healthcare Conference, pages 147–163. PMLR, 2017.
433
+ 515 [41] Mehdi Fatemi, Taylor W Killian, Jayakumar Subramanian, and Marzyeh Ghassemi. Medical dead-ends and learning to identify high-risk states and treatments. Advances in Neural Information Processing Systems, 34:4856–4870, 2021.
434
+ 518 [42] Matthieu Komorowski, Leo A Celi, Omar Badawi, Anthony C Gordon, and A Aldo Faisal. The artificial intelligence clinician learns optimal treatment strategies for sepsis in intensive care. Nature medicine, 24(11):1716–1720, 2018. [43] Jongmin Lee, Cosmin Paduraru, Daniel J Mankowitz, Nicolas Heess, Doina Precup, Kee-Eung Kim, and Arthur Guez. Coptidice: Offline constrained reinforcement learning via stationary distribution correction estimation. arXiv preprint arXiv:2204.08957, 2022.
435
+ 524 [44] Jiayi Guan, Guang Chen, Jiaming Ji, Long Yang, Zhijun Li, et al. Voce: Variational optimization with conservative estimation for offline safe reinforcement learning. Advances in Neural Information Processing Systems, 36, 2024.
436
+ 527 [45] Yongju Kim, Hyung Keun Park, Jaimyun Jung, Peyman Asghari-Rad, Seungchul Lee, Jin You Kim, Hwan Gyo Jung, and Hyoung Seop Kim. Exploration of optimal microstructure and mechanical properties in continuous microstructure space using a variational autoencoder. Materials & Design, 202:109544, 2021. [46] Tim Hsu, William K Epting, Hokon Kim, Harry W Abernathy, Gregory A Hackett, Anthony D Rollett, Paul A Salvador, and Elizabeth A Holm. Microstructure generation via generative adversarial network for heterogeneous, topologically complex 3d materials. Jom, 73:90–102, 2021. [47] Akshay Iyer, Biswadip Dey, Arindam Dasgupta, Wei Chen, and Amit Chakraborty. A conditional generative model for predicting material microstructures from processing methods. arXiv preprint arXiv:1910.02133, 2019. [48] 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. [49] Christian Düreth, Paul Seibert, Dennis Rücker, Stephanie Handford, Markus Kästner, and Maik Gude. Conditional diffusion-based microstructure reconstruction. Materials Today Communications, 35:105608, 2023. [50] Arne Peine, Ahmed Hallawa, Johannes Bickenbach, Guido Dartmann, Lejla Begic Fazlic, Anke Schmeink, Gerd Ascheid, Christoph Thiemermann, Andreas Schuppert, Ryan Kindle, et al. Development and validation of a reinforcement learning algorithm to dynamically optimize mechanical ventilation in critical care. NPJ digital medicine, 4(1):32, 2021.
437
+
438
+ 548 [51] Alistair EW Johnson, Tom J Pollard, Lu Shen, Li-wei H Lehman, Mengling Feng, Mohammad
439
+ 549 Ghassemi, Benjamin Moody, Peter Szolovits, Leo Anthony Celi, and Roger G Mark. Mimic-iii,
440
+ 550 a freely accessible critical care database. Scientific data, 3(1):1–9, 2016.
441
+ 551 [52] Yonglin Li, Chunjiang Yan, Ziyan Gan, Xiaotu Xi, Zhanpeng Tan, Jun Li, and Guowei Li.
442
+ 552 Prognostic values of sofa score, qsofa score, and lods score for patients with sepsis. Annals of
443
+ 553 palliative medicine, 9(3):1037044–1031044, 2020.
444
+ 554 [53] Seung Mok Ryoo, JungBok Lee, Yoon-Seon Lee, Jae Ho Lee, Kyoung Soo Lim, Jin Won
445
+ 555 Huh, Sang-Bum Hong, Chae-Man Lim, Younsuck Koh, and Won Young Kim. Lactate level
446
+ 556 versus lactate clearance for predicting mortality in patients with septic shock defined by sepsis-3.
447
+ 557 Critical care medicine, 46(6):e489–e495, 2018.
448
+ 558 [54] Nishant Raj Pandey, Yu-yao Bian, and Song-tao Shou. Significance of blood pressure variability
449
+ 559 in patients with sepsis. World journal of emergency medicine, 5(1):42, 2014.
450
+ 560 [55] Marta Carrara, Bernardo Bollen Pinto, Giuseppe Baselli, Karim Bendjelid, and Manuela Ferrario.
451
+ 561 Baroreflex sensitivity and blood pressure variability can help in understanding the different
452
+ 562 response to therapy during acute phase of septic shock. Shock, 50(1):78–86, 2018.
453
+ 563 [56] Hoang Le, Cameron Voloshin, and Yisong Yue. Batch policy learning under constraints. In
454
+ 564 International Conference on Machine Learning, pages 3703–3712. PMLR, 2019.
455
+ 565 [57] Mervyn Singer, Clifford S Deutschman, Christopher Warren Seymour, Manu Shankar-Hari,
456
+ 566 Djillali Annane, Michael Bauer, Rinaldo Bellomo, Gordon R Bernard, Jean-Daniel Chiche,
457
+ 567 Craig M Coopersmith, et al. The third international consensus definitions for sepsis and septic
458
+ 568 shock (sepsis-3). Jama, 315(8):801–810, 2016.
459
+ 569 [58] Flavio Lopes Ferreira, Daliana Peres Bota, Annette Bross, Christian Mélot, and Jean-Louis
460
+ 570 Vincent. Serial evaluation of the sofa score to predict outcome in critically ill patients. Jama,
461
+ 571 286(14):1754–1758, 2001.
462
+ 573 We base our design on prior knowledge that intravenous (IV) intake exceeding $2 0 0 0 m L / 4 h$ or
463
+ 574 vasopressor (Vaso) dosage surpassing $1 g / ( k g \cdot m i n )$ is generally considered unsafe in sepsis treatment
464
+ 575 [6]. To design a reasonable constraint function, we refer to the constraint function designed by Liu et
465
+ 576 al. in the Bullet safety gym environments[38]. We define the cost function as shown in Equation 9.
466
+ 577 Thus, during the treatment of sepsis, if the agent exceeds the maximum dosage thresholds of the two
467
+ 578 medications, it incurs a cost due to constraint violation.
468
+
469
+ $$
470
+ c \left( s , a \right) = \mathbf { 1 } \left( a _ { I V } > a _ { I V \operatorname* { m a x } } \right) + \mathbf { 1 } \left( a _ { V a s o } > a _ { V a s o \operatorname* { m a x } } \right)
471
+ $$
472
+
473
+ 579 where, $s$ and $a$ represent the patient’s state and action, respectively. $a _ { I V \mathrm { \ m a x } } = 2 0 0 0$ indicates that
474
+ 580 the maximum fluid intake through IV is $2 0 0 0 m L$ , and $a _ { V a s o \ m a x } = 1$ signifies that the maximum
475
+ 581 Vaso dosage is $1 \mu g / ( k g \cdot m i n )$ .
476
+ 582 We applied our custom constraint function in the CDT [38] method, and the results are shown in
477
+ 583 Figure 9. Compared to the Vaso dosage recommended by doctors, our strategy exhibits excessive
478
+ 584 suppression of the Vaso. The maximum dosage of Vaso is $0 . 0 0 1 1 \mu g / ( k g \cdot m i n )$ , which is minimal
479
+ 585 and insufficient to provide the patient with effective therapeutic effects.
480
+ 586 Therefore, Equation 9 is not suitable. The primary issues may include uniform constraint strength
481
+ 587 for excessive drug dosages, for instance, the cost for IV exceeding $\mathrm { 2 0 0 0 ~ m L }$ and IV exceeding
482
+ 588 $\mathrm { 3 0 0 0 ~ m L }$ is the same at 1; lack of generalization, where the constraint cost does not vary with the
483
+ 589 ou patient’s tolerance. If a patient has an intolerance to VASO, the maximum value for VASO maybe 0,d—Policy 2
484
+ 590 which cannot be captured by the self-imposed constraint function. Moreover, it lacks generalization,
485
+ 591 requiring redesign of the constraint function when addressing other unsafe medical issues; and it’s
486
+ essential to ensure the correctness of the underlying medical knowledge premises.constraint function to express general unsafe behaviors.
487
+
488
+ ![](images/d6eebb96d1036c31c4fb2f9d25125c4abbe4f49cc38b8dc2e0b8b56787a83378.jpg)
489
+ Figure 9: Drug dosage distribution under custom constraint functions in sepsis.
490
+
491
+ # 93 B Experiment Supplement
492
+
493
+ # B.1 Sepsis Problem Define
494
+
495
+ Our definition is similar to [40]. We extract data from adult patients meeting the criteria for sepsis-3 criteria [57] and collect their data within the first 72 hours of admission.
496
+
497
+ State Space. We use a 4-hour window and select 48 patient indicators as the state for a one-time unit of the patient. The state indicators include Demographics/Static, Lab Values, Vital Signs, and Intake and Output Events, detailed as follows [40]:
498
+
499
+ • Demographics/Static: Shock Index, Elixhauser, SIRS, Gender, Re-admission, GCS - Glasgow Coma Scale, SOFA - Sequential Organ Failure Assessment, Age
500
+
501
+ • Lab Values Albumin: Arterial pH, Calcium, Glucose, Hemoglobin, Magnesium, PTT - Partial Thromboplastin Time, Potassium, SGPT - Serum Glutamic-Pyruvic Transaminase, Arterial Blood Gas, BUN Blood Urea Nitrogen, Chloride, Bicarbonate, INR - International Normalized Ratio, Sodium, Arterial Lactate, CO2, Creatinine, Ionised Calcium, PT - Prothrombin Time, Platelets Count, SGOT Serum Glutamic-Oxaloacetic Transaminase, Total bilirubin, White Blood Cell Count
502
+ • Vital Signs: Diastolic Blood Pressure, Systolic Blood Pressure, Mean Blood Pressure, PaCO2, PaO2, FiO2, PaO/FiO2 ratio, Respiratory Rate, Temperature (Celsius), Weight $( \bf k g )$ , Heart Rate, SpO2
503
+ • Intake and Output Events: Fluid Output - 4 hourly period, Total Fluid Output, Mechanical Ventilation
504
+
505
+ 613 Action Space. Regarding the treatment of sepsis, there are two main types of medications: in
506
+ 614 travenous fluids and vasopressors. We select the total amount of intravenous fluids for each time
507
+ 615 unit and the maximum dose of vasopressors as the two dimensions of the action space, defined as
508
+ 616 (sum(IV), max (Vaso)). Each dimension is a continuous value greater than 0.
509
+
510
+ 617 Reward Function. We refer to the reward function used in [9], as shown in the following equation:
511
+
512
+ $$
513
+ r ( s _ { t } , s _ { t + 1 } ) = \lambda _ { 1 } \operatorname { t a n h } ( s _ { t } ^ { \mathrm { S O F A } } - 6 ) + \lambda _ { 2 } ( s _ { t + 1 } ^ { \mathrm { S O F A } } - s _ { t } ^ { \mathrm { S O F A } } ) )
514
+ $$
515
+
516
+ 618 Where $\lambda _ { 0 }$ and $\lambda _ { 1 }$ are hyperparameters set to $- 0 . 2 5$ and $- 0 . 2$ , respectively. This reward function is
517
+ 619 designed based on the SOFA score, as it is a key indicator of the health status for sepsis patients and
518
+ 620 widely used in clinical settings. The formula describes a penalty when the SOFA score increases and
519
+ 621 a reward when the SOFA score decreases. We set 6 as the cutoff value because the mortality rate
520
+ 622 sharply increases when the SOFA score exceeds 6 [58].
521
+
522
+ # B.2 Mechanical Ventilation Treatment Problem Define
523
+
524
+ The RL problem definition for Mechanical Ventilation Treatment is referenced from [23].
525
+
526
+ # State Space.
527
+
528
+ • Demographics/Static: Elixhauser, SIRS, Gender, Re-admission, GCS, SOFA, Age
529
+ • Lab Values Albumin: Arterial pH, Glucose, Hemoglobin, Magnesium, PTT, BUN Blood Urea Nitrogen, Chloride, Bicarbonate, INR, Sodium, Arterial Lactate, CO2, Creatinine, Ionised Calcium, PT, Platelets Count, White Blood Cell Count, Hb
530
+ • Vital Signs: Diastolic Blood Pressure, Systolic Blood Pressure, Mean Blood Pressure, Temperature, Weight (kg), Heart Rate, SpO2
531
+ • Intake and Output Events: Urine output, vasopressors, intravenous fluids, cumulative fluid balance
532
+
533
+ 634 Action Space. The action space mainly consists of Positive End Expiratory Pressure (PEEP) and 635 Fraction of Inspired Oxygen (FiO2), which are crucial parameters in ventilator settings. Here, we 636 consider a discrete space configuration, with each parameter divided into 7 intervals. Therefore, our action space is $7 \times 7$ , depicted as 4.
534
+
535
+ Table 4: The action space of the mechanical ventilator.
536
+
537
+ <table><tr><td>Action</td><td>0</td><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td></tr><tr><td>PEEP(cmH20)</td><td>0-5</td><td>5-7</td><td>7-9</td><td>9-11</td><td>11-13</td><td>13-15</td><td>&gt;15</td></tr><tr><td>FiO2(Percentage(%))</td><td>25-30</td><td>30-35</td><td>35-40</td><td>40-45</td><td>45-50</td><td>50-55</td><td>&gt;55</td></tr></table>
538
+
539
+ 638 Reward Function. The primary objective of setting respiratory parameters is to ensure the patient’s
540
+ 639 survival. We adopt the same reward function design as the work [23], defined as Equation 11. This
541
+ 640 reward function first considers the terminal reward: if the patient dies, the reward $r$ is set to $- 1$ ;
542
+ 641 otherwise, it is $+ 1$ in the terminal state. Additionally, to provide more frequent rewards, intermediate
543
+ 642 rewards are considered. Intermediate rewards mainly focus on the Apache II score, which evaluates
544
+ 643 various parameters to describe the patient’s health status. This reward function utilizes the increase or
545
+ 644 decrease in this score to reward the agent.
546
+
547
+ $$
548
+ r \left( s _ { t } , a _ { t } , s _ { t + 1 } \right) = { \left\{ \begin{array} { l l } { + 1 } & { { \mathrm { ~ i f ~ } } t = T { \mathrm { ~ a n d ~ } } m _ { t } = 1 } \\ { - 1 } & { { \mathrm { ~ i f ~ } } t = T { \mathrm { ~ a n d ~ } } m _ { t } = 0 } \\ { { \frac { \left( A _ { t + 1 } - A _ { t } \right) } { \operatorname* { m a x } _ { A } - \operatorname* { m i n } _ { A } } } } & { { \mathrm { ~ o t h e r w i s e } } } \end{array} \right. }
549
+ $$
550
+
551
+ 645 In Equation 11, $T$ represents the length of the patient’s trajectory, $m$ indicates whether the patient
552
+ 646 ultimately dies, $A$ denotes the Apache $\mathrm { I I }$ score, and $\operatorname* { m a x } _ { A }$ and $\operatorname* { m i n } _ { A }$ respectively denote the maximum
553
+ 647 and minimum values.
554
+
555
+ # B.3 The Evaluation of Model-based Offline RL
556
+
557
+ Generating data within a reasonable range. To validate model-based offline RL, we first check whether the values it produces fall within the legal range. The results are depicted in Figure 10. After analyzing the generated data, we find that the majority of state values have a probability of over $9 9 \%$ of being within the legal range. A few values related to gender and re-admission range between $6 0 \%$ and $7 0 \%$ . This could be due to these two indicators having limited correlation with other metrics, making them more challenging for the model to assess.
558
+
559
+ ![](images/476ea5fd7cb0d7390f2cdd942b86bfc655bafe8a01363a97506fbf68a4d4b40d.jpg)
560
+ Figure 10: The accuracy of predicting different state values within the legal range.
561
+
562
+ ![](images/0f00cdb39f6bc249be6b4a01ceca9e2dc756edba7add108a8f29681e16d31ead.jpg)
563
+ Figure 11: The relationship between average prediction error and trajectory length.
564
+
565
+ Generating violating data. In addition, we evaluate the violating actions generated by the model, as shown in Figure 12. When compared with expert strategies and penalty distributions, we find that the actions generated by the model mostly fall within the legal range. However, it occasionally produces behaviors that are inappropriate for the current state, constituting violating data. This indicates that our generative model can produce legally violating data.
566
+
567
+ ![](images/e09f91eb1a4c0cec3c463cc35e56fa5c42f24f86ee4c1c3d2e392a6f5cc0de11.jpg)
568
+ Figure 12: The distribution and penalty values of violating data and expert data.
569
+
570
+ 660 The length of a trajectory. Regarding the selection of trajectory length, we consider the relationship
571
+ 661 between the average prediction error, the error of the last point in the trajectory, and the trajectory
572
+ 662 length. We use the model-based offline RL to generate trajectories and compare them with expert
573
+ 663 data using the Euclidean distance to measure their differences. We evaluate the average error and
574
+ 664 the error of the last point in the trajectory, as shown in Figure 11. We observe that with an increase
575
+ 665 in trajectory length, the average prediction error at each time step decreases, while the state error
576
+ 666 stabilizes. Taking into account the observation length and prediction accuracy, we ultimately choose
577
+ 667 to generate trajectories with lengths ranging from 10 to 15.
578
+
579
+ # 668 B.4 The Evaluation of Cost function in Sepsis
580
+
581
+ To validate that the CT method captures key states, we conduct statistical analysis on the relationship between state values and penalty values. We collect penalty values under different state values for all patients, and the complete information is shown in Figure 13. We find that the CT method successfully captures unsafe states and imposes higher penalties accordingly. The safe range of state values is shown in Table 5.
582
+
583
+ To validate the role of the attention layer in capturing states in CT, we conducted tests, and the experimental results are presented in Figure 14 and 13. We found that the attention layer plays a crucial role in state capture. For instance, in the case of an increase in the SOFA score, without the attention layer, this increase cannot be captured, while with the attention layer, it clearly captures the change. Thus, this indicates that SOFA, as a key diagnostic indicator of sepsis, with the help of the attention layer, CT can accurately capture its changes.
584
+
585
+ Table 5: State indicators and their normal ranges.
586
+
587
+ <table><tr><td>Indicator</td><td>Safe Range</td><td>Indicator</td><td>Safe Range</td><td>Indicator</td><td>Safe Range</td></tr><tr><td>Albumin</td><td>3.5~5.1</td><td>HCO3</td><td>25~40</td><td>SGOT</td><td>0~40</td></tr><tr><td>Arterial_BE</td><td>-3~+3</td><td>Glucose</td><td>70~140</td><td>SGPT</td><td>0~40</td></tr><tr><td>Arterial_lactate</td><td>0.5~1.7</td><td>HR</td><td>60~100</td><td>SIRS</td><td>√</td></tr><tr><td>Arterial_PH</td><td>7.35~7.45</td><td>Hb</td><td>12~16</td><td>SOFA</td><td>√</td></tr><tr><td>BUN</td><td>7~22</td><td>INR</td><td>0.8~1.5</td><td>Shock_Index</td><td>√</td></tr><tr><td>CO2_mEqL</td><td>20~34</td><td>MeanBP</td><td>70~100</td><td>Sodium</td><td>135~145</td></tr><tr><td>Calcium</td><td>8.6~10.6</td><td>PT</td><td>11~13</td><td>SpO2</td><td>95~99</td></tr><tr><td>Chloride</td><td>96~106</td><td>PTT</td><td>23~37</td><td>SysBP</td><td>90~139</td></tr><tr><td>Creatinine</td><td>0.5~1.5</td><td>PaO2_FiO2</td><td>400~500</td><td>Temp_C</td><td>36.0~37.0</td></tr><tr><td>DiaBP</td><td>60~89</td><td>Platelets_count</td><td>125~350</td><td>WBC_count</td><td>4~10</td></tr><tr><td>FiO2</td><td>0.5~0.6</td><td>Potassium</td><td>4.1~5.6</td><td>PaCO2</td><td>35~45</td></tr><tr><td>GCS</td><td>个</td><td>RR</td><td>12~20</td><td>PaO2</td><td>80~100</td></tr></table>
588
+
589
+ $\uparrow$ indicates higher values are more normal, while $\downarrow$ indicates lower values are more normal. The maximum value for GCS is 15. The minimum value for SIRS, SOFA, and Shock_Index is 0.
590
+
591
+ # B.5 Experimental Settings
592
+
593
+ To train the $\mathrm { C R L + C T }$ model, we use a total of 3 NVIDIA GeForce RTX 3090 GPUs, each with 24GB of memory. Training a $\mathrm { C R L + C T }$ model typically takes 5-6 hours. We employ 5 random seeds for validation. We use the Adam optimization algorithm to optimize all our networks, updating the learning rate using a decay factor parameterization at each iteration. The main hyperparameters are summarized in Table 6 and 7.
594
+
595
+ ![](images/c2c46130bda19c41aa6b4f291388f0f0cbc7d0d5d6d1faf4e22f4fbba5b3b8d8.jpg)
596
+ Figure 13: The relationship between all states and cost values
597
+
598
+ ![](images/b4835dead727216765fa6463e65a3b66c19274f1608101eeb10b0ae58d849944.jpg)
599
+ Figure 14: The performance contrast between CT with and without an attention layer. The blue line represents the absence of an attention layer, while the green line indicates the presence of an attention layer.
600
+
601
+ Table 6: List of the utilized hyperparameters in CT.
602
+
603
+ <table><tr><td>Offline CTParameters</td><td>values</td></tr><tr><td>Genetivate Model</td><td></td></tr><tr><td>Embedding_dim</td><td>128</td></tr><tr><td>Layer</td><td>3</td></tr><tr><td>Head</td><td>8</td></tr><tr><td>Learning rate</td><td>1e-4</td></tr><tr><td>Pre-train steps</td><td>5000</td></tr><tr><td>Batch size</td><td>256</td></tr><tr><td>CT</td><td></td></tr><tr><td>Embedding_dim</td><td>64</td></tr><tr><td>Layer</td><td>3</td></tr><tr><td>Head</td><td>1</td></tr><tr><td>Learning rate</td><td>1e-6</td></tr><tr><td>Update steps</td><td>30000</td></tr><tr><td>Batch size</td><td>512</td></tr><tr><td>CDT</td><td></td></tr><tr><td>Learning rate</td><td>1e-4</td></tr><tr><td>Embedding_dim</td><td>128</td></tr><tr><td>Layers</td><td>3</td></tr><tr><td>Heads</td><td>8</td></tr><tr><td>Update steps</td><td>60000</td></tr></table>
604
+
605
+ Table 7: List of the utilized hyperparameters in CRL.
606
+
607
+ <table><tr><td>Parameters</td><td>Sepsis</td><td>Parameters</td><td>Mechanical Ventilation</td></tr><tr><td>General</td><td></td><td>General</td><td></td></tr><tr><td>Expert data patient number</td><td>14313</td><td>Expert data patient number</td><td>13846</td></tr><tr><td>Validation data patient number</td><td>6275</td><td>Validation data patient number</td><td>5954</td></tr><tr><td>Max Length</td><td>10</td><td>Max Length</td><td>10</td></tr><tr><td>Action_dim</td><td>2</td><td>Action_dim</td><td>2</td></tr><tr><td>State_dim</td><td>48</td><td>State_dim</td><td>36</td></tr><tr><td>Gamma</td><td>0.99</td><td>Gamma</td><td>0.99</td></tr><tr><td>DDPG</td><td></td><td>DDQN</td><td></td></tr><tr><td>Learning rate</td><td>1e-3</td><td>Learning rate</td><td>1e-4</td></tr><tr><td>Policy Network</td><td>256,256</td><td>Policy Network</td><td>64,64</td></tr><tr><td>Replay memory size</td><td>20000</td><td>Update steps</td><td>500000</td></tr><tr><td>Update steps</td><td>20000</td><td></td><td></td></tr><tr><td>VOCE</td><td></td><td>CQL</td><td></td></tr><tr><td>Learning rate</td><td>1e-3</td><td>Learning rate</td><td>1e-4</td></tr><tr><td>Policy Network</td><td>256,256</td><td>Policy Network</td><td>64,64</td></tr><tr><td>Alpha scale</td><td>10</td><td>Update steps</td><td>500000</td></tr><tr><td>KL constraint</td><td>0.01</td><td>Alphas</td><td>0.05,0.1,0.5,1,2</td></tr><tr><td>Dual constraint</td><td>0.1</td><td></td><td></td></tr><tr><td>Update steps</td><td>4000</td><td></td><td></td></tr><tr><td>CopiDICE</td><td></td><td></td><td></td></tr><tr><td>Learning rate</td><td>1e-4</td><td></td><td></td></tr><tr><td>Policy Network</td><td>256,256</td><td></td><td></td></tr><tr><td>Alpha</td><td>0.5</td><td></td><td></td></tr><tr><td>Cost limit</td><td>10</td><td></td><td></td></tr><tr><td>Update steps</td><td>100000</td><td></td><td></td></tr><tr><td>BCQ-Lag</td><td></td><td></td><td></td></tr><tr><td>Learning rate</td><td>1e-3</td><td></td><td></td></tr><tr><td>Policy Network</td><td>256,256</td><td></td><td></td></tr><tr><td>Cost limit</td><td>10</td><td></td><td></td></tr><tr><td>Lambda</td><td>0.75</td><td></td><td></td></tr><tr><td>Beta</td><td>0.5</td><td></td><td></td></tr><tr><td>Update steps</td><td>100000</td><td></td><td></td></tr></table>
608
+
609
+ # 686 NeurIPS Paper Checklist
610
+
611
+ # 1. Claims
612
+
613
+ Question: Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope?
614
+
615
+ Answer: [Yes]
616
+
617
+ Justification: In the abstract and introduction, we delineate the main motivations and contributions of this paper and its application in the field of safe reinforcement learning in healthcare.
618
+
619
+ Guidelines:
620
+
621
+ • The answer NA means that the abstract and introduction do not include the claims made in the paper.
622
+ • The abstract and/or introduction should clearly state the claims made, including the contributions made in the paper and important assumptions and limitations. A No or NA answer to this question will not be perceived well by the reviewers.
623
+ • The claims made should match theoretical and experimental results, and reflect how much the results can be expected to generalize to other settings.
624
+ • It is fine to include aspirational goals as motivation as long as it is clear that these goals are not attained by the paper.
625
+
626
+ # 2. Limitations
627
+
628
+ Question: Does the paper discuss the limitations of the work performed by the authors?
629
+
630
+ Answer: [Yes]
631
+
632
+ Justification: In the final section, this paper discusses the limitations of the method.
633
+
634
+ Guidelines:
635
+
636
+ • The answer NA means that the paper has no limitation while the answer No means that the paper has limitations, but those are not discussed in the paper.
637
+ • The authors are encouraged to create a separate "Limitations" section in their paper.
638
+ • The paper should point out any strong assumptions and how robust the results are to violations of these assumptions (e.g., independence assumptions, noiseless settings, model well-specification, asymptotic approximations only holding locally). The authors should reflect on how these assumptions might be violated in practice and what the implications would be.
639
+ • The authors should reflect on the scope of the claims made, e.g., if the approach was only tested on a few datasets or with a few runs. In general, empirical results often depend on implicit assumptions, which should be articulated.
640
+ The authors should reflect on the factors that influence the performance of the approach. For example, a facial recognition algorithm may perform poorly when image resolution is low or images are taken in low lighting. Or a speech-to-text system might not be used reliably to provide closed captions for online lectures because it fails to handle technical jargon.
641
+ • The authors should discuss the computational efficiency of the proposed algorithms and how they scale with dataset size.
642
+ • If applicable, the authors should discuss possible limitations of their approach to address problems of privacy and fairness.
643
+ • While the authors might fear that complete honesty about limitations might be used by reviewers as grounds for rejection, a worse outcome might be that reviewers discover limitations that aren’t acknowledged in the paper. The authors should use their best judgment and recognize that individual actions in favor of transparency play an important role in developing norms that preserve the integrity of the community. Reviewers will be specifically instructed to not penalize honesty concerning limitations.
644
+
645
+ # 3. Theory Assumptions and Proofs
646
+
647
+ Question: For each theoretical result, does the paper provide the full set of assumptions and a complete (and correct) proof?
648
+
649
+ Answer: [Yes]
650
+
651
+ Justification: We have documented the relevant theories and assumptions in the paper or supplementary materials.
652
+
653
+ Guidelines:
654
+
655
+ • The answer NA means that the paper does not include theoretical results.
656
+ • All the theorems, formulas, and proofs in the paper should be numbered and crossreferenced.
657
+ • All assumptions should be clearly stated or referenced in the statement of any theorems.
658
+ • The proofs can either appear in the main paper or the supplemental material, but if they appear in the supplemental material, the authors are encouraged to provide a short proof sketch to provide intuition.
659
+ • Inversely, any informal proof provided in the core of the paper should be complemented by formal proofs provided in appendix or supplemental material.
660
+ • Theorems and Lemmas that the proof relies upon should be properly referenced.
661
+
662
+ # 4. Experimental Result Reproducibility
663
+
664
+ Question: Does the paper fully disclose all the information needed to reproduce the main experimental results of the paper to the extent that it affects the main claims and/or conclusions of the paper (regardless of whether the code and data are provided or not)?
665
+
666
+ Answer: [Yes]
667
+
668
+ Justification: Our approach is reproducible, and our code can be made publicly available after the paper is published, including the relevant data processing procedures.
669
+
670
+ Guidelines:
671
+
672
+ • The answer NA means that the paper does not include experiments.
673
+ • If the paper includes experiments, a No answer to this question will not be perceived well by the reviewers: Making the paper reproducible is important, regardless of whether the code and data are provided or not.
674
+ • If the contribution is a dataset and/or model, the authors should describe the steps taken to make their results reproducible or verifiable.
675
+ Depending on the contribution, reproducibility can be accomplished in various ways. For example, if the contribution is a novel architecture, describing the architecture fully might suffice, or if the contribution is a specific model and empirical evaluation, it may be necessary to either make it possible for others to replicate the model with the same dataset, or provide access to the model. In general. releasing code and data is often one good way to accomplish this, but reproducibility can also be provided via detailed instructions for how to replicate the results, access to a hosted model (e.g., in the case of a large language model), releasing of a model checkpoint, or other means that are appropriate to the research performed. While NeurIPS does not require releasing code, the conference does require all submissions to provide some reasonable avenue for reproducibility, which may depend on the nature of the contribution. For example (a) If the contribution is primarily a new algorithm, the paper should make it clear how to reproduce that algorithm. (b) If the contribution is primarily a new model architecture, the paper should describe the architecture clearly and fully. (c) If the contribution is a new model (e.g., a large language model), then there should either be a way to access this model for reproducing the results or a way to reproduce the model (e.g., with an open-source dataset or instructions for how to construct the dataset). (d) We recognize that reproducibility may be tricky in some cases, in which case authors are welcome to describe the particular way they provide for reproducibility. In the case of closed-source models, it may be that access to the model is limited in some way (e.g., to registered users), but it should be possible for other researchers to have some path to reproducing or verifying the results.
676
+
677
+ # 5. Open access to data and code
678
+
679
+ Question: Does the paper provide open access to the data and code, with sufficient instructions to faithfully reproduce the main experimental results, as described in supplemental material?
680
+
681
+ Answer: [Yes]
682
+
683
+ Justification: Our code can be made publicly available after the paper is published.
684
+
685
+ Guidelines:
686
+
687
+ • The answer NA means that paper does not include experiments requiring code.
688
+ • Please see the NeurIPS code and data submission guidelines (https://nips.cc/ public/guides/CodeSubmissionPolicy) for more details.
689
+ • While we encourage the release of code and data, we understand that this might not be possible, so “No” is an acceptable answer. Papers cannot be rejected simply for not including code, unless this is central to the contribution (e.g., for a new open-source benchmark).
690
+ • The instructions should contain the exact command and environment needed to run to reproduce the results. See the NeurIPS code and data submission guidelines (https: //nips.cc/public/guides/CodeSubmissionPolicy) for more details.
691
+ • The authors should provide instructions on data access and preparation, including how to access the raw data, preprocessed data, intermediate data, and generated data, etc.
692
+ • The authors should provide scripts to reproduce all experimental results for the new proposed method and baselines. If only a subset of experiments are reproducible, they should state which ones are omitted from the script and why.
693
+ • At submission time, to preserve anonymity, the authors should release anonymized versions (if applicable).
694
+ • Providing as much information as possible in supplemental material (appended to the paper) is recommended, but including URLs to data and code is permitted.
695
+
696
+ # 6. Experimental Setting/Details
697
+
698
+ Question: Does the paper specify all the training and test details (e.g., data splits, hyperparameters, how they were chosen, type of optimizer, etc.) necessary to understand the results?
699
+
700
+ Answer: [Yes]
701
+
702
+ Justification: We provided a detailed description of the experimental setup and metrics.
703
+
704
+ Guidelines:
705
+
706
+ • The answer NA means that the paper does not include experiments. • The experimental setting should be presented in the core of the paper to a level of detail that is necessary to appreciate the results and make sense of them. • The full details can be provided either with the code, in appendix, or as supplemental material.
707
+
708
+ # 7. Experiment Statistical Significance
709
+
710
+ Question: Does the paper report error bars suitably and correctly defined or other appropriate information about the statistical significance of the experiments?
711
+
712
+ Answer: [Yes]
713
+
714
+ Justification: We tested our method with multiple random seeds and calculated the standard error.
715
+
716
+ Guidelines:
717
+
718
+ • The answer NA means that the paper does not include experiments.
719
+ • The authors should answer "Yes" if the results are accompanied by error bars, confidence intervals, or statistical significance tests, at least for the experiments that support the main claims of the paper.
720
+ • The factors of variability that the error bars are capturing should be clearly stated (for example, train/test split, initialization, random drawing of some parameter, or overall run with given experimental conditions).
721
+ • The method for calculating the error bars should be explained (closed form formula, call to a library function, bootstrap, etc.)
722
+ • The assumptions made should be given (e.g., Normally distributed errors).
723
+ • It should be clear whether the error bar is the standard deviation or the standard error of the mean.
724
+ • It is OK to report 1-sigma error bars, but one should state it. The authors should preferably report a 2-sigma error bar than state that they have a $96 \%$ CI, if the hypothesis of Normality of errors is not verified.
725
+ • For asymmetric distributions, the authors should be careful not to show in tables or figures symmetric error bars that would yield results that are out of range (e.g. negative error rates).
726
+ • If error bars are reported in tables or plots, The authors should explain in the text how they were calculated and reference the corresponding figures or tables in the text.
727
+
728
+ # 8. Experiments Compute Resources
729
+
730
+ Question: For each experiment, does the paper provide sufficient information on the computer resources (type of compute workers, memory, time of execution) needed to reproduce the experiments?
731
+
732
+ Answer: [Yes]
733
+
734
+ Justification: We explain the required computational resources and related information in the appendix.
735
+
736
+ Guidelines:
737
+
738
+ • The answer NA means that the paper does not include experiments.
739
+ • The paper should indicate the type of compute workers CPU or GPU, internal cluster, or cloud provider, including relevant memory and storage.
740
+ • The paper should provide the amount of compute required for each of the individual experimental runs as well as estimate the total compute.
741
+ • The paper should disclose whether the full research project required more compute than the experiments reported in the paper (e.g., preliminary or failed experiments that didn’t make it into the paper).
742
+
743
+ # 9. Code Of Ethics
744
+
745
+ Question: Does the research conducted in the paper conform, in every respect, with the NeurIPS Code of Ethics https://neurips.cc/public/EthicsGuidelines?
746
+
747
+ Answer: [Yes]
748
+
749
+ Justification: Although our work is related to healthcare, we train and test our models on offline data, adhering to ethical standards.
750
+
751
+ Guidelines:
752
+
753
+ • The answer NA means that the authors have not reviewed the NeurIPS Code of Ethics.
754
+ • If the authors answer No, they should explain the special circumstances that require a deviation from the Code of Ethics.
755
+ • The authors should make sure to preserve anonymity (e.g., if there is a special consideration due to laws or regulations in their jurisdiction).
756
+
757
+ # 10. Broader Impacts
758
+
759
+ Question: Does the paper discuss both potential positive societal impacts and negative societal impacts of the work performed?
760
+
761
+ Answer:[Yes]
762
+
763
+ Justification: Our work has a positive impact on safe healthcare, promoting the expansion of artificial intelligence technology into the medical field.
764
+
765
+ Guidelines:
766
+
767
+ • The answer NA means that there is no societal impact of the work performed. • If the authors answer NA or No, they should explain why their work has no societal impact or why the paper does not address societal impact.
768
+
769
+ • Examples of negative societal impacts include potential malicious or unintended uses (e.g., disinformation, generating fake profiles, surveillance), fairness considerations (e.g., deployment of technologies that could make decisions that unfairly impact specific
770
+ groups), privacy considerations, and security considerations.
771
+ The conference expects that many papers will be foundational research and not tied to particular applications, let alone deployments. However, if there is a direct path to
772
+ any negative applications, the authors should point it out. For example, it is legitimate to point out that an improvement in the quality of generative models could be used to generate deepfakes for disinformation. On the other hand, it is not needed to point out that a generic algorithm for optimizing neural networks could enable people to train models that generate Deepfakes faster.
773
+ The authors should consider possible harms that could arise when the technology is being used as intended and functioning correctly, harms that could arise when the technology is being used as intended but gives incorrect results, and harms following from (intentional or unintentional) misuse of the technology.
774
+ • If there are negative societal impacts, the authors could also discuss possible mitigation strategies (e.g., gated release of models, providing defenses in addition to attacks, mechanisms for monitoring misuse, mechanisms to monitor how a system learns from feedback over time, improving the efficiency and accessibility of ML).
775
+
776
+ # 11. Safeguards
777
+
778
+ Question: Does the paper describe safeguards that have been put in place for responsible release of data or models that have a high risk for misuse (e.g., pretrained language models, image generators, or scraped datasets)?
779
+
780
+ Answer: [NA]
781
+
782
+ Justification: Our work does not pose security risks because it is based on publicly available datasets and models.
783
+
784
+ Guidelines:
785
+
786
+ • The answer NA means that the paper poses no such risks.
787
+ • Released models that have a high risk for misuse or dual-use should be released with necessary safeguards to allow for controlled use of the model, for example by requiring that users adhere to usage guidelines or restrictions to access the model or implementing safety filters.
788
+ • Datasets that have been scraped from the Internet could pose safety risks. The authors should describe how they avoided releasing unsafe images.
789
+ • We recognize that providing effective safeguards is challenging, and many papers do not require this, but we encourage authors to take this into account and make a best faith effort.
790
+
791
+ # 12. Licenses for existing assets
792
+
793
+ Question: Are the creators or original owners of assets (e.g., code, data, models), used in the paper, properly credited and are the license and terms of use explicitly mentioned and properly respected?
794
+
795
+ Answer: [Yes]
796
+
797
+ Justification: The code, data, and models we referenced are all cited, and we followed the licenses and terms of use throughout the process.
798
+
799
+ Guidelines:
800
+
801
+ • The answer NA means that the paper does not use existing assets.
802
+ • The authors should cite the original paper that produced the code package or dataset.
803
+ • The authors should state which version of the asset is used and, if possible, include a URL.
804
+ • The name of the license (e.g., CC-BY 4.0) should be included for each asset.
805
+ • For scraped data from a particular source (e.g., website), the copyright and terms of service of that source should be provided.
806
+ • If assets are released, the license, copyright information, and terms of use in the package should be provided. For popular datasets, paperswithcode.com/datasets has curated licenses for some datasets. Their licensing guide can help determine the license of a dataset.
807
+ • For existing datasets that are re-packaged, both the original license and the license of the derived asset (if it has changed) should be provided.
808
+ • If this information is not available online, the authors are encouraged to reach out to the asset’s creators.
809
+
810
+ # 13. New Assets
811
+
812
+ Question: Are new assets introduced in the paper well documented and is the documentation provided alongside the assets?
813
+
814
+ Answer: [Yes]
815
+
816
+ Justification: We will provide detailed data extraction code and model code as part of the submission files.
817
+
818
+ Guidelines:
819
+
820
+ • The answer NA means that the paper does not release new assets.
821
+ • Researchers should communicate the details of the dataset/code/model as part of their submissions via structured templates. This includes details about training, license, limitations, etc.
822
+ • The paper should discuss whether and how consent was obtained from people whose asset is used.
823
+ • At submission time, remember to anonymize your assets (if applicable). You can either create an anonymized URL or include an anonymized zip file.
824
+
825
+ # 14. Crowdsourcing and Research with Human Subjects
826
+
827
+ Question: For crowdsourcing experiments and research with human subjects, does the paper include the full text of instructions given to participants and screenshots, if applicable, as well as details about compensation (if any)?
828
+
829
+ Answer: [NA]
830
+
831
+ Justification: This paper does not involve crowdsourcing nor research with human subjects.
832
+
833
+ Guidelines:
834
+
835
+ • The answer NA means that the paper does not involve crowdsourcing nor research with human subjects.
836
+ • Including this information in the supplemental material is fine, but if the main contribution of the paper involves human subjects, then as much detail as possible should be included in the main paper.
837
+ • According to the NeurIPS Code of Ethics, workers involved in data collection, curation, or other labor should be paid at least the minimum wage in the country of the data collector.
838
+
839
+ # 15. Institutional Review Board (IRB) Approvals or Equivalent for Research with Human Subjects
840
+
841
+ Question: Does the paper describe potential risks incurred by study participants, whether such risks were disclosed to the subjects, and whether Institutional Review Board (IRB) approvals (or an equivalent approval/review based on the requirements of your country or institution) were obtained?
842
+
843
+ Answer: [NA]
844
+
845
+ Justification: This paper does not involve crowdsourcing nor research with human subjects.
846
+
847
+ Guidelines:
848
+
849
+ • The answer NA means that the paper does not involve crowdsourcing nor research with human subjects.
850
+ • Depending on the country in which research is conducted, IRB approval (or equivalent) may be required for any human subjects research. If you obtained IRB approval, you should clearly state this in the paper.
851
+
852
+ 998 • We recognize that the procedures for this may vary significantly between institutions
853
+ 999 and locations, and we expect authors to adhere to the NeurIPS Code of Ethics and the
854
+ 1000 guidelines for their institution.
855
+ 1001 • For initial submissions, do not include any information that would break anonymity (if
856
+ 1002 applicable), such as the institution conducting the review.
parse/test/SqW42eR2wC/SqW42eR2wC_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/SqW42eR2wC/SqW42eR2wC_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/SqW42eR2wC/SqW42eR2wC_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/t0L4xG4aGC/t0L4xG4aGC_content_list.json ADDED
@@ -0,0 +1,633 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "Encoding Hierarchical Information in Neural Networks helps in Subpopulation Shift ",
5
+ "text_level": 1,
6
+ "page_idx": 0
7
+ },
8
+ {
9
+ "type": "text",
10
+ "text": "Anonymous authors Paper under double-blind review ",
11
+ "page_idx": 0
12
+ },
13
+ {
14
+ "type": "text",
15
+ "text": "Abstract ",
16
+ "text_level": 1,
17
+ "page_idx": 0
18
+ },
19
+ {
20
+ "type": "text",
21
+ "text": "Over the past decade, deep neural networks have proven to be adept in image classification tasks, often surpassing humans in terms of accuracy. However, standard neural networks often fail to understand the concept of hierarchical structures and dependencies among different classes for vision related tasks. Humans on the other hand, seem to intuitively learn categories conceptually, progressively growing from understanding high-level concepts down to granular levels of categories. One of the issues arising from the inability of neural networks to encode such dependencies within its learned structure is that of subpopulation shift – where models are queried with novel unseen classes taken from a shifted population of the training set categories. Since the neural network treats each class as independent from all others, it struggles to categorize shifting populations that are dependent at higher levels of the hierarchy. In this work, we study the aforementioned problems through the lens of a novel conditional supervised training framework. We tackle subpopulation shift by a structured learning procedure that incorporates hierarchical information conditionally through labels. Furthermore, we introduce a notion of hierarchical distance to model the catastrophic effect of mispredictions. We show that learning in this structured hierarchical manner results in networks that are more robust against subpopulation shifts, with an improvement up to $3 \\%$ in terms of accuracy and up to $1 1 \\%$ in terms of hierarchical distance over standard models on subpopulation shift benchmarks. ",
22
+ "page_idx": 0
23
+ },
24
+ {
25
+ "type": "text",
26
+ "text": "1 Introduction ",
27
+ "text_level": 1,
28
+ "page_idx": 0
29
+ },
30
+ {
31
+ "type": "text",
32
+ "text": "Deep learning has been tremendously successful at image classification tasks, often outperforming humans when the training and testing distributions are the same. In this work, we focus on tackling the issues that arise when the testing distribution is shifted at a subpopulation level from the training distribution, a problem called subpopulation shift introduced recently in BREEDS (Santurkar et al., 2021). Subpopulation shift is a specific kind of shift under the broader domain adaptation umbrella. In domain adaptation, the task of a classifier remains the same over the source and target domains, but there is a slight change in the distribution of the target domain (Goodfellow et al., 2016; Quionero-Candela et al., 2009; Saenko et al., 2010; Ganin $\\&$ Lempitsky, 2015). In the general setting, the target domain is a slightly changed version of the source domain. For example, an object detector that has been trained to detect objects during day time for a self-driving car application is used to perform the same task, but now on a shifted set of night time images. The task remains the same i.e. to identify and detect objects, but the target domain (night time) is a shifted version of the source domain (day-time), provided all other conditions (such as weather, region, etc.) remain constant. There are other forms of shifts as well such as shifts in the marginal distribution of labels (Tachet des Combes et al., 2020) or shifts under data imbalance (Li et al., 2019). These are broadly denoted as label and target shifts respectively. ",
33
+ "page_idx": 0
34
+ },
35
+ {
36
+ "type": "text",
37
+ "text": "However, in the setting of subpopulation shift, both the source and target domains remain constant. The shift here occurs at a more granular level, that of subpopulations. Consider the source distribution described above, that of a self-driving car. Let’s say the categories for classification included small vehicles and large vehicles. Under small-vehicles, the source set included samples of golf car and race car, and under large vehicles, the source samples were from firetrucks and double decker buses. In the target domain for testing, the classes remain unaltered; the classifier is still learning to categorize vehicles into small or large categories. However, the testing samples are now drawn from different subpopulations of each class which were not present during training, such as coupe and sedan for small vehicles and dumpster truck and school bus for large vehicles. ",
38
+ "page_idx": 0
39
+ },
40
+ {
41
+ "type": "image",
42
+ "img_path": "images/0d417a9a320530f77b1f8e1d7ac62126b3fffb261dd473264189892d9ff3c943.jpg",
43
+ "image_caption": [
44
+ "Figure 1: An example hierarchical representation of a custom subset of ImageNet. The classes for the classification task are at the intermediate level, denoted by ‘class’. The constituent subpopulations of each class are particular classes from the ImageNet dataset and are marked at the leaf level as ‘subpopulations’. The labels for these are not shown to the network. The letter ‘S’ denotes ‘Seen’ distribution and ‘U’ denotes ’Unseen’ shifted distributions. One-hot labels are provided at each level of the tree. The colored arrows indicate the hierarchical distance from one leaf node to the other. This shows that mispredicting a Felidae as a Canis (two graph traversals) is less catastrophic than predicting the same as an Salamander (four graph traversals). For illustration we provide the names of one set of subpopulations for each class. "
45
+ ],
46
+ "image_footnote": [],
47
+ "page_idx": 1
48
+ },
49
+ {
50
+ "type": "text",
51
+ "text": "",
52
+ "page_idx": 1
53
+ },
54
+ {
55
+ "type": "text",
56
+ "text": "Additionally, the current way of classification, in which each class is considered separate and independent of others, treats the impact of all mispredictions as equal. This is counter-intuitive, since a husky and a beagle are more similar to each other than to a bullfrog. The impact of misclassifications becomes quite important in critical use cases. The cost of mispredicting an animate object for an inanimate object can be disastrous for a self-driving car. To address this, we introduce ‘catastrophic coefficient’, a quantitative measure of the impact of mispredictions that follows intuitively from a hierarchical graph. It is defined as the normalized length of the shortest path between the true and the predicted classes as per the graphical structure of the underlying hierarchy. We show that incorporating hierarchical information during training reduces the catastrophic coefficient of all considered datasets, under subpopulation shift. ",
57
+ "page_idx": 1
58
+ },
59
+ {
60
+ "type": "text",
61
+ "text": "We explicitly incorporate the hierarchical information into learning by re-engineering the dataset to reflect the proposed hierarchical graph, a subset of which is sketched out in Figure 1. We modify the neural network architectures by assigning intermediate heads (one fully connected layer) corresponding to each level of hierarchy, with one-hot labels assigned to the classes at each level individually, as shown in Figure 2. We ensure that only samples correctly classified by a head are passed on for learning to the next heads (corresponding to descendants in the hierarchy graph) by a conditional learning mechanism. We first show results on a custom dataset we create out of ImageNet, and then scale up to three subpopulation benchmark datasets introduced by BREEDS (Santurkar et al., 2021) that cover both living and non-living entities. We also show results on the BREEDS LIVING-17 dataset by keeping the hierarchical structure, but changing the target subpopulations to cover a more diverse range. We show that given a hierarchy, our learning methodology can result in both better accuracy and lower misprediction impact under subpopulation shift. ",
62
+ "page_idx": 1
63
+ },
64
+ {
65
+ "type": "text",
66
+ "text": "",
67
+ "page_idx": 2
68
+ },
69
+ {
70
+ "type": "text",
71
+ "text": "• To the best of our knowledge, this is the first attempt to tackle the problem of subpopulation shift by hierarchical learning methods. Our method incorporates hierarchical information in two ways: 1) allowing independent inference at each level of hierarchy and 2) enabling collaboration between these levels by training them conditionally via filtering (Deng et al. (2011). This ensures that each level only trains on samples that are correctly classified on all previous levels. This is similar to anytime inference (Karayev et al. (2014)), but the goal is no longer to enable efficient inference or early exit strategies, but to propagate conditional probabilities. \n• Framing the problem in a hierarchical setting allows us to quantify the misprediction impact, measured by the shortest hierarchical distance between the true and predicted labels for inference. While this has been considered in works on cost-sensitive classification (Verma et al. (2012), Bertinetto et al. (2020)), we only use it as an evaluation metric to study the impact of hierarchies on subpopulation shift, instead of directly optimizing it. \n• We evaluate the performance of deep models under subpopulation shift and show that our training algorithm outperforms classical training in both accuracy and misprediction impact. ",
72
+ "page_idx": 2
73
+ },
74
+ {
75
+ "type": "text",
76
+ "text": "2 Related Work ",
77
+ "text_level": 1,
78
+ "page_idx": 2
79
+ },
80
+ {
81
+ "type": "text",
82
+ "text": "Subpopulation shift is a specific variant of domain adaptation where the models need to adapt to unseen data samples during testing, but the samples arrive from the same distribution of the classes, changed only at the subpopulation levels. BREEDS (Santurkar et al., 2021) introduced the problem of subpopulation shift along with tailored benchmarks constructed from the ImageNet (Deng et al., 2009) dataset. WILDS (Koh et al., 2021) provides a subpopulations shift benchmark but for toxicity classification across demographic identities. Cai et al. (2021) tackle the problem through a label expansion algorithm similar to Li et al. (2020) but tackles subpopulation shift by using the FixMatch (Sohn et al., 2020) method. The algorithm uses semi-supervised learning concepts such as pseudo-labelling and consistency loss. Cai et al. (2021) expands upon this and showed how consistency based loss is suitable for tackling the subpopulation shift problem. But these semi-supervised approaches require access to the target set, albeit unlabelled, as the algorithm makes use of these unlabelled target set to further improve upon a teacher classifier. We restrict ourselves to the supervised training framework where we have no access to the target samples. Moreover, we tackle the subpopulation shift problem by incorporating hierarchical information into the models. ",
83
+ "page_idx": 2
84
+ },
85
+ {
86
+ "type": "text",
87
+ "text": "Hierarchical modeling is a well-known supervised learning strategy to learn semantic concepts in vision datasets. Under this section, we cover methods that are shown on smaller datasets under small-scale methods and works that show results on ImageNet-scale datasets as large-scale methods. ",
88
+ "page_idx": 2
89
+ },
90
+ {
91
+ "type": "text",
92
+ "text": "Large-scale hierarchical methods:Hierarchical modeling is a well-known supervised learning strategy to learn semantic concepts in vision datasets. Under this section, we cover methods that are shown on smaller datasets under small-scale methods and works that show results on ImageNet-scale datasets as large-scale methods. Yan et al. (2015) introduce HD-CNN, which uses a base classifier to distinguish between coarser categories whereas for distinguishing between confusing classes, the task is pushed further downstream to the fine category classifiers. HD-CNN was novel in its approach to apply hierarchical training for large scale datasets but suffers from a different scalabilty problem. Its training requires copies of network parts for each subtree, and therefore the network size continues to grow with bigger hierarchies. Furthermore, there is sequential pre-training, freezing, training and finetuning required for each level of hierarchy, and hence the authors limit their heirarchies to a depth of 2. Deng et al. (2010) showed that the classification performance can be improved by leveraging semantic information as provided by the WordNet hierarchy. Deng et al. (2014) further introduced Hierarchy and Exclusion Graphs to capture semantic relations between two labels (parent and children). Although this work relabels leaf nodes to intermediate parent nodes, they train models only on the leaf node labels (single label). Blocks (Alsallakh et al., 2018) visually demonstrates via confusion matrices how learning hierarchies is an implicit method of learning for convolutional neural networks and similar classes are mapped close to one another along the diagonal of the learnt confusion matrix. Song & Chai (2018) shows how multiple heads of a neural network can collaborate among each other in order reach a consensus on image classification tasks. Verma et al. (2020) introduces a dataset with hierarchical labels for Human Pose classification known as Yoga-82 and trains hierarchical variants of DenseNet (Huang et al., 2017) to benhcmark classification accuracy on this set.In contrast, our work can be extended to multiple levels of hierarchy without the need for changing architecture, while employing a conditional training approach to link multiple labels of a single image as per the provided hierarchy. We show, by utilizing the hierarchy in this manner we are able to mitigate the effect of subpopulation shift, both under accuracy and impact of mispredictions. Hierarchical inference has often been used to enable efficient inference strategies in the scheme of anytime inference algorithms (Deng et al. (2011); Karayev et al. (2014) ). Additionally, Deng et al. (2011) can also learn a label hierarchy. However with these the aim is to make the inference pipeline more efficient by exiting early for easier examples. We perform inference at all levels of hierarchy to learn coarse-to-fine grained features to help with sub-population shift. ",
93
+ "page_idx": 2
94
+ },
95
+ {
96
+ "type": "text",
97
+ "text": "",
98
+ "page_idx": 3
99
+ },
100
+ {
101
+ "type": "text",
102
+ "text": "Small-scale hierarchical methods: B-CNN (Zhu & Bain, 2017) learns multi-level concepts via a branch training strategy through weighted loss of the individual branches on small-scale datasets. H-CNN (Seo & shik Shin, 2019) leverages hierarchical information to learn coarse to fine features on the Fashion-MNIST (Xiao et al., 2017) dataset. Condition CNN (Kolisnik et al., 2021) learns a conditional probability weight matrix to learn related features to help classification results on Kaggle Fashion Product Images dataset. VT-CNN (Liu et al., 2018) introduces a new training strategy that pays attention to more confusing classes in CIFAR-10 and CIFAR-100 based on a Confusion Visual Tree (CVT) that captures semantic level information of closely related categories. Inoue et al. (2020) show slight improvements on B-CNN by providing hierarchical semantic information to improve fine level accuracy on CIFAR-100 and Fashion-MNIST. CFCNN (Park et al., 2021) proposes a multilevel label augmentation method along with a fine and several coarse sub-networks to improve upon corresponding base networks. In our experiments we provide an approach to hierarchically train deep models which scales to ImageNet based subpopulation shift benchmarks. ",
103
+ "page_idx": 3
104
+ },
105
+ {
106
+ "type": "text",
107
+ "text": "Hierarchical knowledge to make better predictions: There are works done to learn similarity metrics in the context of hierarchical settings such as in Verma et al. (2012). Another recent work, Bertinetto et al. (2020) introduced a similar notion of impact of mispredictions. Shkodrani et al. (2021) designed a theoretical framework for hierarchical image classification with a hierarchical cross-entropy model to show a slight improvement over Bertinetto et al. (2020). On the other hand, we use the misprediction distance only as an evaluation metric to quantify the impact of our conditional training framework on the degree of catastrophic predictions, and instead look at the role that hierarchical learning plays in mitigating issues across domain shifts during inference. ",
108
+ "page_idx": 3
109
+ },
110
+ {
111
+ "type": "text",
112
+ "text": "3 Methodology: Hierarchies to Mitigate the Effect of Subpopulation Shift ",
113
+ "text_level": 1,
114
+ "page_idx": 3
115
+ },
116
+ {
117
+ "type": "text",
118
+ "text": "3.1 Subpopulation Shift ",
119
+ "text_level": 1,
120
+ "page_idx": 3
121
+ },
122
+ {
123
+ "type": "text",
124
+ "text": "As described in Section 1, subpopulation shift is a specific branch of the broader domain adaptation problem. In subpopulation shift the training and the testing distributions differ at the level of subpopulations. Let’s focus on an n-way classification problem, with each class denoted by $i$ ; $i = \\{ 1 , 2 . . . n \\}$ . The data consisting of image-label pairs for the source seen and the target unseen domain are denoted by $\\{ \\mathbb { X } ^ { s } , \\mathbb { Y } ^ { s } \\}$ and $\\{ \\mathbb { X } ^ { u } , \\mathbb { Y } ^ { u } \\}$ respectively. Each class $i$ draws from $s$ different subpopulations. The different subpopulations of class $i$ for training seen domain are denoted by $S _ { i } ^ { s }$ and for testing unseen domain by $S _ { i } ^ { u }$ . We reiterate that between seen and unseen domains, the $n$ classes remain the same, since the classification task is unchanged. However the data drawn for each class at the subpopulation level shifts, with no overlap between the seen and unseen subpopulations. This reflects that the subpopulations used for testing are never observed during training, i.e. $S _ { i } ^ { s } ~ \\cup ~ S _ { i } ^ { u } = \\emptyset$ . ",
125
+ "page_idx": 3
126
+ },
127
+ {
128
+ "type": "image",
129
+ "img_path": "images/6f78e1cd2b4bfced617ad0727066c8df48d800cfab8837f941e7b137169a27ab.jpg",
130
+ "image_caption": [
131
+ "Figure 2: Figure shows our conditional training framework applied to a multi-headed neural network architecture, on the instance subtree shown on the top left. The bottom of the figure shows conditional training for a single instance of a class ‘Carnivores’, subclass ‘Dog’. The shifting subpopulations are located one level below and are not exposed to the training methodology. The conditional training methodology is shown alongside. Conv blocks 1 and 2 make up the backbone that will be used for all 3 heads. We get the superclass prediction from head 1 located after Conv block 2. The multiplier between Conv block 2 and 3 denotes that the output of Conv block 2 only passes to Conv block 3 if the prediction of head 1 (i.e. the superclass) is correct. If head1 predicts the incorrect superclass, the rest of the network does not train on the instance. Similarly, head 2 predicts the class at the next hierarchy level, and dictates whether the fourth Conv block will be trained on this instance or not. The blocking or passing of the instance to different parts of the architecture is implemented in a batch setting via the validity mask, described in Figure 3. "
132
+ ],
133
+ "image_footnote": [],
134
+ "page_idx": 4
135
+ },
136
+ {
137
+ "type": "text",
138
+ "text": "3.2 Hierarchical View to tackle Subpopulation Shift ",
139
+ "text_level": 1,
140
+ "page_idx": 4
141
+ },
142
+ {
143
+ "type": "text",
144
+ "text": "We tackle the subpopulation shift problem by explicitly incorporating hierarchical knowledge into learning via labels. Intuitively, if a neural network can grasp the concept of structural hierarchies, it will not overfit to the observed subpopulations. Instead, the network will have a notion of multiple coarse-to-fine level distributions that the subpopulation belongs to. The coarser distributions would likely cover a much larger set of distributions, hopefully helping in generalization under shift. For instance, a network trained with the knowledge that both a fire-truck and a race-car fall under vehicles, and a human and a dog fall under living things, will not overfit to the particular subpopulation but have a notion of vehicles and living things. This will allow it to generalize to a newer large-vehicle such as school-bus and predict it as a vehicle rather than a living thing, since the network has learned a much broader distribution of vehicles one level of hierarchy above. Even if there is a misprediction, it is more likely to be at the lower levels of hierarchy, confusing things that are less catastrophic to mispredict. ",
145
+ "page_idx": 4
146
+ },
147
+ {
148
+ "type": "image",
149
+ "img_path": "images/7cc16618593a485df915c48653889a3ece2341225aed074802e48610bf75a888.jpg",
150
+ "image_caption": [
151
+ "Figure 3: Practical implementation of conditional training for a batch of images. The validity mask serves to ensure that the blocks corresponding to a particular level are trained only on the instances that are correctly classified at the previous level. Instead of blocking representations by multiplying with zeros as shown in Figure 2, we implement conditional training via multiplication of losses with the corresponding validity masks, resulting in the same outcome. Validity masks $V _ { l _ { 1 } - l _ { 2 } }$ represent the propagation of correctly classified instances from level $l _ { 1 }$ to $l _ { 2 }$ , and contain a 1 where the instance was correctly classified by all levels between $l _ { 1 }$ and $l _ { 2 }$ and 0 otherwise. They can be built from the composition of several validity masks. For instance, as shown in the figure, the validity mask for propagation from level 1 to level 3 is calculated by multiplying the validity mask from level 1 to level 2 with the validity mask from level 2 to level 3. "
152
+ ],
153
+ "image_footnote": [],
154
+ "page_idx": 5
155
+ },
156
+ {
157
+ "type": "text",
158
+ "text": "3.3 Vision Datasets as Hierarchical Trees ",
159
+ "text_level": 1,
160
+ "page_idx": 5
161
+ },
162
+ {
163
+ "type": "text",
164
+ "text": "ImageNet (Deng et al., 2009) is a large-scale image database collected on the basis of an underlying hierarchy called WordNet (Miller, 1992). It consists of twelve different subtrees created by querying synsets from the WordNet hierarchy. To motivate the problem of subpopulation shift, we create two custom datasets from ImageNet, which are shifted versions of each other at the subpopulation level. The datasets have a balanced hierarchical structure of depth 3 as shown in Figure 1, starting from coarse concepts such as mammals and amphibians at a higher level, to fine grained specific subpopulations at the leaf nodes. ",
165
+ "page_idx": 5
166
+ },
167
+ {
168
+ "type": "text",
169
+ "text": "The hierarchical structure has 5 nodes at the highest level of superclasses, 10 nodes at the class level ( $n = 1 0$ ), and each class draws from 3 subpopulations each ( $s = 3$ ), leading to a total of 30 subpopulations per dataset. Each subpopulation is a class from ImageNet. Figure 1 shows a partial hierarchy from the dataset, showing one out of the three subclasses for seen and unseen datasets at the leaf nodes per class. This is a ten-way classification task. Each class consists of shifting subpopulations, shown one level below. During testing under shift, the 10 classes at the class level remain the same, but the 30 subpopulations that samples are drawn from are changed. ",
170
+ "page_idx": 5
171
+ },
172
+ {
173
+ "type": "text",
174
+ "text": "Given a tree, we start at the root node and traverse downwards to the first level of hierarchy, which consists of superclasses such as mammals, fish, reptiles, etc. The custom dataset, for instance, has five superclasses, labelled $0 - 4$ . Next we traverse to the level of classes. These are the actual tasks that the network has to classify. At this level, finer concepts are captured, conditioned on the previous level. For instance, the task now becomes: given an amphibian, is it a frog or a salamander; or given a bird, is it aquatic or aviatory. Each superclass in our custom dataset has only 2 classes, making up the $n = 1 0$ classes for classification. This level has one-hot encoding of all ten classes. Thus, the categorical labels are presented in a level-wise concatenated format as shown in Figure 1. The label for frog is ‘ $4 8$ ’, with the label 4 encoding that it belongs to the superclass of amphibians and 8 encoding that conditioned on being an amphibian, it is a frog. The models only see labels till the class level; the subpopulations labels are hidden from the networks. Finally, we reach the leaf nodes of the tree, where there are three subpopulations per class (figure only shows 1 from seen and unseen distributions). This overall encoding represents each label as a path arising from the root to the classes. The class labels always occur at $\\mathit { l e v e l } = d e p t h - 1$ , one level above the subpopulations. For datasets such as LIVING-17 with a $d e p t h = 4$ , classes occur at $\\ l e v e l = 3$ and we show an instance of this hierarchy in Figure 2. ",
175
+ "page_idx": 5
176
+ },
177
+ {
178
+ "type": "text",
179
+ "text": "",
180
+ "page_idx": 6
181
+ },
182
+ {
183
+ "type": "text",
184
+ "text": "Accuracy and catastrophic coefficients are reported for the 10 classes, similar to BREEDS. The custom trees are simple and balanced, capturing the hierarchical structure found in the dataset. We use them to lay the foundations on which we implement our conditional training framework. The two custom datasets are flipped versions of each other, created by keeping the hierarchical structure fixed. In one dataset, one subpopulation set becomes the seen distribution whereas the other one becomes the unseen one, and this is reversed for the second dataset. We then show how our method translates well to complicated hierarchies such as the LIVING-17, Non-LIVING-26, and ENTITY-30 (Santurkar et al., 2021) subpopulation shift benchmarks. This illustrates that our algorithm is compatible with any hierarchy chosen according to the task of interest. ",
185
+ "page_idx": 6
186
+ },
187
+ {
188
+ "type": "text",
189
+ "text": "3.4 Catastrophic Distance ",
190
+ "text_level": 1,
191
+ "page_idx": 6
192
+ },
193
+ {
194
+ "type": "text",
195
+ "text": "In this section, we introduce the concept of catastrophic coefficient as a measure of the impact of misprediction. It is the shortest hierarchical distance between the true label and the predicted label in our hierarchy, normalized by the number of samples. It implicitly quantifies whether there is a notion of semantic structure in the model’s predictions. Subpopulation shift occurs at a lower level of a hierarchical tree where unseen subclasses are introduced during evaluation. So, if the hierarchically trained networks can grasp the concepts of superclasses and classes, the mispredictions during the shift will not be catastrophic. This is because they will tend to be correct at the higher levels, and hence ‘closer’ to the ground truth node in terms of graph traversal. ",
196
+ "page_idx": 6
197
+ },
198
+ {
199
+ "type": "text",
200
+ "text": "Neural networks trained via standard supervised learning have no explicit knowledge of inter-class dependencies. Thus, for flat models, mispredicting a specific sub-breed of a dog as a sub-breed of a cat is as catastrophic as mispredicting the same as a specific species of a snake. hierarchical distance between the true and predicted classes intuitively captures the catastrophic impact of a misprediction and accounts for the semantic correctness of the prediction. This serves as an additional metric to accuracy for evaluating the performance of models under subpopulation shifts. Additionally, it illustrates that the improvement in accuracy is truly due to incorporating better hierarchical information, rather than model architecture changes or the conditional training framework. It is pictorially illustrated by the colored arrows in Figure 1. ",
201
+ "page_idx": 6
202
+ },
203
+ {
204
+ "type": "text",
205
+ "text": "A higher hierarchical distance between a misprediction and its ground truth signifies a more catastrophic impact. We average the graph traversal distances of all predictions ( $= 0$ if sample classified correctly) over the entire dataset and call it the catastrophic coefficient, thus quantifying the impact of mispredictions for a network-dataset pair. Formally, let $g _ { k }$ be the graph traversals needed for sample k in the shortest path between its true and predicted label. Let there be $N$ samples for evaluation. Then, the catastrophic coefficient is defined as $\\begin{array} { r } { C a t = \\frac { \\sum _ { k = 1 } ^ { N } g _ { k } } { N } } \\end{array}$ . We note that we use this distance just to evaluate, and not during training. For evaluation, we take the final classifier level predictions and run it via our graph to check for distances, irrespective of whether they have been shown the hierarchy or not. ",
206
+ "page_idx": 6
207
+ },
208
+ {
209
+ "type": "text",
210
+ "text": "3.5 Architecture ",
211
+ "text_level": 1,
212
+ "page_idx": 6
213
+ },
214
+ {
215
+ "type": "text",
216
+ "text": "We modify the standard ResNet (He et al., 2016) architectures to make them suitable for our conditional training framework. Since our network makes classification decisions at each level of the hierarchy, we introduce a separate head to predict the one-hot encoded vectors at each level. In a hierarchical subtree, the concept of a dog class is is represented as a mammal at the superclass level, a carnivore at the class level and a dog at the subclass level. We want to train a multi-headed network where each head is trained on level wise concepts starting from the superclass level, all the way down to the subclass level maintaining the path in the subtree. Thus if we want to represent the hierarchical concept of a dog as shown in Figure 2, we want the Head $\\bot$ of our network to predict if it is a mammal (superclass), Head $^ 2$ to predict if it is a carnivore (class) and finally Head3 to predict that it is a dog (subclass). Convolutional Neural Networks learn coarse to fine features as they go deeper, capturing local concepts of images in the early layers and global concepts in the later layers (Zeiler & Fergus, 2014). This lines up well with our hierarchical structure, and hence we connect the different heads at different depths of the model. The concept is pictorially depicted in Figure 2. Since we use Residual Networks in our work, the individual convolutional blocks here are residual blocks. The locations of these heads are determined experimentally. We got best results with Head $\\bot$ attached after the third residual block, Head $^ 2$ and Head3 after the fourth residual blocks for the subtree shown in Figure 2. We further want to ensure collaboration between these heads, done via a conditional training approach which we describe next. ",
217
+ "page_idx": 6
218
+ },
219
+ {
220
+ "type": "table",
221
+ "img_path": "images/cbe8c6413a044fcbc6d1d3bcc5a15959f761385fd92b39affccf6289b58b4725.jpg",
222
+ "table_caption": [
223
+ "Table 1: Details of the Subpopulation Shift Datasets "
224
+ ],
225
+ "table_footnote": [],
226
+ "table_body": "<table><tr><td>Datasets</td><td>Depth</td><td>Subpopulations (s)</td><td>Classes (n)</td></tr><tr><td>Custom</td><td>3</td><td>3</td><td>10</td></tr><tr><td>LIVING-17</td><td>4</td><td>2</td><td>17</td></tr><tr><td>Non-LIVING-26</td><td>5</td><td>2</td><td>26</td></tr><tr><td>ENTITY-30</td><td>5</td><td>4</td><td>30</td></tr></table>",
227
+ "page_idx": 7
228
+ },
229
+ {
230
+ "type": "text",
231
+ "text": "",
232
+ "page_idx": 7
233
+ },
234
+ {
235
+ "type": "text",
236
+ "text": "3.6 Conditional Training Details ",
237
+ "text_level": 1,
238
+ "page_idx": 7
239
+ },
240
+ {
241
+ "type": "text",
242
+ "text": "Here we describe the conditional training framework, illustrated in Figure 3, which is independent of subpopulation shift. Let us assume we have 3 levels in our hierarchy, with the levels enumerated by $l = { 1 , 2 , 3 }$ . Let the labels at each of these levels (treated as one-hot) be denoted by $y _ { l }$ . Let $F$ be the neural network that we pass a batch of images $X$ to. Here $X \\in \\mathbb { R } ^ { B \\times d }$ where $\\mathrm { B }$ is the batch-size and d is the dimension of the input data. Further, let $F _ { l }$ be the neural network up to head $\\it l$ , corresponding to predicting at level $\\it l$ of our hierarchical graph. Note that all $F _ { l }$ have overlap since the neural network is shared, rather than an ensemble, as illustrated in Figure 2. The conditional loss at head $\\it l$ , $L _ { l }$ is calculated as: ",
243
+ "page_idx": 7
244
+ },
245
+ {
246
+ "type": "equation",
247
+ "img_path": "images/0a1fd596811d06f4a7cf9dd3ec58a05c2e52c00920fa35eb27d663fd24b1ad01.jpg",
248
+ "text": "$$\nL _ { l } = C r o s s E n t r o p y ( F _ { l } ( x ) , y _ { l } ) * ( V _ { 1 - l } )\n$$",
249
+ "text_format": "latex",
250
+ "page_idx": 7
251
+ },
252
+ {
253
+ "type": "text",
254
+ "text": "where $V _ { 1 - l }$ is the validity mask. $V _ { l } \\ \\in \\ R ^ { B }$ contains all zeros, except ones at locations where the samples have been correctly classified by all heads until the head at level $\\textit { l }$ . Each $V _ { l }$ is generated by element-wise multiplication of the individual constituent masks, $| V _ { 1 - 2 } * V _ { 2 - 3 } * \\ldots * V _ { l - 1 - l } |$ , allowing for an incorrect classification at any head to block further propagation of the incorrect instance to all deeper heads, shown pictorially in Figure 3. This validity mask is what enforces our conditional training framework. Multiplying this validity mask with the current head’s loss before backpropagation ensures that learning for $F _ { l }$ only occurs on samples that are meaningful at that head. In other words, $V$ propagates only correctly classified samples, as per its name. This ensures that the prediction at the $l - t h$ head is not just $p ( y _ { l } )$ , but $p ( y _ { l } \\mid F _ { k } ( x ) =$ $y _ { k }$ ) $\\forall k = 1 , 2 . . . , l - 1$ . In other words, it allows each head’s outcome to represent the probability of the current head’s prediction given that prediction of all levels until the current one were correct, allowing the network to learn progressively refining predictions. The network until a particular head is trained progressively on the conditional loss corresponding to that head. That means that during backpropagation, each layer get gradients from all conditional losses of heads located after that layer. This allows us to learn a shared backbone, but progressively refine features from coarser to finer as pertaining to the hierarchy. ",
255
+ "page_idx": 7
256
+ },
257
+ {
258
+ "type": "text",
259
+ "text": "4 Experiments & Results ",
260
+ "text_level": 1,
261
+ "page_idx": 8
262
+ },
263
+ {
264
+ "type": "text",
265
+ "text": "In Section 3, we described in detail our conditional training framework, where we train multi-headed networks to incorporate the notion of hierarchies in vision datasets. In this section, we empirically demonstrate how models trained with our approach perform better under subpopulation shift than models trained in a traditional flat learning setup. As a proof of concept, we first show results on two custom datasets created by querying the ImageNet on living entities. We then show the efficacy of our approach by expanding to three subpopulation shift benchmarks introduced in BREEDS (LIVING-17, Non-LIVING-26 and ENTITY-30). Each of these subpopulation shift benchmarks have varying structures in terms of depth and width and each captures a diverse set of relationships among their entities. We explain each benchmark in details in the following, corresponding subsections. We compare our approach with a baseline model trained in the classical manner on all classes without any hierarchical information. We additionally compare with BranchCNN (Zhu & Bain, 2017), trained as per the branch training strategy outlined by the authors. In Section 2, we mentioned HD-CNN (Yan et al., 2015) in terms of its novelty in training hierarchical deep models but as mentioned, it suffers from the issue of scalability and memory footprint with expanding hierarchies. The method is limited to hierarchies of depth 2, whereas each subpopulation benchmark exhibits trees of depth 3 or more. The method requires training one coarse classifier and multiple fine classifiers depending on how many coarse categories there are. With the current architectures of deep models, having multiple pretrained coarse and fine classifiers will vastly increase memory footprint and training time. Hence, we do not compare with H-CNN. In terms of both accuracy and catastrophic coefficient, we show that our hierarchical models are superior to baseline class models and Branch-CNN in tackling the subpopulation shift problem in all the five cases considered. We note that in 3 out of 5 sets of results, the trend of improvement in the subpoplation shifted (unseen) dataset was tracked by the unshifted (seen)) dataset as well. However, the trend is not unanimous. For instance, improvements in accuracies track each other roughly in both custom datasets and LIVING-17 datasets, but not for non-LIVING-26 and ENTITY-30 datasets. We believe that the kind of shifted subpopulation itself has an impact on this, as evidenced by the different results we get by shifting one source to three targets in LIVING17-A, B and C. We also believe that the classes where the shift occurs determine how easy the categorization under shift is, and hence see different trends for say, LIVING-17 and Non-LIVING-26 datasets. ",
266
+ "page_idx": 8
267
+ },
268
+ {
269
+ "type": "text",
270
+ "text": "4.1 Overall Setup",
271
+ "text_level": 1,
272
+ "page_idx": 8
273
+ },
274
+ {
275
+ "type": "text",
276
+ "text": "As mentioned, we consider subpopulation shift one level below the class level of a hierarchy. In this section we briefly describe the setup with the custom datasets as example. We provide the exact details of each benchmark in the subsequent sections, summarized in Table 1. Consider an n-way classification problem, with each class denoted by $i$ ; $i = \\{ 1 , 2 . . . n \\}$ . For our custom datasets, $n = 1 0$ . The total number of levels of hierarchy including the subpopulation levels, $\\it l$ , is $_ 3$ . The $n$ classes are located at $l = 2$ in our custom tree. Now, we create the shift by sampling subpopulations of each class $i$ from $s$ different subpopulations. For the custom datasets, $s = 3$ and thus, for the custom datasets we have a 10-way classification problem with a total of $S _ { i } ^ { s }$ (seen) and $n \\times s = 3 0$ $S _ { i } ^ { u }$ (unseen) domain. Let’s consider subpopulations. More concretely, the subpopulations for class $i = \\{ \\mathrm { d o g s } \\}$ , $S _ { d o g s } ^ { s } =$ [Bloodhound, Pekinese] and are distributed over $S _ { d o g s } ^ { u } =$ [Great-Pyreness, Papillon]. Thus the learning problem is that by training on just the seen subpopulations $S _ { d o g s } ^ { s }$ , the model should be able to identify that the unseen subpopulations of $S _ { d o g s } ^ { u }$ belong to $i = \\{ \\mathrm { d o g s } \\}$ . ",
277
+ "page_idx": 8
278
+ },
279
+ {
280
+ "type": "text",
281
+ "text": "We use accuracy and catastrophic coefficient described in Section 3.4 to measure performance, both in the presence and absence of subpopulations shift. The higher the accuracy of a model, the better it is. On the contrary, the lower the catastrophic co-efficient the better it is for a model. The number of graph traversals from the predicted node to the ground-truth node represents the value of a single misprediction impact, which varies from a minimum value of $0$ (correct prediction) up to a maximum value of $2 \\times ( d e p t h - 1 )$ (worst case prediction, where predictions are made one level above subpopulations, and hence at a level of $( d e p t h - 1 )$ ). For example, for a dataset with $d e p t h = 4$ such as LIVING-17 the worst case misprediction value for a single instance is 6, whereas for Non-LIVING-26, the same is 8. Both accuracy and catastrophic coefficient are reported mainly under two different settings, differentiated by the subscript. The prefix of the subscript determines the domain the model was trained on and the suffix denotes the domain it is evaluated on. There are two combinations, ‘ $s - s ^ { \\prime }$ and $s - u ^ { \\prime }$ , with ‘s’ representing seen data and ‘u’ representing unseen data. ‘ $s - s$ ’ does not evaluate subpopulation shift, but shows the results of using our method as a general training methodology. It is trained on the standard training data of the seen domain, and evaluated on the validation set in the same seen domain. ‘ $s - u$ ’ evaluates results under subpopulation shift: training is performed on seen domain, and testing on unseen domain. Details of hierarchies and code will be made available soon. ",
282
+ "page_idx": 8
283
+ },
284
+ {
285
+ "type": "table",
286
+ "img_path": "images/c0904d4f245be90f94c3eaeb8db512c3217a3c823b8349988bfa849806e2baca.jpg",
287
+ "table_caption": [
288
+ "Table 2: Results on Custom Dataset 1 (left) and Custom Dataset 2 (right). Corresponding catastrophic coefficients are shown in the bar plot on the right. ",
289
+ "Figure 4: Results on Custom Datasets 1 and 2. Accuracy is shown on the left, and corresponding catastrophic coefficients on the right. Our model outperforms the other in both accuracy and catastrophic coefficient on both ‘s-s’ and ‘s-u’ populations. "
290
+ ],
291
+ "table_footnote": [],
292
+ "table_body": "<table><tr><td>Model</td><td>AcCs-s</td><td>AcCs-u</td><td>Accs-s</td><td>Accs-u</td><td>2 1.5</td></tr><tr><td>Baseline-18</td><td>83.47</td><td>48.69</td><td>77.73</td><td>55.0</td><td>1</td></tr><tr><td>BCNN-18</td><td>87.87</td><td>51.33</td><td>81.73</td><td>58.96</td><td>0.5</td></tr><tr><td>Hierarchical-18</td><td>88.27</td><td>53.76</td><td>82.48</td><td>59.35</td><td>0</td></tr></table>",
293
+ "page_idx": 9
294
+ },
295
+ {
296
+ "type": "image",
297
+ "img_path": "images/e811b13cff398a48acc759f3b2732351e96e0bfcb781a5542deefd23564a8339.jpg",
298
+ "image_caption": [],
299
+ "image_footnote": [],
300
+ "page_idx": 9
301
+ },
302
+ {
303
+ "type": "text",
304
+ "text": "",
305
+ "page_idx": 9
306
+ },
307
+ {
308
+ "type": "text",
309
+ "text": "4.2 Model Setup",
310
+ "text_level": 1,
311
+ "page_idx": 9
312
+ },
313
+ {
314
+ "type": "text",
315
+ "text": "Throughout our experiments we focus mainly on three sets of training, which result in the Baseline, the Branch-CNN and the Hierarchical Models. The Baseline models are trained in a flat manner, and evaluated as per the hyper-parameters and training details as mentioned in BREEDS (Santurkar et al., 2021), except bootstrapping. The classification task is on the $_ i$ classes, enumerated at the level of ‘classes’ mentioned in the hierarchy. The subpopulation shift occurs one level below. The subpopulations labels are never shown to the network. The Hierarchical and Branch-CNN models, have been trained on the complete hierarchical information present in the tree, using our conditional training framework and the Branch Training Strategy (Zhu & Bain, 2017) respectively. The method oversees training to teach coarse to fine concepts as per the hierarchical structure of the target classes. The method invokes a weighted summation of a joint loss where each loss contribution comes from each branch (head) of a multi-headed network. There is a loss weight factor associated with each branch which dictates how much of each branch contributes towards the final loss as training continues. A head in our case is analogous to a branch in theirs. A branch represents a conceptual level in the hierarchy, and the training scheme dictates how much weight each branch contributes to the weighted loss as training goes on. In our conditional training framework, we sequentially train each head of our multi-headed network with the subsequent conditional loss as discussed in Figure 2. In this manner we teach the top-down hierarchical structure to networks and the conditional taxonomic relationships among its entities. ",
316
+ "page_idx": 9
317
+ },
318
+ {
319
+ "type": "text",
320
+ "text": "We use ResNet-18 as our network architecture backbones for modifications as mentioned in subsection 3.5. For enumerating results, we use ‘Hierarchical-18‘ to denote a modified ResNet-18 model trained conditionally. Similarly ‘Baseline-18’ signifies a ResNet-18 architecture trained for flat classification on the $n$ categories found at the level of ‘classes’ in the hierarchy. BCNN-18 refers to the modified ResNet-18 architecture trained via the Branch Training Strategy (Zhu & Bain, 2017). ",
321
+ "page_idx": 9
322
+ },
323
+ {
324
+ "type": "text",
325
+ "text": "4.3 Results on Custom Datasets ",
326
+ "text_level": 1,
327
+ "page_idx": 9
328
+ },
329
+ {
330
+ "type": "text",
331
+ "text": "In this section, we discuss the results on the two custom datasets, shown in Figure 4. We train the models on each dataset for 120 epochs with a batch size of 32, starting with a learning rate of 0.1, and a 10 fold drop every 40 epochs thereafter. We do not use data augmentation on our custom datasets. All models have been trained on three random seeds each and the mean numbers are reported. $A c c _ { s - u }$ and $C a t _ { s - u }$ denote the accuracy and catastrophic coefficient of the model during the $s - u$ shift at the class level. As shown in Figure 4, our Hierarchical-18 model performs better than the others, both in terms of accuracy and catastrophic coefficient, as well as both in the presence and absence of subpopulation shift. Moreover, the performance gap is significant under shift indicating that the imparted hierarchical information is helpful in correctly predicting unseen subpopulation classes. The models trained conditionally have $\\sim 4 - 5 \\%$ improvement in terms of accuracy and an improvement of $\\sim ( 0 . 2 5 - 0 . 3 1 )$ in hierarchical distance, translating into $1 0 . 0 \\%$ and $7 . 9 \\%$ improvement in terms of catastrophic coefficient over the flat baseline class level models under shift for the two custom sets. Figure 4 highlights another interesting fact. Both the custom datasets have the same hierarchical structure and model the same semantic relationships among the entities; the difference is created by populating each set with different subpopulations. All models suffer performance drops from custom set 1 to 2, showing the adverse effects of the distribution spanning a particular set, implying that some subpopulation shifts are just inherently harder to tackle. ",
332
+ "page_idx": 9
333
+ },
334
+ {
335
+ "type": "table",
336
+ "img_path": "images/6922c3f2a8f6db893317eb39d9c6d45f73ebf50d7aca89eaad5932d1a238cbca.jpg",
337
+ "table_caption": [
338
+ "Table 3: Results on LIVING-17, with and without shift is shown on the left. Results for shift on Living-17-B and Living-17-C are shown as well. Corresponding catastrophic coefficients are shown in the bar plot on the right. ",
339
+ "Figure 5: Results on Living-17. Accuracy is shown on the left, and corresponding catastrophic coefficients on the right. Additional experiments for shift on 2 variants, Living-17-B and -C are also shown. Our model outperforms the others in both accuracy and catastrophic coefficient on both ‘s-s’ and ‘s-u’ populations, including shifted performance on the -B and -C variants. "
340
+ ],
341
+ "table_footnote": [],
342
+ "table_body": "<table><tr><td>Model</td><td></td><td></td><td>Accs-s Accs-u Accs-u(B) Accs-u(C)</td></tr><tr><td>Baseline-18</td><td>92.3</td><td>57.02</td><td>53.54 53.04</td></tr><tr><td>BCNN-18</td><td>92.88</td><td>58.8</td><td>55.66 55.1</td></tr><tr><td>Hierarchical-18</td><td>93.17</td><td>60.53</td><td>56.6 55.62</td></tr></table>",
343
+ "page_idx": 10
344
+ },
345
+ {
346
+ "type": "image",
347
+ "img_path": "images/ad7b341fa6d9277a47624790875bd6a18f39b2743aa91ea2d8261cd0a589df31.jpg",
348
+ "image_caption": [
349
+ "Catastrophic Co-efficient Levels on LIVING-17,-B and -C "
350
+ ],
351
+ "image_footnote": [],
352
+ "page_idx": 10
353
+ },
354
+ {
355
+ "type": "text",
356
+ "text": "",
357
+ "page_idx": 10
358
+ },
359
+ {
360
+ "type": "text",
361
+ "text": "4.4 Results on LIVING-17 ",
362
+ "text_level": 1,
363
+ "page_idx": 10
364
+ },
365
+ {
366
+ "type": "text",
367
+ "text": "In this section we discuss the results on the BREEDS LIVING-17 dataset, enumerated in Figure 5. For the LIVING-17 dataset, $n = 1 7$ , depth is 4 and $s = 2$ . The $n$ classes are located at depth $l = 3$ and the subpopulations at $l = 4$ respectively. This subpopulation shift benchmark, introduced in BREEDS (Santurkar et al., 2021), captures finer details of hierarchy that encode richer relationships between the entities. We show that our methodology is applicable to complex hierarchies and outperforms class level baseline and BCNN-18 models both on $A c c _ { s - u }$ and $C a t _ { s - u }$ . We train each architecture and model on five random seeds and report the mean numbers. We report numbers without bootstrapping, but follow all their other hyperparameters reported by BREEDS. Under the shift, Hierarchical models achieve $\\sim 1 . 7 - 3 . 5 \\%$ and $0 . 1 7 - 0 . 2 0$ improvement in terms of accuracy and hierarchical distance respectively over other techniques. This results around 4% and $1 1 \\%$ in terms of catastrophic coefficient over BCNN-18 and Baseline-18 respectively, as seen in Figure 5. ",
368
+ "page_idx": 10
369
+ },
370
+ {
371
+ "type": "text",
372
+ "text": "Results on Shifted LIVING-17 To cover a more diverse shift, we retain the hierarchy introduced in LIVING-17 but consider 2 more sets of different subpopulations. We call these LIVING-17-B and LIVING17-C. These two shifted versions of the unseen set of LIVING-17 are formed by varying the $S _ { i } ^ { u }$ subclasses. We do this either by adding disjoint subclasses of the ImageNet (Deng et al., 2009) or by creating different combinations of the existing $S _ { i } ^ { u }$ with new disjoint subclasses. We reuse some of the $S _ { i } ^ { u }$ subclasses due to the unavailability of the same in the ImageNet database. All the subpopulations of $i = \\{ \\mathrm { w o l f } \\}$ from the ",
373
+ "page_idx": 10
374
+ },
375
+ {
376
+ "type": "table",
377
+ "img_path": "images/9c2e640e1fd633fe565e435903b69c00d024b1ec78ec5e2b166f788f95dcfe24.jpg",
378
+ "table_caption": [
379
+ "Table 4: Results on Non-LIVING-26, with and without shift. Corresponding catastrophic coefficients are shown in the bar plot on the right. The L3 Hierarchy is the same hierarchy with the first two levels collapsed into a single level. "
380
+ ],
381
+ "table_footnote": [],
382
+ "table_body": "<table><tr><td>Model</td><td>Accs-s</td><td>Accs-u</td></tr><tr><td>Baseline-18</td><td>88.39</td><td>42.13</td></tr><tr><td>BCNN-18</td><td>88.1</td><td>42.4</td></tr><tr><td>L3 Hierarchical-18</td><td>87.71</td><td>42.44</td></tr><tr><td>Hierarchical-18</td><td>87.41</td><td>42.94</td></tr></table>",
383
+ "page_idx": 11
384
+ },
385
+ {
386
+ "type": "image",
387
+ "img_path": "images/6e0b9c03846800f83232183b316ca708409acbb894a2dd204e7d74213d226f69.jpg",
388
+ "image_caption": [
389
+ "Catastrophic Co-efficient Levels on NON-LIVING-26 "
390
+ ],
391
+ "image_footnote": [],
392
+ "page_idx": 11
393
+ },
394
+ {
395
+ "type": "text",
396
+ "text": "Figure 6: Results on Non-LIVING-26 dataset. Accuracy is shown on the left, and corresponding catastrophic coefficients on the right. Our model outperforms the others in both accuracy and catastrophic coefficient on both ‘s-u’ evaluation, but shows slightly worse performance on ‘s-s’ evaluation. ",
397
+ "page_idx": 11
398
+ },
399
+ {
400
+ "type": "text",
401
+ "text": "ImageNet database have already been covered in the $S _ { w o l f } ^ { s }$ and $S _ { w o l f } ^ { u }$ set, so we just reuse the $S _ { w o l f } ^ { u }$ in the sets B and C. ",
402
+ "page_idx": 11
403
+ },
404
+ {
405
+ "type": "text",
406
+ "text": "$A c c _ { s - u } ( B )$ denotes the model accuracy for the shift ‘ $s - u$ ’ from set A to B. As can be seen from Figure 5, Hierarchical-18 models have better accuracy and catastrophic coefficients than the other models for all three shifted sets. This shows that imparting hierarchical knowledge helps deep models to adapt to various degrees of the subpopulation shift. ",
407
+ "page_idx": 11
408
+ },
409
+ {
410
+ "type": "text",
411
+ "text": "4.5 Results on Non-LIVING-26 ",
412
+ "text_level": 1,
413
+ "page_idx": 11
414
+ },
415
+ {
416
+ "type": "text",
417
+ "text": "In this section, we describe results on the Non-LIVING-26 dataset, tabulated in Figure 6. The dataset has $n = 2 6$ classes, a depth of 5 and number of subpopulation, $s = 2$ . The $n$ classes are located at depth $l = 4$ and the subpopulations at $l = 5$ respectively. For comparison, we train Baseline-18 and BCNN-18. We know that depth might hinder our conditional training process, since we limit samples that pass down from a level to the next contingent on their correct prediction at that head. To test this, we create a collapsed version of this hierarchy. We collapse levels 1 and 2 into a single level and create a new hierarchy with the same amount of information and term this as L3 Hierarchical-18. All models are trained on three random seeds each and the mean numbers are reported. ",
418
+ "page_idx": 11
419
+ },
420
+ {
421
+ "type": "text",
422
+ "text": "As seen from Figure 6, BCNN-18 outperforms our hierarchical model on ‘ $s - s$ ’ performance, while our framework performs better under both kinds of shift. In our conditional training framework, we only train subsequent heads if the previous heads have correctly classified the sample. As the depth of the hierarchical tree increases, fewer samples reach the final head for training, affecting the final classification performance on ‘ $s \\mathrm { ~ - ~ } s ^ { \\mathrm { ~ } }$ models. Despite that, we outperform aseline-18 and BCNN-18 both in terms of accuracy and catastrophic co-efficient on the ‘subpopulation shift ‘ $s - u$ ’ set. Since, the L3 Hierarchical18 model is trained on one less level of hierarchical information, the final head gets to classify some more samples than Hierarchical-18 and has slightly better ‘ $s - s ^ { \\prime }$ ’ performance. We evaluate the catastrophic coefficient of each model under two different settings. As the name suggests $C a t ( 3 ) _ { s - s }$ quantifies the effect of catastrophic mispredictions calculated on the collapsed L3-Hierarchy. The BCNN-18 model was trained with all four levels of hierarchical information. Yet, under $s - u ^ { \\prime }$ , the L3 Hierarchical-18 model performs slightly better than the former, which shows the benefits of our conditional training framework. ",
423
+ "page_idx": 11
424
+ },
425
+ {
426
+ "type": "table",
427
+ "img_path": "images/578b54c8b4983f6fc13d45ec44211ec5d5b4622b48761f561611a949713500ca.jpg",
428
+ "table_caption": [
429
+ "Table 5: Accuracy results on ENTITY-30, with and without shift. The networks are trained on a collapsed hierarchy of 2 levels, but catastrophic coefficients are evaluated on both the collapsed and original, uncollapsed hierarchy of levels 2 and 4, respectively, shown in brackets on the right "
430
+ ],
431
+ "table_footnote": [],
432
+ "table_body": "<table><tr><td>Model</td><td>AcCg-s</td><td>Accs-u</td></tr><tr><td>Baseline-18</td><td>87.98</td><td>49.52</td></tr><tr><td>Hierarchical-18</td><td>87.93</td><td>50.24</td></tr></table>",
433
+ "page_idx": 12
434
+ },
435
+ {
436
+ "type": "image",
437
+ "img_path": "images/b9ef1605459d79bdc158154c96bf66cef919c66971679e843c2bddf169cfcc2c.jpg",
438
+ "image_caption": [
439
+ "Catastrophic Co-efficient Levels on ENTITY-30 "
440
+ ],
441
+ "image_footnote": [],
442
+ "page_idx": 12
443
+ },
444
+ {
445
+ "type": "text",
446
+ "text": "Figure 7: Results on training networks on the collapsed version of ENTITY-30. Accuracy is shown on the left, and corresponding catastrophic coefficients on the right. Our model outperforms the flat baseline in both accuracy and catastrophic coefficient on both the collapsed and un-collapsed versions of ENTITY-30 under shift. ",
447
+ "page_idx": 12
448
+ },
449
+ {
450
+ "type": "text",
451
+ "text": "4.6 Results on ENTITY-30 ",
452
+ "text_level": 1,
453
+ "page_idx": 12
454
+ },
455
+ {
456
+ "type": "text",
457
+ "text": "We saw the effect of collapsing hierarchy with the previous set of experiments on Non-LIVING-26. Now, we attempt to understand the results of doing the reverse. In this case, we endeavor to answer that if we train a model on the collapsed version of a hierarchy, would the model still perform better on the original uncollapsed hierarchy that it did not get to see. To perform this experiment, we train on a collapsed version of the ENTITY-30 dataset and test on both the collapsed version and the un-collapsed (original) version. The dataset has $n = 3 0$ , a depth of 5 and $s = 4$ . The $n$ classes are located at depth $l = 4$ and the subpopulations at $\\iota = 5$ respectively. The hierarchical tree encapsulates both living and non-living entities and the more meaningful information is embedded between levels 3 and 4. Hence, we collapse the hierarchical information from levels $1 - 3$ to a single level. We train the Hierarchical-18 models on these two levels only and the Baseline-18 models are trained flat on all the classes. All models have been trained on three random seeds each and the mean numbers are reported in Figure 7. The catastrophic coefficients are reported for ‘ $s - s ^ { \\gamma }$ and $s - u ^ { \\prime }$ cases with the number of levels for evaluation in the hierarchy in brackets. To summarize, the networks are trained on 2 levels, but evaluated additionally on an expanded 4 level hierarchy. We note that the Hierarchical-18 has a comparable performance with Baseline-18 on ’ $s - s$ ’ set but on the shifted unseen distribution, there is a boost in both accuracy and catastrophic co-efficient. Under both the collapsed and expanded hierarchies, our models have has less catastrophic mispredictions under both ‘s-s’ and ‘s-u’ settings. ",
458
+ "page_idx": 12
459
+ },
460
+ {
461
+ "type": "text",
462
+ "text": "5 Conclusion ",
463
+ "text_level": 1,
464
+ "page_idx": 12
465
+ },
466
+ {
467
+ "type": "text",
468
+ "text": "In this paper, we target the problem of subpopulation shift, which is a specific kind of shift under the broader umbrella of domain adaptation. The subpopulations that make up the categories for the classification task change between training and testing. For instance, the testing distribution may contain new breeds of dogs not seen during training, but all samples will be labeled ‘dog’. We note an implicit notion of hierarchy in the framing of the problem itself; in the knowledge of all constituent subpopulations sharing the common immediate ancestry. In line with this, we extend the notion of hierarchy and make it explicit to better tackle the issue of subpopulation shift. We consider the underlying hierarchical structure of vision datasets, in the form of both our own custom subsets and benchmark datasets for subpopulation shift. We incorporate this information explicitly into training via labeling each level with an individual one-hot label, and then encourage collaboration between multiple heads of a model via a conditional training framework. In this framework, each head is only trained on samples that were correctly classified at all levels before the present one. We further introduce a metric to capture the notion of semantic correctness of predictions. It uses the shortest hierarchical distance between the misprediction and the true label as per the hierarchy to quantify the catastrophic impact of mispredictions. We show that our hierarchy-aware conditional training setup outperforms flat baselines by around $\\sim ( 1 - 5 ) \\%$ in terms of accuracy and $\\sim ( 3 - 1 1 ) \\%$ in terms of catastrophic coefficient over standard models across two custom datasets and three subpopulation shift benchmarks. ",
469
+ "page_idx": 12
470
+ },
471
+ {
472
+ "type": "text",
473
+ "text": "",
474
+ "page_idx": 13
475
+ },
476
+ {
477
+ "type": "text",
478
+ "text": "References ",
479
+ "text_level": 1,
480
+ "page_idx": 13
481
+ },
482
+ {
483
+ "type": "text",
484
+ "text": "Hana Ajakan, Pascal Germain, H. Larochelle, François Laviolette, and Mario Marchand. Domain-adversarial neural networks. ArXiv, abs/1412.4446, 2014. \nBilal Alsallakh, Amin Jourabloo, Mao Ye, Xiaoming Liu, and Liu Ren. Do convolutional neural networks learn class hierarchy? IEEE Transactions on Visualization and Computer Graphics, 2018. \nMartín Arjovsky, Léon Bottou, Ishaan Gulrajani, and David Lopez-Paz. Invariant risk minimization. ArXiv, abs/1907.02893, 2019. \nBjörn Barz and Joachim Denzler. Hierarchy-based image embeddings for semantic image retrieval. IEEE Winter Conference on Applications of Computer Vision (WACV), 2019. \nBjörn Barz and Joachim Denzler. Content-based image retrieval and the semantic gap in the deep learning era. In ICPR Workshops, 2020. \nShai Ben-David, John Blitzer, Koby Crammer, and Fernando C Pereira. Analysis of representations for domain adaptation. In NeurIPS, 2006. \nLuca Bertinetto, Romain Mueller, Konstantinos Tertikas, Sina Samangooei, and Nicholas A. Lord. Making better mistakes: Leveraging class hierarchies with deep networks. IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2020. \nTianle Cai, Ruiqi Gao, J. Lee, and Qi Lei. A theory of label propagation for subpopulation shift. In ICML, 2021. \nTao Chen, Shijian Lu, and Jiayuan Fan. Ss-hcnn: Semi-supervised hierarchical convolutional neural network for image classification. IEEE Transactions on Image Processing, 2019. \nYining Chen, Colin Wei, Ananya Kumar, and Tengyu Ma. Self-training avoids using spurious features under domain shift. NeurIPS, 2020. \nNicolas Courty, Rémi Flamary, Devis Tuia, and Alain Rakotomamonjy. Optimal transport for domain adaptation. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2017. \nJia Deng, Wei Dong, Richard Socher, Li-Jia Li, K. Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. IEEE Conference on Computer Vision and Pattern Recognition, 2009. \nJia Deng, Alexander C. Berg, K. Li, and Li Fei-Fei. What does classifying more than 10, 000 image categories tell us? In ECCV, 2010. \nJia Deng, Sanjeev Satheesh, Alexander Berg, and Fei Li. Fast and balanced: Efficient label tree learning for large scale object recognition. In J. Shawe-Taylor, R. Zemel, P. Bartlett, F. Pereira, and K.Q. Weinberger (eds.), Advances in Neural Information Processing Systems, volume 24. Curran Associates, Inc., 2011. URL https://proceedings.neurips.cc/paper/2011/file/ 5a4b25aaed25c2ee1b74de72dc03c14e-Paper.pdf. \nJia Deng, Nan Ding, Yangqing Jia, Andrea Frome, Kevin Murphy, Samy Bengio, Yuan Li, Hartmut Neven, and Hartwig Adam. Large-scale object classification using label relation graphs. In ECCV, 2014. \nAnkit Dhall. Learning representations for images with hierarchical labels. ArXiv, abs/2004.00909, 2020. \nAnkit Dhall, Anastasia Makarova, Octavian-Eugen Ganea, Dario Pavllo, Michael Greeff, and Andreas Krause. Hierarchical image classification using entailment cone embeddings. 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops (CVPRW), 2020. \nJeff Donahue, Yangqing Jia, Oriol Vinyals, Judy Hoffman, Ning Zhang, Eric Tzeng, and Trevor Darrell. Decaf: A deep convolutional activation feature for generic visual recognition. In ICML, 2014. \nAndrea Frome, Gregory S. Corrado, Jonathon Shlens, Samy Bengio, Jeffrey Dean, Marc’Aurelio Ranzato, and Tomas Mikolov. Devise: A deep visual-semantic embedding model. In NeurIPS, 2013. \nYaroslav Ganin and Victor S. Lempitsky. Unsupervised domain adaptation by backpropagation. ArXiv, abs/1409.7495, 2015. \nYaroslav Ganin, E. Ustinova, Hana Ajakan, Pascal Germain, H. Larochelle, François Laviolette, Mario Marchand, and Victor S. Lempitsky. Domain-adversarial training of neural networks. The Journal of Machine Learning Research, 2016. \nMuhammad Ghifary, W. Kleijn, Mengjie Zhang, and David Balduzzi. Domain generalization for object recognition with multi-task autoencoders. IEEE International Conference on Computer Vision (ICCV), 2015. \nXavier Glorot, Antoine Bordes, and Yoshua Bengio. Domain adaptation for large-scale sentiment classification: A deep learning approach. In ICML, 2011. \nBoqing Gong, Yuan Shi, Fei Sha, and Kristen Grauman. Geodesic flow kernel for unsupervised domain adaptation. IEEE Conference on Computer Vision and Pattern Recognition, 2012. \nMingming Gong, Kun Zhang, Tongliang Liu, Dacheng Tao, Clark Glymour, and Bernhard Schölkopf. Domain adaptation with conditional transferable components. JMLR workshop and conference proceedings, 2016. \nIan Goodfellow, Yoshua Bengio, Aaron Courville, and Yoshua Bengio. Deep learning, volume 1. MIT Press, 2016. \nRaghuraman Gopalan, Ruonan Li, and Rama Chellappa. Domain adaptation for object recognition: An unsupervised approach. International Conference on Computer Vision, 2011. \nPeter Hase, Chaofan Chen, Oscar Li, and Cynthia Rudin. Interpretable image recognition with hierarchical prototypes. ArXiv, abs/1906.10651, 2019. \nKaiming He, X. Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016. \nGao Huang, Zhuang Liu, and Kilian Q. Weinberger. Densely connected convolutional networks. IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2017. \nMatheus Inoue, Carlos Henrique Quartucci Forster, and Antonio Carlos dos Santos. Semantic hierarchybased convolutional neural networks for image classification. International Joint Conference on Neural Networks (IJCNN), 2020. \nXiang Jiang, Mohammad Havaei, Farshid Varno, Gabriel Chartrand, Nicolas Chapados, and Stan Matwin. Learning to learn with conditional class dependencies. In ICLR, 2019. \nSergey Karayev, Mario Fritz, and Trevor Darrell. Anytime recognition of objects and scenes. In 2014 IEEE Conference on Computer Vision and Pattern Recognition, pp. 572–579, 2014. doi: 10.1109/CVPR.2014.80. \nPang Wei Koh, Shiori Sagawa, Henrik Marklund, Sang Michael Xie, Marvin Zhang, Akshay Balsubramani, Wei hua Hu, Michihiro Yasunaga, Richard L. Phillips, Sara Beery, Jure Leskovec, Anshul Kundaje, Emma Pierson, Sergey Levine, Chelsea Finn, and Percy Liang. Wilds: A benchmark of in-the-wild distribution shifts. In ICML, 2021. \nBrendan Kolisnik, Isaac Hogan, and Farhana H. Zulkernine. Condition-cnn: A hierarchical multi-label fashion image classification model. Expert Syst. Appl., 2021. \nAnanya Kumar, Tengyu Ma, and Percy Liang. Understanding self-training for gradual domain adaptation. In ICML, 2020. \nBo Li, Yezhen Wang, Tong Che, Shanghang Zhang, Sicheng Zhao, Pengfei Xu, Wei Zhou, Yoshua Bengio, and Kurt Keutzer. Rethinking distributional matching based domain adaptation. ArXiv, abs/2006.13352, 2020. \nDa Li, Yongxin Yang, Yi-Zhe Song, and Timothy M. Hospedales. Learning to generalize: Meta-learning for domain generalization. ArXiv, abs/1710.03463, 2018. \nYitong Li, Michael Murias, Samantha Major, Geraldine Dawson, and David Edwin Carlson. On target shift in adversarial domain adaptation. In AISTATS, 2019. \nYuntao Liu, Yong Dou, Ruochun Jin, and Peng Qiao. Visual tree convolutional neural network in image classification. 24th International Conference on Pattern Recognition (ICPR), 2018. \nMingsheng Long, Yue Cao, Jianmin Wang, and Michael I. Jordan. Learning transferable features with deep adaptation networks. ArXiv, abs/1502.02791, 2015. \nJames L. McClelland, Zahra Sadeghi, and Andrew M. Saxe. A critique of pure hierarchy: Uncovering cross-cutting structure in a natural dataset. 2016. \nGeorge A. Miller. Wordnet: A lexical database for english. Commun. ACM, 1992. \nJinho Park, Heegwang Kim, and Joonki Paik. Cf-cnn: Coarse-to-fine convolutional neural network. Applied Sciences, 11, 2021. \nHieu Pham, Tung T. Le, Dat Thanh Ngo, Dat Q. Tran, and Ha Q. Nguyen. Interpreting chest x-rays via cnns that exploit hierarchical disease dependencies and uncertainty labels, 2021. \nYanyun Qu, Li Lin, Fumin Shen, Chang Lu, Yang Wu, Yuan Xie, and Dacheng Tao. Joint hierarchical category structure learning and large-scale image classification. IEEE Transactions on Image Processing, 2017. \nJoaquin Quionero-Candela, Masashi Sugiyama, Anton Schwaighofer, and Neil D. Lawrence. Dataset shift in machine learning. 2009. \nAli Sharif Razavian, Hossein Azizpour, Josephine Sullivan, and Stefan Carlsson. Cnn features off-the-shelf: An astounding baseline for recognition. IEEE Conference on Computer Vision and Pattern Recognition Workshops, 2014. \nDeboleena Roy, Priyadarshini Panda, and Kaushik Roy. Tree-cnn: A hierarchical deep convolutional neural network for incremental learning. Neural Networks, 2020. \nKate Saenko, Brian Kulis, Mario Fritz, and Trevor Darrell. Adapting visual category models to new domains. In ECCV, 2010. \nShibani Santurkar, Dimitris Tsipras, and Aleksander Madry. {BREEDS}: Benchmarks for subpopulation shift. In International Conference on Learning Representations, 2021. \nAndrew M. Saxe, James L. McClelland, and Surya Ganguli. Learning hierarchical categories in deep neural networks. Cognitive Science, 2013. \nSang-Il Seo and Juntae Kim. Hierarchical semantic loss and confidence estimator for visual-semantic embedding-based zero-shot learning. Applied Sciences, 2019. \nYian Seo and Kyung shik Shin. Hierarchical convolutional neural networks for fashion image classification. Expert Systems with Applications, 2019. ",
485
+ "page_idx": 13
486
+ },
487
+ {
488
+ "type": "text",
489
+ "text": "",
490
+ "page_idx": 14
491
+ },
492
+ {
493
+ "type": "text",
494
+ "text": "",
495
+ "page_idx": 15
496
+ },
497
+ {
498
+ "type": "text",
499
+ "text": "Sindi Shkodrani, Yu Wang, Marco Manfredi, and Nóra Baka. United we learn better: Harvesting learning improvements from class hierarchies across tasks. ArXiv, abs/2107.13627, 2021. ",
500
+ "page_idx": 16
501
+ },
502
+ {
503
+ "type": "text",
504
+ "text": "Kihyuk Sohn, David Berthelot, Chun-Liang Li, Zizhao Zhang, Nicholas Carlini, Ekin Dogus Cubuk, Alexey Kurakin, Han Zhang, and Colin Raffel. Fixmatch: Simplifying semi-supervised learning with consistency and confidence. ArXiv, abs/2001.07685, 2020. \nGuocong Song and Wei Chai. Collaborative learning for deep neural networks. In NeurIPS, 2018. \nRemi Tachet des Combes, Han Zhao, Yu-Xiang Wang, and Geoffrey J Gordon. Domain adaptation with conditional distribution matching and generalized label shift. In Advances in Neural Information Processing Systems, 2020. \nSalma Taoufiq, Balázs Nagy, and Csaba Benedek. Hierarchynet: Hierarchical cnn-based urban building classification. Remote Sensing, 2020. \nManisha Verma, Sudhakar Kumawat, Yuta Nakashima, and Shanmuganathan Raman. Yoga-82: A new dataset for fine-grained classification of human poses. IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops (CVPRW), 2020. \nNakul Verma, Dhruv Mahajan, Sundararajan Sellamanickam, and Vinod Nair. Learning hierarchical similarity metrics. In IEEE conference on computer vision and pattern recognition. IEEE, 2012. \nHan Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms, 2017. URL http://arxiv.org/abs/1708.07747. \nZhicheng Yan, Hao Zhang, Robinson Piramuthu, Vignesh Jagadeesh, Dennis DeCoste, Wei Di, and Yizhou Yu. Hd-cnn: Hierarchical deep convolutional neural networks for large scale visual recognition. IEEE International Conference on Computer Vision, 2015. \nHao-Tong Ye, Chuanlong Xie, Tianle Cai, Ruichen Li, Zhenguo Li, and Liwei Wang. Towards a theoretical framework of out-of-distribution generalization. ArXiv, abs/2106.04496, 2021. \nMatthew D. Zeiler and Rob Fergus. Visualizing and understanding convolutional networks. In ECCV, 2014. \nQuanshi Zhang, Yu Yang, Ying Nian Wu, and Song-Chun Zhu. Interpreting cnns via decision trees. IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2019. \nYu Zheng, Jianping Fan, Ji Zhang, and Xinbo Gao. Hierarchical learning of multi-task sparse metrics for large-scale image classification. Pattern Recognition, 2017. \nXinqi Zhu and Michael Bain. B-cnn: Branch convolutional neural network for hierarchical classification. ArXiv, abs/1709.09890, 2017. ",
505
+ "page_idx": 16
506
+ },
507
+ {
508
+ "type": "text",
509
+ "text": "A Appendix ",
510
+ "text_level": 1,
511
+ "page_idx": 16
512
+ },
513
+ {
514
+ "type": "text",
515
+ "text": "We mention some additional related literature in this section. ",
516
+ "page_idx": 16
517
+ },
518
+ {
519
+ "type": "text",
520
+ "text": "A.1 Additional Related Work ",
521
+ "text_level": 1,
522
+ "page_idx": 16
523
+ },
524
+ {
525
+ "type": "text",
526
+ "text": "Hierarchy based Semantic Embedding. DeVise (Frome et al., 2013) presents a deep visual-semantic embedded model which learns similarity between classes in the semantic space both from images as well as unannotated text. Barz & Denzler (2019; 2020) demonstrates how prior knowledge can be leveraged based on hierarchy of classes such as WordNet to learn semantically discriminating features. Such learnt class embeddings projected on a unit hypersphere proved to be beneficial for both novel class predictions as well as image retrieval tasks. ",
527
+ "page_idx": 16
528
+ },
529
+ {
530
+ "type": "text",
531
+ "text": "Domain Adaptation and its variants are a well studied set of problems in deep learning. One direction of works (Ben-David et al. (2006), Saenko et al. (2010), Ganin $\\&$ Lempitsky (2015), Courty et al. (2017), Gong et al. (2016), Donahue et al. (2014), Razavian et al. (2014)) is aimed at tackling the problem of adapting to target domains by learning on a selective set of samples from the target domain itself. Another line of work aims to match the source and target distributions in the feature space (Glorot et al. (2011), Ajakan et al. (2014), Long et al. (2015), Ganin et al. (2016)). The main motive behind these set of works is to tackle out-of-support domain adaptation tasks by sharing a common representation between the two. To adapt to newer environments, deep models are trained gradually to make them more suitable for transition to these newer environments (Gopalan et al. (2011), Gong et al. (2012), Glorot et al. (2011), Kumar et al. (2020), Chen et al. (2020)). Domain generalization enables the use of multiple different environments during training, but requires having a prior knowledge on the target distribution (Ghifary et al. (2015), Li et al. (2018), Arjovsky et al. (2019), Ye et al. (2021)). We on the other hand, focus on a more specific problem of distribution shift, wherein the shift occurs at a subpopulation level in the target domain. ",
532
+ "page_idx": 16
533
+ },
534
+ {
535
+ "type": "text",
536
+ "text": "",
537
+ "page_idx": 17
538
+ },
539
+ {
540
+ "type": "text",
541
+ "text": "Hierarchical Learning for in Non-Supervised Approaches. Tree-CNN (Roy et al., 2020) tackles the incremental learning problem where the model expands as a tree to accommodate new classes. Zheng et al. (2017) and Qu et al. (2017) tackle the problem of metric learning via hierarchical concepts on large scale image datasets. Chen et al. (2019) applies a semi-supervised approach to learn cluster level concepts at higher level of a hierarchy and categorical features at leaf node levels. Jiang et al. (2019) proposes a Conditional class-aware Meta Learning framework that conditionally learns better representations through modeling inter-class dependencies. Seo & Kim (2019) incorporates a hierarchical semantic loss function together with a confidence estimator to improve performance of zero-shot learning in terms of hit@k accuracy. Works such as McClelland et al. (2016) and Saxe et al. (2013) tried to understand the importance of hierarchical learning from a theoretical perspective and demonstrated an implementation on a neural network based model. ",
542
+ "page_idx": 17
543
+ },
544
+ {
545
+ "type": "text",
546
+ "text": "Hierarchical Learning for Interpretability. Interpreting predictions from CNNs has been key in understanding what features models look at in order to make predictions. Zhang et al. (2019) provide a semantic as well as quantitative explanations for CNN predictions based on a decision tee in a coarse-to-fine manner at different fine-grained levels. Building on this concept, Hase et al. (2019) introduces a model that leverages a predefined taxonomy to explain the predictions at each level of the taxonomy essentially showing how a Capuchin is gradually classified first as an animal, followed by a primate and finally as a Capuchin as per the hierarchy. ",
547
+ "page_idx": 17
548
+ },
549
+ {
550
+ "type": "text",
551
+ "text": "Applications of Hierarchical Learning. Dhall et al. (2020), Dhall (2020) show how an image classifier augmented with hierarchical information based on entailment cone embeddings outperforms flat classifiers on an Entomological Dataset. Pham et al. (2021) takes advantage of the relationship between diseases in chest X-rays to learn conditional probabilities through image classifiers. Taoufiq et al. (2020) adapts a similar approach to learn urban structural relationships. ",
552
+ "page_idx": 17
553
+ },
554
+ {
555
+ "type": "text",
556
+ "text": "A.2 Experiments ",
557
+ "text_level": 1,
558
+ "page_idx": 17
559
+ },
560
+ {
561
+ "type": "text",
562
+ "text": "A.2.1 Custom Datasets ",
563
+ "text_level": 1,
564
+ "page_idx": 17
565
+ },
566
+ {
567
+ "type": "table",
568
+ "img_path": "images/6c926d0685c737e8d9ccadf69d910dc8a56777666ed8e6b97a75dece6b191b84.jpg",
569
+ "table_caption": [
570
+ "Results on Custom Dataset 1 (left) and Custom Dataset 2 (right). Mean and standard deviations are reported for five random trials. "
571
+ ],
572
+ "table_footnote": [],
573
+ "table_body": "<table><tr><td>Model</td><td>Accs-s</td><td>Accs-u</td><td>Accs-s</td><td>Accs-u</td></tr><tr><td>Baseline-18</td><td>83.47 ± 0.95</td><td>48.69 ± 1.32</td><td>77.73 ± 2.01</td><td>55.0 ± 0.87</td></tr><tr><td>BCNN-18</td><td>87.87 ± 0.71</td><td>51.33 ± 1.22</td><td>81.73 ± 0.51</td><td>58.96 ± 1.47</td></tr><tr><td>Hierarchical-18</td><td>88.27 ± 0.88</td><td>53.76 ± 0.47</td><td>82.48 ± 0.54</td><td>59.35 ± 1.65</td></tr></table>",
574
+ "page_idx": 17
575
+ },
576
+ {
577
+ "type": "text",
578
+ "text": "A.2.2 LIVING-17 ",
579
+ "text_level": 1,
580
+ "page_idx": 17
581
+ },
582
+ {
583
+ "type": "text",
584
+ "text": "Results on LIVING-17, with and without shift is shown on the left. Results for shift on Living-17-B and Living-17-C are shown as well. Mean and standard deviations are reported for five random trials. ",
585
+ "page_idx": 17
586
+ },
587
+ {
588
+ "type": "table",
589
+ "img_path": "images/e31609c88c72e8c08fcfc7f55e7b01b1fc1d558db771c3f86e9311f86d56b74b.jpg",
590
+ "table_caption": [],
591
+ "table_footnote": [],
592
+ "table_body": "<table><tr><td>Model</td><td>Accs-s</td><td>Accs-u</td><td> Accs-u(B)</td><td>Accs-u(C)</td></tr><tr><td>Baseline-18</td><td>92.3 ± 0.84</td><td>57.02 ± 1.48</td><td>53.54 ± 2.28</td><td>53.04 ± ± 1.9</td></tr><tr><td>BCNN-18</td><td>92.88 ± 0.29</td><td>58.8 ± 0.51</td><td>55.66 ± 0.52</td><td>55.1 ± 0.96</td></tr><tr><td>Hierarchical-18</td><td>93.17 ± 0.34</td><td>60.53 ± 0.89</td><td>56.6 ± 0.96</td><td>55.62 ± 0.82</td></tr></table>",
593
+ "page_idx": 18
594
+ },
595
+ {
596
+ "type": "text",
597
+ "text": "A.2.3 Non-LIVING-26 ",
598
+ "text_level": 1,
599
+ "page_idx": 18
600
+ },
601
+ {
602
+ "type": "text",
603
+ "text": "Results on Non-LIVING-26, with and without shift. The L3 Hierarchy is the same hierarchy with the first two levels collapsed into a single level. Mean and standard deviations are reported for five random trials. ",
604
+ "page_idx": 18
605
+ },
606
+ {
607
+ "type": "table",
608
+ "img_path": "images/f668ebd14066fb307053e421086f12d9b051d9087f2b4f15d9dfb0427474ccae.jpg",
609
+ "table_caption": [],
610
+ "table_footnote": [],
611
+ "table_body": "<table><tr><td>Model</td><td>Accs-s</td><td>Accs-u</td></tr><tr><td>Baseline-18</td><td>88.39 ± 0.32</td><td>42.13 ± 0.93</td></tr><tr><td>BCNN-18</td><td>88.1 ± 0.43</td><td>42.4 ± 0.28</td></tr><tr><td>L3 Hierarchical-18</td><td>87.71 ± 0.16</td><td>42.44 ± 0.31</td></tr><tr><td>Hierarchical-18</td><td>87.41 ± 0.34</td><td>42.94 ± 0.46</td></tr></table>",
612
+ "page_idx": 18
613
+ },
614
+ {
615
+ "type": "text",
616
+ "text": "A.2.4 ENTITY-30 ",
617
+ "text_level": 1,
618
+ "page_idx": 18
619
+ },
620
+ {
621
+ "type": "text",
622
+ "text": "Accuracy results on ENTITY-30, with and without shift. Mean and standard deviations are reported for five random trials. ",
623
+ "page_idx": 18
624
+ },
625
+ {
626
+ "type": "table",
627
+ "img_path": "images/ddb3b95be50d9015f9d5e533e9155b294ff420058ac449a0c25b496433c2855a.jpg",
628
+ "table_caption": [],
629
+ "table_footnote": [],
630
+ "table_body": "<table><tr><td>Model</td><td>Accs-s</td><td>Accs-u</td></tr><tr><td>Baseline-18</td><td>87.98 ± 0.1</td><td>49.52 ± 0.16</td></tr><tr><td>Hierarchical-18</td><td>87.93 ± 0.09</td><td>50.24 ± 0.26</td></tr></table>",
631
+ "page_idx": 18
632
+ }
633
+ ]
parse/test/t0L4xG4aGC/t0L4xG4aGC_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/t0L4xG4aGC/t0L4xG4aGC_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/test/zl16jLb91v/zl16jLb91v_middle.json ADDED
The diff for this file is too large to render. See raw diff