# Learning Kernel Stein Discrepancy for Training Energy-Based Models
## 1 Introduction  
In unsupervised learning, training unnormalized density models and generating similar samples are hot topics, which are also the fundamental work in probability statistics [1]. In density estimation, we often achieve an unnormalized model, which contains a normalization constant. The computation of this normalization constant has been proven to be an NP-hard problem and intractable in high-dimensional datasets [2]. Only with the density function of given samples can we conduct some downstream tasks, such as sample generation and quickest change detection [3]. The traditional unnormalized density models approximate the theoretical probability distribution of given datasets by calculating the maximum likelihood estimate (MLE), which derives a variety of inference algorithms, like variational inference and MCMC [4]. But, the initializing probability distribution and Markov chain structures are hand-designed [5]; therefore, these algorithms lack universality. Simultaneously, high-dimensional curse and integral items are barriers in the sampling process [6], greatly restricting the application scenarios. Various unnormalized models have been proposed in recent years. Energy-based models [7] are widely used in unnormalized density models because of their freedom and simplicity in designing energy function. But, in order to normalize the model, the denominator in the density function is usually an integral term. To calculate the tedious integral item and its gradient, diversiform deep energy models [8; 9; 10] have been proposed. Their models indirectly eliminate integral terms, and the process of generating samples from the Gibbs distribution is very complex. Few of these models know what the quality of the trained model is, as most models are evaluated via downstream tasks [11] or by the quality of generated samples from trained models [12]. The generative adversarial network (GAN) [13] indirectly evaluates generative models using generated samples. GAN removes the probability density function estimation process in the unnormalized model and directly simulates the generation of samples. By avoiding the complex density estimation process and the bias caused by the estimation, GAN makes sample generation no longer a difficult task. GAN has brought about revolutionary evolution in image generation [14] and other domains [15], but the minimax loss function leads to mode collapse and a vanishing gradient during GAN training [16]. Various solutions have been proposed to alleviate these challenges in GAN, such as substituting the regularization terms and loss functions: WGAN [17], Fisher GAN [18], CLC-GAN [19], etc. GAN does not consider the probability distribution of given samples, nor can it provide an explicit estimate. As a result, GAN cannot conduct approximate inference and related downstream tasks, such as Independent Component Analysis. From a probabilistic statistical point of view, it is natural to introduce classical hypothesis testing methods into machine learning. Applying hypothesis testing to train unnormalized models is usually a novel method favored by researchers. [PERSON] [20] replaces the critic of GAN with a two-sample test based on MMD [21]. DEAN [22] optimizes models using goodness-of-fit test statistical methods. \(\chi^{2}\) GAN [23] measures the discrepancy between two probability distributions by \(\chi^{2}\) distance. However, because the density distribution of samples needs to be explicitly given, KSD is rarely used in training unnormalized models. In this paper, we propose a new unnormalized model to address the problems mentioned above without sampling from the model, and we can measure the quality of the model directly during the training process. We introduce the PT KSD GAN, an unnormalized model that merges Kernel Stein Discrepancy (KSD) [24; 25] as a goodness-of-fit test method with the GAN framework. Our discriminator leverages a deep energy network to assign energy values to each sample, effectively distinguishing between genuine and synthetic samples.