SlowGuess/NeurIPS_2023_OCR huggingface dataset:
Proof. We prove the proposition by employing techniques similar to those used in Theorem 3.3 from (Han et al., 2019) and Proposition 1 from (Meng et al., 2022). To guarantee that both Type I and Type II errors are at most  $2\delta$ , we first derive thresholds  $b_{I}$  and  $b_{II}$  to control Type I and Type II errors at most  $\delta$ , respectively.
Controlling Type I Error
For the type I error, we aim to bound the probability:
$$
\mathbb {P} (\text {r e s t o r a t i o n} \operatorname {g a p} _ {\hat {t}, \theta} (\tau) \geq b _ {I} | \mathbb {H} _ {0}), \tag {23}
$$
where  $b_{I}$  represents the acceptance threshold for the alternative hypothesis. The restoration gap  $\hat{g}_{\hat{t},\theta}(\tau)$  can be written as
$$
\begin{array}{l} \operatorname {r e s t o r a t i o n} \operatorname {g a p} _ {\hat {t}, \theta} (\tau) (24) \\ = \mathbb {E} _ {\epsilon_ {\hat {t}}} \left[ \left\| \boldsymbol {\tau} - \operatorname {r e s t o r e} _ {\hat {t}, \theta} \left(\operatorname {p e r t u r b} _ {\hat {t}} (\boldsymbol {\tau})\right) \right\| _ {2} \right] (25) \\ = \mathbb {E} _ {\epsilon_ {\hat {t}}} \left[ \left\| \boldsymbol {\tau} - (\boldsymbol {\tau} + \sigma_ {\hat {t}} \epsilon_ {\hat {t}} + \int_ {\hat {t}} ^ {0} \left[ - \frac {\mathrm {d} [ \sigma_ {t} ^ {2} ]}{\mathrm {d} t} \mathbf {s} _ {\theta} (\boldsymbol {\tau}, t) \right] \mathrm {d} t + \sqrt {\frac {\mathrm {d} [ \sigma_ {t} ^ {2} ]}{\mathrm {d} t}} \mathrm {d} \bar {\mathbf {w}}) \right\| _ {2} \right] (26) \\ = \mathbb {E} _ {\epsilon_ {\hat {t}}} \left[ \left\| \sigma_ {\hat {t}} \epsilon_ {\hat {t}} + \int_ {\hat {t}} ^ {0} \left[ - \frac {\mathrm {d} \left[ \sigma_ {t} ^ {2} \right]}{\mathrm {d} t} \mathbf {s} _ {\theta} (\boldsymbol {\tau}, t) \right] \mathrm {d} t + \sqrt {\frac {\mathrm {d} \left[ \sigma_ {t} ^ {2} \right]}{\mathrm {d} t}} \mathrm {d} \bar {\mathbf {w}} \right\| _ {2} \right] (27) \\ \leq \sigma_ {\hat {t}} \mathbb {E} _ {\epsilon_ {\hat {t}}} \left[ \| \epsilon_ {\hat {t}} \| _ {2} \right] + \left\| \int_ {\hat {t}} ^ {0} \left[ - \frac {\mathrm {d} [ \sigma_ {t} ^ {2} ]}{\mathrm {d} t} \mathbf {s} _ {\theta} (\boldsymbol {\tau}, t) \right] \mathrm {d} t + \sqrt {\frac {\mathrm {d} [ \sigma_ {t} ^ {2} ]}{\mathrm {d} t}} \mathrm {d} \bar {\mathbf {w}}\right) \Bigg \| _ {2} (28) \\ \leq \sigma_ {\hat {t}} \mathbb {E} _ {\epsilon_ {\hat {t}}} \left[ \| \epsilon_ {\hat {t}} \| _ {2} \right] + \left\| \int_ {\hat {t}} ^ {0} \left[ - \frac {\mathrm {d} \left[ \sigma_ {t} ^ {2} \right]}{\mathrm {d} t} \mathbf {s} _ {\theta} (\boldsymbol {\tau}, t) \right] \mathrm {d} t \right\| _ {2} + \left\| \int_ {\hat {t}} ^ {0} \sqrt {\frac {\mathrm {d} \left[ \sigma_ {t} ^ {2} \right]}{\mathrm {d} t}} \mathrm {d} \bar {\mathbf {w}}\right) \| _ {2} (29) \\ \leq \sqrt {d} \sigma_ {\hat {t}} + C \sigma_ {\hat {t}} ^ {2} + \left\| \int_ {\hat {t}} ^ {0} \sqrt {\frac {\mathrm {d} \left[ \sigma_ {t} ^ {2} \right]}{\mathrm {d} t}} \mathrm {d} \bar {\mathbf {w}}) \right\| _ {2}, (30) \\ \end{array}
$$
where the last inequality comes from Jensen's inequality,  $\mathbb{E}_{\epsilon_{\hat{t}}}[\| \epsilon_{\hat{t}}\| _2]\leq \sqrt{\mathbb{E}_{\epsilon_{\hat{t}}}\left[\| \epsilon_{\hat{t}}\| _2^2\right]} = \sqrt{d}$ , and considering the assumption over  $\mathbf{s}_{\theta}(\pmb {\tau},t)$  under the null hypothesis. As shown in (Meng et al., 2022), the last term corresponds to the  $L_{2}$  norm of a random variable arising from a Wiener process at time  $t = 0$ , where its marginal distribution is given by  $\epsilon \sim \mathcal{N}(\mathbf{0},\sigma_t^2\mathbf{I})$ . Dividing the squared  $L_{2}$  norm of  $\epsilon$  by  $\sigma_t^2$  results in a  $\chi^2$ -distribution with  $d$  degrees of freedom. According to Lemma 1 from (Laurent & Massart, 2000), we obtain the following one-sided tail bound:
$$
\mathbb {P} \left(\| \epsilon \| _ {2} ^ {2} / \sigma_ {\hat {t}} ^ {2} \geq d + 2 \sqrt {- d \cdot \log \delta} - 2 \log \delta\right) \leq \exp (\log \delta) = \delta . \tag {31}
$$
$$
\mathbb {P} \left(\| \epsilon \| _ {2} / \sigma_ {\hat {t}} \geq \sqrt {d + 2 \sqrt {- d \cdot \log \delta} - 2 \log \delta}\right) \leq \delta . \tag {32}
$$
Therefore, under null hypothesis, with probability of at least  $(1 - \delta)$ , we have that:
$$
\operatorname {r e s t o r a t i o n} \left. \operatorname {g a p} _ {\hat {t}, \theta} (\boldsymbol {\tau}) \leq b _ {I} = \sigma_ {t} \left(C \sigma_ {t} + \sqrt {d} + \sqrt {d + 2 \sqrt {- d \cdot \log \delta} - 2 \log \delta}\right) \right. \tag {33}
$$
which guarantees a bounded type I error at most  $\delta$ .
Controlling Type II Error
For the type II error, we aim to bound the probability:
$$
\mathbb {P} (\text {r e s t o r a t i o n} \operatorname {g a p} _ {\hat {t}, \theta} (\tau) \leq b _ {I I} | \mathbb {H} _ {1}), \tag {34}
$$
where  $b_{II}$  represents the acceptance threshold for the alternative hypothesis. The restoration gap  $\hat{g}_{\hat{t},\theta}(\tau)$  can be written as
$$
\begin{array}{l} \operatorname {r e s t o r a t i o n} \operatorname {g a p} _ {\hat {t}, \theta} (\tau) (35) \\ = \mathbb {E} _ {\epsilon_ {\hat {t}}} \left[ \left\| \boldsymbol {\tau} - \operatorname {r e s t o r e} _ {\hat {t}, \theta} \left(\operatorname {p e r t u r b} _ {\hat {t}} (\boldsymbol {\tau})\right) \right\| _ {2} \right] (36) \\ = \mathbb {E} _ {\epsilon_ {\hat {t}}} \left[ \left\| \boldsymbol {\tau} - (\boldsymbol {\tau} + \sigma_ {\hat {t}} \epsilon_ {\hat {t}} + \int_ {\hat {t}} ^ {0} \left[ - \frac {\mathrm {d} [ \sigma_ {t} ^ {2} ]}{\mathrm {d} t} \mathbf {s} _ {\theta} (\boldsymbol {\tau}, t) \right] \mathrm {d} t + \sqrt {\frac {\mathrm {d} [ \sigma_ {t} ^ {2} ]}{\mathrm {d} t}} \mathrm {d} \bar {\mathbf {w}}) \right\| _ {2} \right] (37) \\ = \mathbb {E} _ {\epsilon_ {\hat {t}}} \left[\left\| \sigma_ {\hat {t}} \epsilon_ {\hat {t}} + \int_ {\hat {t}} ^ {0} \left[ - \frac {\mathrm {d} \left[ \sigma_ {t} ^ {2} \right]}{\mathrm {d} t} \mathbf {s} _ {\theta} (\boldsymbol {\tau}, t) \right] \mathrm {d} t + \sqrt {\frac {\mathrm {d} \left[ \sigma_ {t} ^ {2} \right]}{\mathrm {d} t}} \mathrm {d} \bar {\mathbf {w}} \right\| _ {2} \right]\left. \right. (38) \\ \geq - \sigma_ {\hat {t}} \mathbb {E} _ {\epsilon_ {\hat {t}}} [ \| \epsilon_ {\hat {t}} \| _ {2} ] + \left\| \int_ {\hat {t}} ^ {0} \left[ - \frac {\mathrm {d} [ \sigma_ {t} ^ {2} ]}{\mathrm {d} t} \mathbf {s} _ {\theta} (\boldsymbol {\tau}, t) \right] \mathrm {d} t + \sqrt {\frac {\mathrm {d} [ \sigma_ {t} ^ {2} ]}{\mathrm {d} t}} \mathrm {d} \bar {\mathbf {w}}) \right\| _ {2} (39) \\ \geq - \sigma_ {\hat {t}} \mathbb {E} _ {\epsilon_ {\hat {t}}} [ \| \epsilon_ {\hat {t}} \| _ {2} ] + \left\| \int_ {\hat {t}} ^ {0} \left[ - \frac {\mathrm {d} [ \sigma_ {t} ^ {2} ]}{\mathrm {d} t} \mathbf {s} _ {\theta} (\boldsymbol {\tau}, t) \right] \mathrm {d} t \right\| _ {2} - \left\| \int_ {\hat {t}} ^ {0} \sqrt {\frac {\mathrm {d} [ \sigma_ {t} ^ {2} ]}{\mathrm {d} t}} \mathrm {d} \bar {\mathbf {w}}) \right\| _ {2} (40) \\ \geq - \sqrt {d} \sigma_ {\hat {t}} + (C + \Delta) \sigma_ {\hat {t}} ^ {2} - \left\| \int_ {\hat {t}} ^ {0} \sqrt {\frac {\mathrm {d} [ \sigma_ {t} ^ {2} ]}{\mathrm {d} t}} \mathrm {d} \bar {\mathbf {w}}) \right\| _ {2}, (41) \\ \end{array}
$$
where we follow a similar procedure as in the proof for controlling type I error, except deriving the lower bound by employing the triangle inequality. Therefore, under alternative hypothesis, with probability at least  $(1 - \delta)$ , we have that:
$$
\operatorname {r e s t o r a t i o n} \operatorname {g a p} _ {\hat {t}, \theta} (\tau) \geq b _ {I I} = \sigma_ {\hat {t}} \left((C + \Delta) \sigma_ {\hat {t}} - \sqrt {d} - \sqrt {d + 2 \sqrt {- d \cdot \log \delta} - 2 \log \delta}\right) \tag {42}
$$
which guarantee a bounded type II error at most  $\delta$ .
Combining Type I and Type II Thresholds
Following Theorem 3.3 in (Han et al., 2019), when  $b_{I} \leq b_{II}$ , selecting  $b_{I}$  as the threshold ensures that both type I and type II errors are at most  $2\delta$ . Therefore, under
$$
\Delta \geq \frac {2 \sqrt {d} + 2 \sqrt {d + 2 \sqrt {- d \cdot \log \delta} - 2 \log \delta}}{\sigma_ {\hat {t}}} \tag {43}
$$
$$
b \geq \sigma_ {\hat {t}} \left(C \sigma_ {\hat {t}} + \sqrt {d} + \sqrt {d + 2 \sqrt {- d \cdot \log \delta} - 2 \log \delta}\right) \tag {44}
$$
guarantees both type I and type II errors at most  $2\delta$ , which completes the proof.
Appendix B Additional Experiments
B.1 Sensitivity Analysis to Input Attribution Methods
We investigate how sensitive the proposed method is depending on the choice of input attribution methods. As described in Section 4.2, RGG+ utilizes the input attribution method as a regularizer to prevent adversarial restoration gap guidance. We apply the input attribution method to the gap predictor, where it quantifies the impact of each transition in the generated plan on the prediction of the restoration gap. To validate the robust-
ness of RGG+ to different input attribution methods, we compare its performance while employing three attribution methods: Grad-CAM (Selvaraju et al., 2017), Sailency (Simonyan et al., 2013), and DeepLIFT (Shrikumar et al., 2017). The experimental results for Maze2D tasks are presented in Table 4. RGG+ exhibits comparable performances across the three attribution methods, which implies that our proposed method is robust in terms of the choice of input attribution methods.
Table 4: Performance of RGG+ in Maze2D depending on the choice of attribution maps which suggests the robustness of the attribution map regularizer.
Maze2D Large	Multi2D Large
Grad-Cam	143.9 ± 1.50	150.9 ± 1.25
Saliency	142.7 ± 1.56	150.1 ± 1.29
DeepLIFT	143.8 ± 1.48	150.9 ± 1.26
B.2 Sensitivity Analysis to Perturbation Magnitude
To further investigate the effect of choosing different  $\hat{t}$  values on the restoration gap, we compare the performance of plans which are chosen up to top- $\mathrm{K\%}$  from the restoration gap when setting  $\hat{t}$  to 0.3, 0.5, and 0.7, in addition to the initial setting of 0.9. The results of this ablation study are illustrated in Figure 6. The results clearly show that the restoration gap remains significantly correlated with planning performance, even with these varied  $\hat{t}$  values, when considering the top  $10\%$  of results. Specifically, while the correlation is strongest with  $\hat{t}$  set to 0.9, even with  $\hat{t}$  at 0.3, 0.5, or 0.7, the restoration gap still demonstrates a stronger correlation with planning performance compared to the rarity score
or the negative realism score. This indicates the robustness of the restoration gap as a metric for assessing the quality of generated plans. Moreover, these results support our Proposition 1 that a larger  $\hat{t}$  is an effective choice when using the restoration gap.
Figure 6: An ablation study varying  $\hat{t}$  to understand the impact of the magnitude of the applied perturbation.
B.3 Comparison to Other Metrics
Table 5: Performance Comparison with rarity score and negative realism score.
Environment	Rarity	Negative Realism	RGG	RGG+
Maze2D	Large	126.9 ± 2.1	128.9 ± 1.6	135.4 ± 1.7	143.9 ± 1.5
Multi2D	Large	143.4 ± 1.7	143.3 ± 1.5	148.3 ± 1.4	150.9 ± 1.3
We investigate how effectively the restoration gap evaluates the quality of generated samples by comparing the histogram with various metrics in Figure 2 and comparing the planning performance in Figure 4. To further explore how significant a guidance signal provided by the restoration gap is for refining a diffusion planner, we compare the planning performance of plans guided by various metrics including the rarity score, the negative realism score, and the restoration gap. We conduct additional experiments in the Maze2D Large and Multi2D Large environments, the results of which are presented in Table 5. Consistent with the observations in the previous experiments, Table 5 clearly demonstrates that the restoration gap is a useful metric for control tasks. Unlike other metrics requiring expert data for training, our restoration gap works without such constraints, making it even more practical.
B.4 Comparison to Discriminator Guidance
In our work, we have demonstrated the effectiveness of utilizing the restoration gap prediction model to enhance the performance of Diffuser. However, there could be an alternative approach that is
Table 6: Performance Comparison with discriminator guidance (DG).
Environment	Diffuser	DG	RGG	RGG+
Maze2D	Large	123.5 ± 2.0	127.0 ± 1.9	135.4 ± 1.7	143.9 ± 1.5
Multi2D	Large	141.2 ± 1.6	143.6 ± 1.6	148.3 ± 1.4	150.9 ± 1.3
Figure 7: The distribution differences between Artifacts and Normal plans illustrated through the density of the negative D-value and restoration gap.
to leverage the output of the discriminator which distinguishes whether the given plan is real or generated; we refer to this discriminator output as the "D-value". It is plausible as the discriminator inherently distinguishes between real and generated trajectories.
To evaluate the ability of the discriminator to accurately identify infeasible plans, we define a subset of plans generated by Diffuser (Janner et al., 2022) as "artifact plans". These artifact plans consist of transitions that include passing through walls, an impossible action for the agent to follow. We then compare the distribution of the restoration gap for both the normal and artifact plans.
As illustrated in Figure 7, our comparison reveals that the D-value fails to distinguish between artifacts and normal groups as effectively as the restoration gap. A noteworthy observation is that the discriminator, while adept at identifying infeasible transitions within generated trajectories, tends to focus more on local transitions rather than the overall structure. This local concentration results in it being less useful than the restoration gap when it comes to recognizing infeasible plans.
To further illustrate the practical implications of these findings, we conduct an additional performance comparison experiment. Here, the discriminator guidance (DG) is used to refine the Diffuser, and the resulting performances are compared with those of RGG and  $\mathrm{RGG + }$  (see Table 6). In our comparative experiments involving Maze2D Large and Multi2D Large environments, it is apparent that the restoration gap guidance methods significantly outperform both the original Diffuser and the discriminator guidance (DG) method. While DG offers a slight improvement over Diffuser, it is unable to match the performance enhancements provided by our proposed methods.
These results underscore the effectiveness of the restoration gap as a reliable metric for improving trajectory generation by diffusion planners. This superiority holds even when compared to discriminator guidance, which directly capitalizes on the discriminator's capability to distinguish between real and generated trajectories. Consequently, it is evident that the restoration gap provides a more efficient strategy for refining diffusion planners.
B.5 Visualization of Plans with Low and High Restoration Gap
To understand how restoration gap values relate to the qualities of generated plans and to validate the efficacy of the restoration gap in detecting infeasible plans, we present additional qualitative results comparing visualized plans with low and high restoration gaps.
In the Maze2D-Large environment, as depicted in Figure 8, plans with low restoration gap values exhibit smoother and more coherent trajectories. In contrast, plans with high restoration gap values often include physically infeasible transitions, such as passing through walls or abrupt changes in direction.
In the HalfCheetah environment, as demonstrated in Figure 9, the instability of movement, particularly during landing, is more apparent in plans with a high restoration gap. On the other hand, plans with low restoration gap values allow for stable landings, enabling the cheetah to move farther.
In the Unconditional Block Stacking environment, as illustrated in Figure 10, plans with a high restoration gap exhibit error-prone transitions. For example, in such plans, the robotic arm suddenly teleports from the initial joint position, magically grasps a block stacked under other blocks, or unexpectedly changes the grasped block. Moreover, these plans violate physical constraints, such as having the block in the same position as the robotic arm. In comparison, plans with low restoration gap values comply with the physical constraints.
This disparity between plans with low and high restoration gap values illustrates the effectiveness of our restoration gap metric in distinguishing between reliable and unreliable plans across various environments.
High Restoration Gap
Low Restoration Gap
Figure 8: Visual comparison of plans of low and high restoration gap values generated by Diffuser in the Maze2D-Large environment.
High Restoration Gap
Figure 9: Visual comparison of plans of low and high restoration gap values generated by Diffuser in the HalfCheetah environment.
Low Restoration Gap
High Restoration Gap
Low Restoration Gap
Figure 10: Visual comparison of plans of low and high restoration gap values generated by Diffuser in the Unconditional Block Stacking environment.
Appendix C Experimental Setup Details
Maze2D Maze2D environments (Fu et al., 2020) involve a navigation task where an agent needs to plan for a long-horizon to navigate toward a distant target goal location. A reward is not provided except when the agent successfully reaches the target goal where it only gets a reward of 1. Maze2D environments consist of three distinct maze layouts: "U-Maze", "Medium", and "Large" each of which offers different levels of difficulty. In Maze2D environments, there are two tasks: a single-task, where the goal location is fixed, and a multi-task, which we refer to as Multi2D, where the goal location is randomly selected at the beginning of every episode. Details about Maze2D environments are summarized in Table 7.
Table 7: Environment details for Maze2D experiments.
Maze2D-Large	Maze2D-Medium	Maze2D-UMaze
State space S	∈R4	∈R4	∈R4
Action space A	∈R2	∈R2	∈R2
Goal space G	∈R2	∈R2	∈R2
Episode length	800	600	300
Locomotion Gym-MuJoCo locomotion tasks (Fu et al., 2020) are widely used benchmarks for evaluating algorithms on heterogeneous data with varying quality. The "Medium" dataset is generated
by collecting 1M samples from an SAC agent (Haarnoja et al., 2018) trained to approximately one-third of the performance level compared to an expert. The "Medium-Replay" dataset includes all samples acquired during training until a "Medium" level of performance is achieved. The "Medium-Expert" dataset is composed of an equal mixture of expert demonstrations and sub-optimal data. Environmental details for Locomotion experiments are summarized in Table 8.
Table 8: Environment details for Locomotion experiments.
Hopper-*	Walker2d-*	Halfcheetah-*
State space S	∈R11	∈R17	∈R17
Action space A	∈R3	∈R6	∈R6
Episode length	1000	1000	1000
Block Stacking The Block Stacking suite is a benchmark used to evaluate the model performance for a large state space, which employs a Kuka iwa robotic arm (Janner et al., 2022). The offline demonstration data required to train a policy model or a diffusion planning model is obtained through the application of PDDLStream (Garrett et al., 2020).
The objective of the unconditional stacking task is to construct a tower of blocks with the maximum possible height. In this task, the agent observes the state including the joint position of the robot, as well as the position and rotation of each block, and then commands the robot's desired joint position while performing the grasping action to pick up the blocks. In the conditional stacking task, where the objective is to stack blocks in a specified order, the agent observes the same state as in the unconditional stacking task, but it additionally observes the index of the block which indicates the order in which the blocks should be stacked.
We employ the same diffusion model for both tasks, but in the conditional stacking task, we additionally utilize a value function to guide the diffusion planner in stacking blocks according to specified conditions. Details about Block Stacking environments are summarized in Table 9.
Unconditional Stacking	Conditional Stacking
State space S	∈R39	∈R43
Transition space A	∈R11	∈R11
Episode length	384	384
Table 9: Environment details for Block Stacking experiments.
C.2 Other Metrics for the Assessment of Individually Generated Samples
Kynkänniemi et al. (2019) present the notions of improved precision and recall to the study of generative models. Precision is determined by examining if each generated sample falls within the estimated manifold of real samples. Symmetrically, recall is computed by checking if each real sample resides within the estimated manifold of generated samples. Real and generated sample feature vectors are represented as  $\phi_r$  and  $\phi_g$ , respectively, and the corresponding sets of these feature vectors are denoted by  $\Phi_r$  and  $\Phi_g$ . To compute improved precision and recall, the manifolds of real and generated samples are estimated using the sets of  $k$ -NN hyperspheres for each sample:
$$
\operatorname {m a n i f o l d} _ {k} (\Phi) = \bigcup_ {\phi^ {\prime} \in \Phi} B _ {k} \left(\phi^ {\prime}, \Phi\right), \quad B _ {k} \left(\phi^ {\prime}, \Phi\right) = \left\{\phi \mid \| \phi^ {\prime} - \phi \| _ {2} \leq \| \phi^ {\prime} - \mathrm {N N} _ {k} \left(\phi^ {\prime}, \Phi\right) \| _ {2} \right\} \tag {45}
$$
where  $\mathrm{NN}_k(\phi', \Phi)$  returns the  $k$ th nearest feature vector of  $\phi'$  from the set  $\Phi$ .  $B_k(\phi', \Phi)$  is the  $k$ -NN hyperspheres with the radius of  $\| \phi' - \mathrm{NN}_k(\phi', \Phi) \|_2$ .
Although the improved precision metric provides a way to evaluate the quality of a population of generated samples, it yields only a binary result for an individual sample, making it unsuitable for ranking individual samples by their quality. In contrast, realism score (Kynkänniemi et al., 2019) and rarity score (Han et al., 2023) offer a continuous extension of improved precision and recall, enabling the assessment of individually generated sample quality.
Realism Score The realism score quantifies the maximum inverse relative distance of a generated sample within a  $k$ -NN hypersphere originating from real data.
$$
\operatorname {r e a l i s m} \left(\phi_ {g}, \Phi_ {r}\right) = \max  _ {\phi_ {r}} \frac {\left\| \phi_ {r} - \mathrm {N N} _ {k} \left(\phi_ {r} , \Phi_ {r}\right) \right\| _ {2}}{\left\| \phi_ {g} - \phi_ {r} \right\| _ {2}}. \tag {46}
$$
A high realism score is achieved when the relative distance between a generated sample and a real sample is small, compared to the radius of the real sample's  $k$ -NN hypersphere.
Rarity Score The rarity score measures the radius of the smallest nearest-neighbor sphere that contains the generated sample.
$$
\operatorname {r a r i t y} \left(\phi_ {g}, \Phi_ {r}\right) = \min  _ {r, s. t. \phi_ {g} \in B _ {k} \left(\phi_ {r}, \Phi_ {r}\right)} \left\| \phi_ {r} - \mathrm {N N} _ {k} \left(\phi_ {r}, \Phi_ {r}\right) \right\| _ {2}. \tag {47}
$$
This is grounded in the hypothesis that normal samples will be closely grouped, whereas unique and rare samples will be dispersed in the feature space.
In an attempt to compare the restoration gap against negative realism scores and rarity scores, we apply the parameters suggested in (Han et al., 2023), making use of  $k = 3$  and 30,000 real samples to approximate the real manifold and calculate the corresponding scores: negative realism and rarity.
Appendix D Implementation Details and Hyperparameters
D.1 Implementation of Gap Predictor
We employ a temporal U-Net architecture, with repeated convolutional residual blocks, for parameterizing  $\mathcal{G}_{\psi}$  as introduced in Diffuser (Janner et al., 2022). By using the pre-trained down blocks from Diffuser's diffusion model as our feature extraction module and keeping it fixed during training, we can achieve enhanced performance and reduce training costs. The hyperparameters for training the gap predictor are summarized in Table 10.