页面简介
正文摘录
From Wikipedia, the free encyclopedia Technique for the generative modeling of a continuous probability distribution This article is about the technique in generative statistical modeling. For other uses, see Diffusion (disambiguation). This article discusses diffusion modeling of a continuous distribution. For the modeling of a discrete distribution, see Discrete diffusion model. Part of a series onMachine learninganddata mining Paradigms AutoML Association rules Supervised learning Unsupervised learning Semi-supervised learning Self-supervised learning Reinforcement learning Transfer learning Meta-learning Multimodal learning Feature learning Few-shot learning Zero-shot learning Online learning Batch learning Curriculum learning Rule-based learning Ontology learning Neuro-symbolic AI Neuromorphic engineering Quantum machine learning Problems Classification Generative modeling Regression Clustering Dimensionality reduction Density estimation Anomaly detection Data cleaning AutoML Association rules Semantic analysis Structured prediction Feature engineering Feature learning Learning to rank Grammar induction Ontology learning Multimodal learning Supervised learning(classification • regression) Apprenticeship learning Decision trees Ensembles Bagging Boosting Random forest k-NN Linear regression Naive Bayes Artificial neural networks Logistic regression Perceptron Relevance vector machine (RVM) Support vector machine (SVM) Clustering BIRCH CURE Hierarchical k-means Fuzzy Expectation–maximization (EM) DBSCAN OPTICS Mean shift Dimensionality reduction Factor analysis CCA ICA LDA NMF PCA PGD t-SNE SDL Structured prediction Graphical models Bayes net Conditional random field Hidden Markov Anomaly detection RANSAC k-NN Local outlier factor Isolation forest Neural networks Autoencoder Deep learning Feedforward neural network Recurrent neural network LSTM GRU ESN Reservoir computing Liquid Boltzmann machine Restricted GAN Diffusion model SOM Convolutional neural network U-Net LeNet AlexNet DeepDream Neural field Neural radiance field Physics-informed neural networks Transformer Vision Mamba Spiking neural network Memtransistor Electrochemical RAM (ECRAM) Reinforcement learning Q-learning Policy gradient SARSA Temporal difference (TD) Multi-agent Self-play Learning with humans Active learning Human-in-the-loop Mechanistic interpretability RLHF Model diagnostics Coefficient of determination Confusion matrix Learning curve ROC curve Mathematical foundations Kernel machines Bias–variance tradeoff Computational learning theory Empirical risk minimization Occam learning PAC learning Statistical learning VC theory Topological deep learning Journals and conferences AAAI CVPR ECCV ECML PKDD EMNLP ICCV NeurIPS ICML ICLR IJCAI ML JMLR Related articles Glossary of artificial intelligence List of datasets for machine-learning research List of datasets in computer vision and image processing Outline of machine learning vte In machine learning, diffusion models, also known as diffusion-based generative models or score-based generative models, are a class of latent variable generative models. A diffusion model consists of two major components: the forward diffusion process, and the reverse sampling process. The goal of diffusion models is to learn a diffusion process for a given dataset, such that the process can generate new elements that are distributed similarly as the original dataset. A diffusion model models data as generated by a diffusion process, whereby a new datum performs a random walk with drift through the space of all possible data.[1] A trained diffusion model can be sampled in many ways, with different efficiency and quality. There are various equivalent formalisms, including Markov chains, denoising diffusion probabilistic models, noise conditioned score networks, and stochastic differential equations.[2] They are typically trained using variational inference.[3] The model responsible for denoising is typically called its "backbone". The backbone may be of any kind, but they are typically U-nets or transformers. As of 2024[update], diffusion models are mainly used for computer vision tasks, including image denoising, inpainting, super-resolution, image generation, and video generation. These typically involve training a neural network to sequentially denoise images corrupted by Gaussian noise.[1][4] The model is trained to reverse the process of adding noise to an image. After training to convergence, it can be used for image generation by starting with an image composed of random noise, and applying the network iteratively to denoise the image. Diffusion-based image generators have seen widespread commercial interest, such as Stable Diffusion and DALL-E. These models typically combine diffusion models with other models, such as text-encoders and cross-attention modules to allow text-conditioned generation.[5] Other than computer vision, diffusion models have also found applications in natural language processing[6] such as text generation[7] and summarization,[8] sound generation,[9] and reinforcement learning.[10][11] Denoising diffusion model[edit] Non-equilibrium thermodynamics[edit] Diffusion models were introduced in 2015 as a method to train a model that can sample from a highly complex probability distribution. They used techniques from non-equilibrium thermodynamics, especially diffusion.[1] Consider, for example, how one might model the distribution of all naturally occurring photos. Each image is a point in the space of all images, and the distribution of naturally occurring photos is a "cloud" in space, which, by repeatedly adding noise to the images, diffuses out to the rest of the image space, until the cloud becomes all but indistinguishable from a Gaussian distribution 𝒩(0,I). A model that can approximately undo the diffusion can then be used to sample from the original distribution. This is studied in "non-equilibrium" thermodynamics, as the starting distribution is not in equilibrium, unlike the final distribution. The equilibrium distribution is the Gaussian distribution 𝒩(0,I), with pdf ρ(x)∝e−12‖x‖2. This is just the Maxwell–Boltzmann distribution of particles in a potential well V(x)=12‖x‖2 at temperature 1. The initial distribution, being very much out of equilibrium, would diffuse towards the equilibrium distribution, making biased random steps that are a sum of pure randomness (like a Brownian walker) and gradient descent down the potential well. The randomness is necessary: if the particles were to undergo only gradient descent, then they will all fall to the origin, collapsing the distribution. Denoising Diffusion Probabilistic Model (DDPM)[edit] The 2020 paper proposed the Denoising Diffusion Probabilistic Model (DDPM), which improves upon the previous method by variational inference.[3][12] Forward diffusion[edit] To present the model, some notation is required. β1,...,βT∈(0,1) are fixed constants. αt:=1−βt α¯t:=α1⋯αt σt:=1−α¯t σ~t:=σt−1σtβt μ~t(xt,x0):=αt(1−α¯t−1)xt+α¯t−1(1−αt)x0σt2 𝒩(μ,Σ) is the Gaussian distribution with mean μ and variance Σ, and 𝒩(x|μ,Σ) is the probability density at x. A vertical bar denotes conditioning. A forward diffusion process starts at some starting point x0∼q, where q is the probability distribution to be learned, then repeatedly adds noise to it byxt=1−βtxt−1+βtztwhere z1,...,zT are IID (Independent and identically distributed random variables) samples from 𝒩(0,I). The coefficients 1−βt and βt ensure that Var(Xt)=I assuming that Var(X0)=I. The values of βt are chosen such that for any starting distribution of x0, if it has finite second moment, then limt→∞xt|x0 converges[clarification needed] to 𝒩(0,I). The entire diffusion process then satisfiesq(x0:T)=q(x0)q(x1|x0)⋯q(xT|xT−1)=q(x0)𝒩(x1|α1x0,β1I)⋯𝒩(xT|αTxT−1,βTI)orlnq(x0:T)=lnq(x0)−∑t=1T12βt‖xt−1−βtxt−1‖2+Cwhere C is a normalization constant and often omitted. In particular, we note that x1:T|x0 is a Gaussian process, which affords us considerable freedom in reparameterization. For example, by standard manipulation with Gaussian process, xt|x0∼N(α¯tx0,σt2I)xt−1|xt,x0∼𝒩(μ~t(xt,x0),σ~t2I)In particular, notice that for large t, the variable xt|x0∼N(α¯tx0,σt2I) converges to 𝒩(0,I). That is, after a long enough diffusion process, we end up with some xT that is very close to 𝒩(0,I), with all traces of the original x0∼q gone. For example, sincext|x0∼N(α¯tx0,σt2I)we can sample xt|x0 directly "in one step", instead of going through all the intermediate steps x1,x2,...,xt−1. Derivation by reparameterization We know xt−1|x0 is a Gaussian, and xt|xt−1 is another Gaussian. We also know that these are independent. Thus we can perform a reparameterization: xt−1=α¯t−1x0+1−α¯t−1z xt=αtxt−1+1−αtz′ where z,z′ are IID Gaussians. There are 5 variables x0,xt−1,xt,z,z′ and two linear equations. The two sources of randomness are z,z′, which can be reparameterized by rotation, since the IID Gaussian distribution is rotationally symmetric. By plugging in the equations, we can solve for the first reparameterization: xt=α¯tx0+αt−α¯tz+1−αtz′⏟=σtz″ where z″ is a Gaussian with mean zero and variance one. To find the second one, we complete the rotational matrix: [z″z‴]=[αt−α¯tσtβtσt??][zz′] Since rotational matrices are all of the form [cosθsinθ−sinθcosθ], we know the matrix must be [z″z‴]=[αt−α¯tσtβtσt−βtσtαt−α¯tσt][zz′] and since the inverse of rotational matrix is its transpose, [zz′]=[αt−α¯tσt−βtσtβtσtαt−α¯tσt][z″z‴] Plugging back, and simplifying, we have xt=α¯tx0+σtz″ xt−1=μ~t(xt,x0)−σ~tz‴ Backward diffusion[edit] The key idea of DDPM is to use a neural network parametrized by θ. The network takes in two arguments xt,t, and outputs a vector μθ(xt,t) and a matrix Σθ(xt,t), such that each step in the forward diffusion process can be approximately undone by xt−1∼𝒩(μθ(xt,t),Σθ(xt,t)). This then gives us a backward diffusion process pθ defined bypθ(xT)=𝒩(xT|0,I)pθ(xt−1|xt)=𝒩(xt−1|μθ(xt,t),Σθ(xt,t))The goal now is to learn the p