arXiv:2610.11863stat.MLOct 2026

Manuscript Offprint

arXiv:2610.11863

Conditional Kernel Stein Discrepancy

Federico Matteucci, Florian Kalinke

Abstract

Kernel Stein discrepancies (KSDs) provide a versatile tool for comparing distributions. One of their main applications is in quantifying the goodness-of-fit (GoF) between a data-generating distribution and a prescribed target distribution. In this work, we study the related problem of conditional GoF quantification: given only a (possibly non-normalized) conditional target model, without information on the distribution of its covariates, and samples from a joint distribution, the goal is to assess how well the conditional distribution of the samples matches the target. To tackle this setting, we present a framework that allows lifting unconditional KSDs to the conditional setting through an operator-valued kernel on the covariate space, going beyond the known Euclidean case. We establish that our suggested statistic vanishes if and only if the conditional model and the true conditional distribution agree for almost all covariates and deploy it to test conditional GoF on smooth manifolds and on discrete spaces. Our experiments on level, power, and runtime demonstrate the viability of testing on these domains using the proposed statistic.

1 INTRODUCTION

Given a sampling distribution P and a target distribution Q, quantifying and testing their goodness-of-fit (GoF) is a fundamental problem in machine learning and statistics (Ingster and Suslina, 2003; Lehmann and Romano, 2021), with a history dating back at least to Kolmogorov (1933); Smirnov (1948). A recent approach for tackling this problem builds on kernel Stein discrepancies (KSDs; Liu et al., 2016; Chwialkowski et al., 2016; Liu et al., 2026), which combine Stein's method (Stein, 1972; Chen, 2021; Anastasiou et al., 2023) and reproducing kernel Hilbert spaces (RKHS;

Florian Kalinke

Karlsruhe Institute of Technology

Aronszajn, 1950; Steinwart and Christmann, 2008; Paulsen and Raghupathi, 2016). In particular, KSDs involve a Stein operator—associated to Q—and consider the RKHS norm of the kernel mean embedding (Berlinet and Thomas-Agnan, 2004; Smola et al., 2007; Gretton et al., 2012; Muandet et al., 2017) of P into an RKHS of functions mapped with this operator.

Part of the appeal of KSDs stems from the fact that some Stein operators, such as the Langevin-Stein operator on Euclidean spaces (Gorham and Mackey, 2015; Liu et al., 2016; Chwialkowski et al., 2016; Oates et al., 2017; Gorham and Mackey, 2017), allow handling targets Q of which the Lebesgue density is known only up to normalization, a setting arising, for instance, in Bayesian contexts or in the analysis of restricted Boltzmann machines. Stein operators are known on multiple other domains, such as manifolds (Xu and Matsuda, 2020, 2021; Barp et al., 2022; Qu and Vemuri, 2025), Hilbert spaces (Wynne et al., 2025), discrete sets (Yang et al., 2018), point-processes (Yang et al., 2019), random graphs (Xu and Reinert, 2021), sequential models (Baum et al., 2023), and time-to-event data (Fernandez et al., 2020). Indeed, KSDs enjoy numerous successful applications, for example, in testing if samples come from a generative model (Jitkrittum et al., 2017; Schrab et al., 2022), in medical contexts (Fernandez et al., 2020), for handling wind data (Xu and Matsuda, 2021), in Bayesian or variational inference (Liu and Wang, 2016; Matsubara et al., 2022; Yu et al., 2026), and in geophysics (Hou et al., 2025). We note that all KSDs listed so far can be realized as instances of the general KSD framework (Hagrass et al., 2026; Kalinke et al., 2026).

A (presumably) different setting is that of assessing the GoF of conditional distributions (Andrews, 1997; Zheng, 2000), arising, for example, in model criticism (Stute and Zhu, 2002; Moreira, 2003). For tackling conditional GoF, by building on the Langevin-Stein operator and vector-valued RKHSs (Schwartz, 1964; Carmeli et al., 2006, 2010), Jitkrittum et al. (2020) introduced the kernel conditional Stein discrepancy (KCSD), allowing for model criticism also of non-normalized models. In turn, the KCSD has found suc-cessful applications, for example, in evaluating graph neural networks for multi-agent trajectory prediction (Li et al., 2021), in statistical testing under distribution shift (Thams et al., 2023), in model calibration testing (Glaser et al., 2023), and in prediction explanation (Sarvmaili et al., 2025). However, apart from specialized extensions, for example, Glaser et al. (2024) in computational biology, KCSDs are limited to Euclidean spaces and do not feature the broad applicability enjoyed by KSDs.

In this work, we establish that the general KSD framework encapsulates quantifying conditional GoF; we dub the construction conditional kernel Stein discrepancy (CKSD) to emphasize that it is a KSD. In particular, our main contributions are as follows.

  • The CKSD statistic allows lifting known unconditional KSDs to the conditional setting, expanding the domain of applicability of KSD-based conditional GoF tests beyond the Euclidean case.

• Our main results (Theorem 5 and Corollary 8) establish that the proposed CKSD statistic is zero if and only if the conditional model correctly captures the data-generating distribution.

• We illustrate CKSD on smooth manifolds and on discrete sets. Our experiments regarding level, power, and runtime show its successful deployment on these domains. 1^{1}

Outline Section 2 introduces our notation and recalls the general KSD framework. In Section 3, we discuss the conditional GoF problem, our CKSD statistic, and properties of its estimator. Section 4 instantiates CKSD on smooth manifolds and on discrete spaces. Experiments are in Section 5.

References (66)