GUÍA visual de IA

Modelos generativos basados ​​en puntuaciones

Score-based generative models learn the score of a data distribution, the direction in which data becomes more likely at every point, and then generate new samples by starting from random noise and repeatedly stepping along that direction.

Escuche esta guíaNarrado por IA · ~8 min

En esta pagina9 minutos de lectura
  1. Descripción general
  2. Conclusiones clave
  3. Buceo profundo
  4. Sampling a 2D toy distribution with annealed Langevin dynamics
  5. Implementación en el mundo real
  6. El futuro de los modelos generativos basados en puntuaciones
  7. Poniéndolo en práctica
  8. Fuentes y lecturas adicionales
  9. Sigue explorando
  10. Preguntas frecuentes

Descripción general

Introduced by Yang Song and Stefano Ermon in 2019 and unified with diffusion models in 2021, they are the mathematical foundation of modern image, audio and video diffusion systems.

Conclusiones clave

  1. A score-based model learns the gradient of the log data density, which avoids computing the intractable normalizing constant that density models need.
  2. Song and Ermon's 2019 method perturbed data with many noise levels and sampled with annealed Langevin dynamics, reaching an Inception Score of 8.87 on CIFAR-10.
  3. The 2021 SDE framework showed that score-based models and DDPM-style diffusion models are two discretizations of the same continuous process.
  4. The probability flow ODE derived from the SDE allows exact likelihood computation, giving 2.99 bits per dimension on CIFAR-10 in the 2021 paper.
  5. The main cost of score-based generation is sampling, which typically needs hundreds to thousands of network evaluations per image.

Buceo profundo

A generative model learns to produce new examples that look like its training data, such as faces or photographs. Most approaches try to learn the probability density of the data, a function that says how likely any given image is. That is hard because a valid density must integrate to one, which requires a normalizing constant that is intractable for complex neural networks. Score-based generative models sidestep the problem. Instead of the density itself, they learn its score: the gradient of the log density with respect to the data, written as the gradient of log p(x). At any point in image space, the score is an arrow pointing toward regions where realistic images are more likely, and the normalizing constant disappears when the gradient is taken.

The method has two halves. Training uses score matching, a technique introduced by Aapo Hyvarinen in the Journal of Machine Learning Research in 2005, which fits a model's log-density gradient to the data without ever computing the normalizing constant. In practice, the common variant is denoising score matching: add Gaussian noise to a training image, and train a neural network to predict the direction back toward the clean image, which equals the score of the noisy distribution. Sampling then uses Langevin dynamics, a procedure from physics. Start from random noise, take a small step in the direction of the predicted score, add a little fresh noise, and repeat many times. Under the right conditions the samples converge to the data distribution.

The naive version fails, and the fix defines the field. Real images occupy a tiny region of the space of all possible pixel arrays, so most of the space has almost no data. A score model trained only on clean data learns accurate arrows near real images but gets almost no training signal elsewhere, and Langevin sampling starting from random noise begins exactly in those poorly learned regions. Song and Ermon's 2019 NeurIPS paper, "Generative Modeling by Estimating Gradients of the Data Distribution", solved this by perturbing data with many noise levels at once. Large noise spreads data over the whole space so the arrows are informative everywhere; small noise keeps them precise near real images. A single Noise Conditional Score Network learns the score for every level, and annealed Langevin dynamics samples from the noisiest level down to the cleanest. On CIFAR-10 they used 10 noise levels in a geometric sequence from 1 down to 0.01, with 100 Langevin steps per level, and reported an Inception Score of 8.87 and an FID of 25.32.

The key milestone came in late 2020. In "Score-Based Generative Modeling through Stochastic Differential Equations", posted in November 2020 and given an Outstanding Paper Award at ICLR 2021, Song, Jascha Sohl-Dickstein, Diederik Kingma, Abhishek Kumar, Ermon and Ben Poole replaced the finite list of noise levels with a continuous process. A stochastic differential equation (SDE), an equation describing a random process evolving over time, gradually turns data into noise. A known mathematical result says this process can be run backward in time if the score at every time is known, so learning the score is enough to turn noise back into data. The paper showed that both Song and Ermon's method and the Denoising Diffusion Probabilistic Models of Ho, Jain and Abbeel (2020) are special discretizations of this framework.

The unified view brought new tools. A predictor-corrector sampler alternates a numerical SDE solver step (the predictor) with a Langevin step (the corrector) to fix discretization errors. A deterministic "probability flow" ordinary differential equation shares the same intermediate distributions as the SDE, which allows exact likelihood computation and faster solvers. The paper reported an Inception Score of 9.89, an FID of 2.20 and a likelihood of 2.99 bits per dimension on CIFAR-10, and generated 1,024 by 1,024 face images.

Compared with alternatives, score-based models trade speed for stability and quality. Generative adversarial networks (GANs) produce an image in one forward pass but train a generator against a discriminator, a game that can be unstable and can drop parts of the data distribution. Variational autoencoders and normalizing flows give likelihoods but historically produced blurrier or less detailed images, or required restricted architectures. Score-based training is a simple regression problem with no adversary, and the 2019 paper noted it needs no special architecture constraints. The cost is sampling: generating one image requires hundreds to thousands of network evaluations. The SDE paper's samplers commonly used 1,000 or 2,000 steps.

The main limitations follow from that. Slow sampling makes deployment expensive, which is why much later research targets fewer steps. Score estimates are least accurate where data is sparse, so errors accumulate along the sampling path, and too few steps produce artifacts. Results depend on the noise schedule, the weighting of noise levels in the loss and the sampler, choices that interact in ways that are still tuned empirically. Like other generative models trained on large datasets, they can memorize and reproduce training examples, and the 2019 paper itself checked nearest neighbors in the training set to show it was not simply copying images.

In practice, score networks are usually U-Net-style convolutional networks conditioned on the noise level or time. The 2019 NCSN used a RefineNet variant and trained for 200,000 iterations with batch size 128 using the Adam optimizer. Training cost resembles that of other image models of the same size; the extra expense is at inference, where the network must run once per sampling step.

04Ejemplo resuelto

Sampling a 2D toy distribution with annealed Langevin dynamics

  1. Create training data from two Gaussian blobs in the plane, centered at (-4, 0) and (4, 0), with standard deviation 0.5, putting 80% of points in the left blob and 20% in the right.

  2. Choose 10 noise levels in a geometric sequence from 5 down to 0.05.

  3. Train a small neural network that takes a point and a noise level and outputs a 2D vector, using the loss that it should predict minus the added noise divided by sigma squared.

  4. Start 1,000 points uniformly at random in the square from -8 to 8 on both axes.

  5. For each noise level from largest to smallest, run 100 Langevin steps: move each point by half the step size times the predicted score, plus Gaussian noise scaled by the square root of the step size.

  6. Plot the final points and count how many end near each blob center.

lo que muestra

The points should form two tight clusters at the blob centers with close to an 80 to 20 split. Running plain Langevin dynamics at only the smallest noise level instead tends to leave points in whichever blob they started near, giving roughly a 50 to 50 split; the 2019 NCSN paper shows this failure to recover the relative weights of separated modes.

Implementación en el mundo real

Song and Ermon's 2019 Noise Conditional Score Network generated CIFAR-10 images with an Inception Score of 8.87, the best reported for unconditional models at the time, without adversarial training.

The 2021 stochastic differential equation framework by Song and colleagues produced the first high-fidelity 1,024 by 1,024 images from a score-based model and reached an FID of 2.20 on CIFAR-10.

Because a trained score model can be combined with a measurement model through Bayes' rule, the same network has been used for image inpainting, colorization, and reconstructing accelerated MRI and sparse-view CT scans.

Denoising Diffusion Probabilistic Models (2020), the approach behind many text-to-image systems, train a network whose objective is a weighted form of score matching, so they belong to the same family.

Consistency Models (Song and colleagues, ICML 2023) distill the score-based sampling path into a network that generates CIFAR-10 images in one step with an FID of 3.55.

El futuro de los modelos generativos basados en puntuaciones

Most current research builds on the 2021 unification and focuses on speed, control and theory. Faster sampling is the biggest thread: Consistency Models (Song, Dhariwal, Chen and Sutskever, ICML 2023) learn to map any point on the probability flow path straight to its endpoint, reporting one-step FIDs of 3.55 on CIFAR-10 and 6.20 on 64 by 64 ImageNet. Other work studies better ODE solvers and distillation of many-step samplers into few-step students. A second thread is scientific and medical inverse problems. Song's 2021 overview describes using unconditional score models as learned priors for accelerated MRI and sparse-view CT reconstruction, with an ICLR 2022 paper on medical imaging; how reliably such priors behave on patients unlike the training data is still an open question for clinical use. Open theoretical questions include why score-based models generalize rather than memorize, how errors in the learned score propagate through long sampling chains, and how to choose noise schedules and loss weightings in a principled way. Extending the framework to discrete data such as text, and to very high-dimensional outputs such as long videos, remains an active area without a settled best approach.

Poniéndolo en práctica

Por qué es importante

  • Velocidad y escala. La IA visual puede automatizar tareas de inspección, detección y etiquetado a escala.
  • Construir opciones. Los equipos creativos pueden crear prototipos de conceptos más rápido y con menos revisiones manuales.
  • Equipo y flujo de trabajo. Las operaciones pueden utilizar señales de imagen y vídeo que antes eran difíciles de procesar.

cuidado con

  • Los derechos de imagen y el consentimiento pueden convertirse en riesgos legales si la procedencia no está clara.
  • El rendimiento del modelo puede variar según la iluminación, la demografía y los entornos.
  • Los falsos positivos pueden pasar desapercibidos a menos que se controlen los umbrales de confianza.

Próximos pasos

  1. Defina criterios de aceptación para costos de precisión, recuperación y error.
  2. Pruebe con datos que coincidan con las condiciones reales de producción.
  3. Agregue revisión humana para predicciones de baja confianza o de alto impacto.
  4. Realice un seguimiento de la deriva del modelo y vuelva a validarlo después de cambios en la cámara o el conjunto de datos.

Fuentes y lecturas adicionales

  1. Journal of Machine Learning ResearchEstimation of Non-Normalized Statistical Models by Score Matching
  2. arXiv (NeurIPS 2019)Generative Modeling by Estimating Gradients of the Data Distribution
  3. arXiv (ICLR 2021)Score-Based Generative Modeling through Stochastic Differential Equations
  4. Yang SongGenerative Modeling by Estimating Gradients of the Data Distribution (blog overview)
  5. arXiv (NeurIPS 2020)Modelos probabilísticos de difusión de eliminación de ruido
  6. arXiv (ICML 2023)Modelos de consistencia

Sigue explorando

Boletín gratuito

Recibe el resumen diario de IA

Tres noticias verificadas sobre IA cada mañana de lunes a viernes, explicadas con claridad. Gratis para siempre y sin anuncios.

Un correo cada día laborable. Date de baja con un clic. Nunca vendemos ni compartimos tu dirección.

Ponte a prueba

Take the Score-Based Generative Models quiz

Corrección inmediata en cada respuesta y un certificado para compartir, con un ID verificable, cuando apruebas un curso.

Empezar el cuestionario

Apoya la educación gratuita sobre IA. AI Understanding es una organización sin fines de lucro 501(c)(3): sin anuncios ni muros de pago, nunca. Hacer una donación

Preguntas frecuentes

¿Qué son los modelos generativos basados en puntuaciones?

Score-based generative models learn the score of a data distribution, the direction in which data becomes more likely at every point, and then generate new samples by starting from random noise and repeatedly stepping along that direction. Introduced by Yang Song and Stefano Ermon in 2019 and unified with diffusion models in 2021, they are the mathematical foundation of modern image, audio and video diffusion systems.

¿Cuál es exactamente la 'puntuación' que aprenden estos modelos?

La puntuación es el gradiente de la densidad de datos logarítmicos con respecto a la entrada: apunta en la dirección que aumenta la probabilidad de una muestra.

¿Por qué los modelos basados en puntuaciones se entrenan con datos corrompidos por el ruido en múltiples escalas?

En las regiones de baja densidad, la puntuación real está mal definida; Los datos perturbadores con varios niveles de ruido hacen que la comparación de puntuaciones sea manejable en todas partes.

¿Qué procedimiento de muestreo utilizaron los primeros modelos basados en puntuaciones para generar datos?

La dinámica de Langevin mueve repetidamente una muestra en la dirección de la partitura e inyecta un pequeño ruido, transformando gradualmente el ruido aleatorio en datos realistas.

¿Qué conexión importante estableció el documento Score-SDE de 2021?

Canción y col. modelos unificados de difusión y basados ​​en puntuaciones bajo un marco de ecuaciones diferenciales estocásticas, con una EDO de flujo de probabilidad determinista coincidente.

¿Cómo se relaciona la predicción del ruido con la predicción de la puntuación en la comparación de puntuaciones de eliminación de ruido?

For additive Gaussian corruption x_t=x_0+σ ε with standardized ε, the conditional score target is −ε/σ. A denoising score network estimates the score of the noisy-data distribution from such training targets; it does not output the individual noise sample or variance.