Diffusion vs Flow Matching vs Optimal Transport
A comprehensive analysis of the differences and similarities between Diffusion, Flow Matching, and Optimal Transport from the perspective of probability distribution dynamics, from loss functions to sampling processes.

The great sculptor Michelangelo once said that every block of marble contains a statue within it, and the task of the artist is simply to chip away the excess. In the era of Artificial Intelligence, Generative Models operate under a similar philosophy. Instead of marble, the computer’s raw material is random noise—meaningless noisy pixels like a television screen with no signal. And the statue that emerges at the end of the process is a masterpiece: sharp, realistic images that are astonishingly lifelike.
But computers do not use hammers and chisels. They use mathematics.
In recent years, the AI world has witnessed the rapid rise of image generation algorithms. You may have heard of Midjourney, DALL-E, or Stable Diffusion. More recently, newer systems such as ChatGPT Images 2.0 or Nano Banana 2 have demonstrated increasingly better image quality and controllability, from full image generation to editing, design, and complex layout construction. Despite differences in implementation, most of these systems share a common foundational idea: modeling the evolution of probability distributions over time. However, behind this idea lie multiple approaches and an ongoing debate among researchers: Should we use Diffusion, Flow Matching, or Optimal Transport? To this day, there is still no definitive answer as to which method is universally superior.
1. Two Ways to Describe Data Evolution: Lagrangian and Eulerian
To understand how computers generate images, we must understand how they move data. Imagine dropping a drop of ink into a glass of water. The process of the ink diffusing (from a well-defined shape into a uniform color) corresponds to adding noise (the forward process). The computer learns to reverse this process: gathering dispersed color from the water to reconstruct the original ink drop (the reverse process).
Professor Gabriel Peyré proposed a beautiful analogy to describe this process through two physical perspectives:
- Lagrangian view (Particles): You pick a single ink particle and follow it. You record its trajectory as it drifts in the water. This corresponds to tracking movement through a vector field.
- Eulerian view (Density): You stand still and observe how the density of the entire ink cloud changes over time at a fixed location. This leads to partial differential equations (PDEs), specifically the continuity equation.
The core problem of generative AI is: There are infinitely many particle trajectories (vector fields) that can produce the same transformation from noise to data. Our task is to find the trajectory that is easiest and most efficient for a neural network to learn.
Two equivalent perspectives of distribution dynamics: Lagrangian tracks individual particle trajectories, while Eulerian observes density evolution over time.
2. Diffusion and Flow Matching: More Similar Than You Think
When Diffusion Models were introduced, they sparked a revolution. They work by decomposing the denoising process into thousands of small iterative steps. The resulting trajectories are typically curved and stochastic.
Later, Flow Matching emerged with an appealing promise: it could produce straight trajectories directly connecting noise to data. For a time, the AI community was divided, debating which approach was superior.
But science often brings unexpected insights. In the paper Diffusion Meets Flow Matching, researchers at Google DeepMind made an important observation: Diffusion and Flow Matching can become equivalent under certain settings, particularly when using Gaussian noise and appropriate weighting schemes in the loss function.
- Loss function equivalence: When choosing a Gaussian path between noise and data and applying time-dependent weighting in Flow Matching, its training objective can be rewritten in a form equivalent to the noise prediction objective in Diffusion.
- Sampling equivalence: When Diffusion is formulated as an ODE (probability flow ODE), Euler sampling in Flow Matching can produce results equivalent to DDIM under certain conditions.
- Misconception about “straight trajectories”: It is often claimed that Flow Matching produces perfectly straight paths. In reality, trajectories are only straight when the model predicts a single exact data point. In practice, due to the complexity of image data space, Flow Matching trajectories are still curved. In some Gaussian noise settings (Variance Preserving), the average trajectory of Diffusion can even be more linear than those learned by Flow Matching.
These two approaches are not fundamentally opposed. Under certain conditions, they describe the same process from different perspectives.
3. Optimal Transport: Finding the Optimal Path for Data
If Diffusion starts from a predefined noise process (typically Gaussian), and Flow Matching learns a vector field based on a predefined path between distributions, then Optimal Transport (OT) takes a different approach: directly finding the optimal path between two distributions.
In 1781, Gaspard Monge, a French mathematician, faced the problem: How can one move soil from a pile to construct a fortress with minimal transportation cost? More than two centuries later, Monge’s earth-moving problem has become a fundamental tool in Machine Learning for measuring and transporting information across distribution spaces.
Unlike Diffusion, which blindly follows a noise schedule, Optimal Transport seeks the shortest and most energy-efficient path. The mathematics of OT (via the Benamou-Brenier formulation) ensures that:
- Data particles move along optimal trajectories (geodesics) in distribution space, in simple cases, these trajectories are nearly linear.
- In the Monge mapping setting, trajectories do not intersect.
Intuitively: Diffusion is like navigating through a foggy forest, where you take small cautious steps and sometimes detour around obstacles (requiring many sampling steps). In contrast, Optimal Transport provides a direct flight path across the forest. With such straight and efficient paths, applying OT to generative AI could enable image generation with very large time steps, addressing the slow sampling issue of current Diffusion models.
However, there is no free lunch. Computing exact OT paths in the high-dimensional space of images (millions of dimensions) is computationally intractable.
Optimal Transport guides samples along optimal trajectories in distribution space, enabling faster convergence and clearer structure with fewer steps compared to Diffusion.
4. OTCS: Using Optimal Transport to Improve Diffusion
What happens if we combine the powerful generative mechanism of Diffusion with the optimality of Optimal Transport? This is the idea behind the OTCS model (Optimal Transport-Guided Conditional Score-Based Diffusion Model).
This work addresses a practical issue. Image-to-image translation models (e.g., converting blurry images to sharp ones, or summer landscapes to winter) often require paired data. The model needs thousands of perfectly aligned image pairs to learn effectively. In reality, such datasets are difficult to obtain.
- OTCS solution: When dealing with unpaired datasets, OTCS uses Optimal Transport to construct a compatibility function (). It acts as a mathematical “matchmaker”: given two sets (e.g., blurry and sharp images), it computes a soft coupling probability indicating which pairs are most compatible.
- Resampling-by-compatibility strategy: Instead of training Diffusion on randomly paired data, OTCS uses the compatibility function to evaluate how well two samples match. High scores indicate structural or semantic similarity, while low scores indicate mismatch. This allows the Diffusion model to learn a more precise mapping from input to output.
Optimal Transport establishes probabilistic correspondences between unpaired datasets, enabling more meaningful mappings instead of random pairing.
By leveraging OT as guidance, the Diffusion model in OTCS produces better results in reported experiments, achieving improved realism (FID) and structural consistency (SSIM) compared to standard Diffusion or earlier GAN-based approaches.
5. Conclusion
Looking back at the history from classical language models (LLMs) to the explosion of Transformers, we observe a consistent trend: the closer mathematics aligns with the nature of reality, the more powerful the model becomes.
The concept of probability flow extends beyond image generation. In one study, Professor Gabriel Peyré showed that training a neural network—or the movement of tokens through dozens of layers in a large Transformer—can be viewed as probability particles evolving under partial differential equations (PDEs) toward energy minimization (Wasserstein Gradient Flows).
From the stochastic chaos of Diffusion, through the structured lens of Flow Matching, to the elegant optimality of Optimal Transport, these models can all be understood as different ways of modeling the motion of probability distributions. This is not merely technique—it is the art of revealing hidden truths within numbers.
And like the invisible “enframing” of technology that Heidegger once warned about, the more we understand how these flows shape data, the greater responsibility we bear in guiding them—not to constrain, but to liberate the boundless creativity of humanity.
Further Reading
Related Articles
Discover more articles related to this topic

Fractal Dimension: Khi chiều không gian vượt thoát khỏi khuôn khổ số nguyên
Khám phá chiều fractal – một khái niệm đột phá trong hình học, vượt ra ngoài khuôn khổ số nguyên để mô tả sự phức tạp của tự nhiên. Bài viết đi sâu vào lịch sử, cơ sở toán học và vô vàn ứng dụng của fractal trong sinh học, vật lý, kinh tế và đặc biệt là khoa học máy tính và AI.

Ngôn Ngữ, Xác Suất và Nhận Thức – phương trình công nghệ trong lịch sử mô hình hóa ngôn ngữ của nhân loại
Khám phá hành trình tiến hóa vĩ đại của mô hình ngôn ngữ, nơi ngôn ngữ, xác suất và nhận thức đan xen trong suốt tiến trình lịch sử công nghệ: từ những mô hình thống kê N-gram giản đơn, đến mạng nơ-ron và RNN, rồi bứt phá với LSTM, Seq2Seq và Attention; từ cuộc cách mạng Transformer mở đường cho BERT, GPT và vô số biến thể, đến kỷ nguyên LLM với khả năng sáng tạo, suy luận, đa phương thức. Đây không chỉ là câu chuyện kỹ thuật, mà còn là bản trường ca triết học về cách máy móc phản chiếu tư duy con người và gợi mở viễn cảnh trí tuệ nhân tạo tổng quát.

MemVerse: Multimodal Memory và con đường hướng tới Lifelong Learning Agents
Phân tích MemVerse – một framework bộ nhớ đa phương thức cho AI Agents học tập suốt đời, kết hợp Knowledge Graph truy xuất và Parametric Memory để giải quyết bài toán catastrophic forgetting, tối ưu suy luận đa phương thức và tương tác dài hạn.

“Kỹ thuật là cách thế phơi lộ”: khi công nghệ định hình tự do của chúng ta
Heidegger từng nói kỹ thuật không chỉ là công cụ trong tay con người, mà là tấm gương định hình cách ta nhìn và sống trong thế giới. Ngày nay, khi trí tuệ nhân tạo bắt đầu can thiệp vào cách ta học hỏi, sáng tạo và ra quyết định, câu hỏi lớn vẫn vang vọng: liệu AI đang giúp chúng ta mở ra những lối đi mới, hay đang âm thầm dựng nên một chiếc lồng vô hình bủa vây tự do và suy tưởng của chính con người?
Discover all 6 articles in our blog