# AIGC Core Principles (Part 2): VAE, GAN, Diffusion & Classic Models Explained

> This article dives deep into AIGC applications, clearly explaining the core algorithms behind Image, Video, Audio, and 3D generation including VAE, GAN, Flow, and Diffusion models. It provides detailed breakdowns of influential models such as VQ-VAE, dVAE, DALL-E, GLIDE, DALL-E 2, ControlNet, along with key technologies like text-to-image, video prediction, audio/music generation, and NeRF for text-to-3D.

- Source: https://www.waytoagi.com/en/kb/learning-path/aigc-composition-principle-part2
- Original (Feishu, Chinese): https://waytoagi.feishu.cn/wiki/KviywVYBkinDr5kc94zc3gVwnnd
- Updated: 2026-12-02

---

> Author: Xiao A, aaronxic, [Zhihu Profile](https://www.zhihu.com/people/aaronxic)
>
> Publication Date: July 8, 2023
>
> Original Article: https://zhuanlan.zhihu.com/p/646219589
![](https://www.waytoagi.com/api/kb-media/Bi6Lb80ZxoDmVFxb2BscbXyxnGd)


# Introduction

Hello everyone, I’m Xiao A. In the previous article [(5) AIGC Architecture Principles (Part 1)](https://ywh1bkansf.feishu.cn/wiki/KmkAwqnXPisrvfkK7RJcK9GqnAf), we introduced the four major categories of generative algorithms: VAE, GAN, Flow Model, and Diffusion Model. Starting from this article, we will dive into specific applications and explore how these four algorithms are applied in Image generation, Video generation, Audio generation, and 3D generation.

PS: Long-read alert! This article is approximately 10,000 words. Follow & bookmark it, then read it on a computer for the best experience~ (^_^)

The outline is as follows, divided into 4 chapters:

- **Image Generation**. Focuses on the VAE series and Diffusion series, with three representative methods selected for each.
  - VAE Series. [VQ-VAE (2017.11)](https://arxiv.org/abs/1711.00937) discretizes the latent space of VAE; [dVAE (2021.02)](https://arxiv.org/abs/2102.12092) improves the stochasticity of VQ-VAE using the Gumbel-Softmax trick; [DALL-E (2021.02)](https://arxiv.org/abs/2102.12092) models *pθ(x|z)* and *pψ(z|y)* separately to accomplish the text-to-image task.
  - Diffusion Series. [GLIDE (2021.12)](https://arxiv.org/abs/2112.10741) fully adopts the classifier-free guidance approach, enabling both text-to-image generation and text-guided image editing; [DALL-E 2](https://arxiv.org/abs/2204.06125) (2022.04) combines GLIDE and DALL-E, pushing performance to a whole new level; [ControlNet (2023.02)](https://arxiv.org/abs/2302.05543) injects various conditions into the Stable Diffusion model through bypass networks and zero convolutions, leading to widespread adoption.

- **Video Generation**. Two works from Google that respectively employ VAE and Diffusion algorithms.
  - VAE Approach. [Phenaki (2022.10)](https://arxiv.org/abs/2210.02399) integrates C-ViViT and MASK-GIT. It uses the former for encoding and decoding, and the latter to perform masked prediction in latent space for forecasting future frames.
  - Diffusion Approach. [Imagen Video (2022.10)](https://arxiv.org/abs/2210.02303) employs a 7-stage cascaded model. It first generates a low-resolution, low-frame-rate initial video, then applies 3 stages of spatial super-resolution and 3 stages of temporal super-resolution to ultimately output approximately 5-second 720P video clips at 24 fps.

- **Audio Generation**.
  - Speech Generation. [AudioLM (2022.09)](https://arxiv.org/abs/2209.03143) draws on SoundStream and w2v-BERT to extract acoustic features and long-term semantic features from raw audio signals. It then uses a 3-stage seq2seq approach to generate high-quality speech audio.
  - Music Generation. [MusicLM (2023.01)](https://arxiv.org/abs/2301.11325) also utilizes SoundStream and w2v-BERT, combined with the MuLan model (often called the CLIP of the audio domain). These three models are jointly trained to accomplish the text-to-music task.

- **3D Generation**. This section first introduces the basic principles of [NeRF (2020.03)](https://arxiv.org/abs/2003.08934), then demonstrates how [DreamFusion (2022.09)](https://arxiv.org/abs/2209.14988) leverages NeRF together with a pretrained text-to-image Diffusion model to achieve text-to-3D generation.

# Image Generation

Let’s start with the most widely adopted image generation task. This task appeals to audiences of all ages and is a flagship application in the toC space. For example, Midjourney, which went viral not long ago, and the recently explosive Miaoya Camera in China, both rely on image generation technology behind the scenes.

Many of you probably still remember the painting *Space Opera Theater*. It was the first AI-generated image to defeat human contestants and win the top prize in the digital art category at an art exhibition. The killer application behind it was Midjourney. Previously, Little A also used ChatGPT and Midjourney to experience what it’s like to be an illustrator. Interested readers can check out [“AI Illustrator Experience Notes”](https://zhuanlan.zhihu.com/p/627492190).

![](https://www.waytoagi.com/api/kb-media/DQLdb1ODloe8xLxw90xcuSZunV6)

This section focuses on the VAE family and the Diffusion family, selecting three representative methods from each:

- VAE series: VQ-VAE, dVAE, and DALL·E
- Diffusion series: GLIDE, DALL·E 2, and ControlNet

## **VQ-VAE**

From the previous article [(5) AIGC Architecture Principles (Part 1)](https://ywh1bkansf.feishu.cn/wiki/KmkAwqnXPisrvfkK7RJcK9GqnAf), we know that the latent space **z** of a standard VAE follows a continuous multivariate Gaussian distribution. VQ-VAE discretizes this space. Its network architecture is similar to U-Net, as shown below:

![](https://www.waytoagi.com/api/kb-media/MkvFbS0fvoGbLKxsv38cf6vknre)

- **Step 1**: The input image is passed through an encoder and downsampled to \( z_e(x) \in \mathbb{R}^{\sqrt{N} \times \sqrt{N} \times D} = \mathbb{R}^{N \times D} \). For the ImageNet dataset, for example, \( z_e(x) \in \mathbb{R}^{32 \times 32 \times D} = \mathbb{R}^{1024 \times D} \). Each grid point on the feature map is \( z_e^{(i)}(x) \in \mathbb{R}^D \).

- **Step 2**: A learnable codebook \( e \in \mathbb{R}^{K \times D} \) of size K is defined, where each codeword \( e_i \in \mathbb{R}^D \).

- **Step 3**: For each grid point \( z_e^{(i)}(x) \) in \( z_e(x) \), find the nearest codeword \( e_k \) in the codebook \( e \), and replace \( z_e^{(i)}(x) \) with it. The result is \( z_q(x) \).

- **Step 4**: \( z_q(x) \) is passed through a decoder and upsampled to output the reconstructed image.

Essentially, this process clusters \( z_e(x) \) into discrete class centers and replaces each point with its nearest center. The final loss function is:

\[ L = \log p(x|z_q(x)) + ||\text{sg}[z_e(x)] - e||_2^2 + \beta ||z_e(x) - \text{sg}[e]||_2^2 \]

- The first term is the standard reconstruction error (maximum likelihood term). It provides gradients to both the encoder and decoder. Since Step 3 is non-differentiable, the Straight-Through Estimator (STE) method is typically used so that the reconstruction gradient can flow back to the encoder.

- The second and third terms are regularization terms. They constrain the distance to the class centers and are split into two parts: the first updates the codebook (i.e., the class centers), while the second updates the encoder output. Here, `sg` stands for stop-gradient.

After training is complete, the encoder is discarded. To model the joint distribution \( p(z_q(x)) = p(z_q^{(1)}(x), z_q^{(2)}(x), \cdots, z_q^{(N)}(x)) \), PixelCNN is used. In simple terms, it predicts codewords one by one from left to right and top to bottom, similar to the autoregressive process in RNNs. The network can be implemented with LSTM or with CNNs that use specific masking.

**dVAE**

dVAE is an attempt to solve two problems that exist in VQ-VAE:

- The sampling randomness is not strong enough, making it unfriendly for generation tasks.
- The use of **Straight-Through Estimator (STE)** for gradient approximation is not sufficiently accurate.

The solution approach is as follows:

- The output of the Step 1 encoder in VQ-VAE is changed from a discrete index to **z(x) ∈ ℝ^{N×K}**. After applying softmax, we obtain **p(z) ∈ ℝ^{N×K}**, which represents the probability distribution of each grid position **z⁽ⁱ⁾ ∈ ℝᴷ** over the K codebook entries (this feels a bit like the mechanism in attention, doesn’t it?).

- To introduce randomness, **Gumbel-Softmax trick** is used on **p(z)** to perform stochastic sampling from a categorical distribution.

![](https://www.waytoagi.com/api/kb-media/L3KFbKeBeoHeNXx9PaecvaNgn3g)

**Gumbel-Softmax Trick**

Similar to the reparameterization trick used in Gaussian distributions, Gumbel-Softmax is also a form of reparameterization. It specifically addresses the problem of stochastic sampling from a categorical distribution. Its input and output are as follows:

**Input:** A probability vector for multi-class classification **π = [π₁, π₂, ⋯, πₖ]**, where

πᵢ = eˣⁱ / Σⱼ₌₁ᴷ eˣʲ

**Output:** A one-hot vector **z** sampled according to the probability vector **π**, for example [1, 0, 0, ..., 0] or [0, 1, 0, ..., 0], etc.

The derivation process of Gumbel-Softmax is omitted here. We mainly introduce the method and its conclusion:

\begin{align}
z &= \text{one\_hot}(\arg\max_i[g_i + \log \pi_i]) \\
g_i &= -\log(-\log(u_i)), \quad u_i \sim \mathcal{U}(0, 1)
\end{align}

Since **argmax** is non-differentiable, it is typically replaced by a softmax with a temperature coefficient, as shown below:

zᵢ = exp[(gᵢ + log πᵢ)/τ] / Σⱼ₌₁ᴷ exp[(gⱼ + log πⱼ)/τ]

The PyTorch pseudocode is as follows:

**DALL-E**

The name DALL-E comes from the combination of “WALL-E” and “Salvador Dalí.” The former is the Pixar animated character, while the latter is the surrealist painter, whose representative work *The Persistence of Memory* is shown on the right.

![](https://www.waytoagi.com/api/kb-media/VNQCbuMzKoQUT7xhmImcf8Urnaf)

DALL-E primarily accomplishes the task of text-to-image generation. Let the image be \( x \), the text be \( y \), and the image latent space be \( z \). The goal is to model the distribution of images conditioned on the given text:

$$
p_{\theta, \psi}(x|y)=p_{\theta, \psi}(x, z|y)=p_\theta(x|z, y)p_\psi(z|y) =p_\theta(x|z)p_\psi(z|y)
$$

**Derivation Hints**

- \( y \) and \( z \) have a one-to-one correspondence, therefore \( p_{\theta, \psi}(x|y)=p_{\theta, \psi}(x, z|y) \).

- Image generation depends only on \( z \) and is independent of \( y \), so \( p_\theta(x|z, y)=p_\theta(x|z) \).

This means the key is to obtain \( p_\theta(x|z) \) and \( p_\psi(z|y) \), which exactly correspond to the two training stages of the algorithm.

![](https://www.waytoagi.com/api/kb-media/FVNAbfBpxovpw5xuwy2c15cnnRb)

- **Stage 1**: Train a discrete VAE (dVAE) using an unlabeled pure-image dataset. This produces an image encoder, a discrete codebook, and an image decoder \( p_\theta(x|z) \). Each image is encoded into 1024 tokens, with a codebook size of 8192.

- **Stage 2**: Train a Transformer to model \( p_\psi(z|y) \) using image-text paired data.
  - Apply BPE encoding to the text to obtain \( y \).
  - Pass the image through the dVAE encoder to obtain \( z \).
  - Concatenate \( y \) and \( z \), and train a decoder-only Transformer to learn \( p_\psi(z|y) \).

During inference, CLIP is also used to score the generated images against the text prompt. The images are ranked by score, and the one with the highest text-image alignment is selected as the final output (if you are not familiar with CLIP, you can refer back to the earlier article in this series: [*The Road to Multimodal Unification*](https://zhuanlan.zhihu.com/p/643969218)).

## **GLIDE**

GLIDE is built on guidance-free diffusion and consists of three main contributions:

- CLIP-guided text-to-image generation
- CLIP-guidance-free text-to-image generation (by dropping 20% of text)
- Text-prompt-based image editing

**CLIP-Guided Text-to-Image**

For the text-to-image task, CLIP guidance is introduced. The CLIP model used is a noise-robust version called noisy-CLIP.

Given a noisy image and text description pair \( (x_t, c) \), they are fed into CLIP’s image encoder and text encoder respectively. A contrastive loss is used as the supervisory signal. \( \mu_\theta(x_t|c) \) and \( \Sigma_\theta(x_t|c) \) are the mean and variance predicted by the network.

$$
\hat{\mu}_\theta(x_t|c)=\mu_\theta(x_t|c) + s\cdot \Sigma_\theta(x_t|c)\nabla_{x_t}(f(x_t)\cdot g(c))
$$

The text encoder outputs a feature sequence of length \( K \), which serves two purposes:

- The output corresponding to the final `EOS token` is used as the global text feature, replacing the original class embedding injected into the network.
- The full \( K \)-length text features are injected into the attention layers at intermediate stages of the network.

**CLIP-Guidance-Free Text-to-Image**

The model from the first stage is further fine-tuned in a guidance-free manner. Specifically, 20% of the text data is randomly dropped and replaced with an empty sequence, allowing the network to learn the conditional distribution directly.

**Text-Prompt-Based Image Editing**

The first-stage model is fine-tuned for text-conditioned image editing. The input is expanded to 4 channels: 3 RGB channels plus 1 mask channel. During training, a random region is masked, and the model is given a text description. It is required to generate the pixels inside the masked region from a noisy input.

Example results for the three settings are shown below:

![](https://www.waytoagi.com/api/kb-media/F48Tb7Ng8oPMwSxZg7kcTwY1noe)

**DALL-E 2**

Also known as unCLIP, because CLIP converts images into features, while DALL-E 2 converts features back into images. DALL-E 2 can essentially be viewed as a combination of DALL-E and GLIDE.

![](https://www.waytoagi.com/api/kb-media/Ou9GbqUTMoPNcPxoTC9cT4B4nRh)

The problem is modeled in a straightforward way. Like DALL-E, it is a two-stage approach:

- **Stage 1**: The prior process that generates a CLIP image embedding from a caption. This can be done either using the autoregressive method from DALL-E or with a separate diffusion model.

- **Stage 2**: A diffusion decoder that generates an image from the CLIP image embedding. This process has strong stochasticity, resulting in significantly better diversity than the dVAE used in DALL-E.

First, let’s look at the training of the Stage 2 Decoder.

- It is essentially a Diffusion model, with details borrowed from GLIDE. At each timestep, the CLIP text embedding is concatenated after the timestamp embedding. The CLIP text embedding represents the global information of the text.

- Similar to GLIDE, the original caption token sequence is also fed into the attention layers to supplement linguistic information that the CLIP text embedding might have missed. However, the improvement was found to be marginal.

- To generate high-resolution images, two upsample diffusion models were trained: one upscaling from 64×64 to 256×256, and another from 256×256 to 1024×1024.

- A guidance-free training strategy was used: with 10% probability the CLIP text embedding is randomly dropped, and with 50% probability the caption input is randomly dropped.

Next is the training of the Stage 1 Prior.

- **Method 1: Autoregressive (AR) approach**
  - Very similar to DALL-E’s idea, using a decoder-only network for sequence prediction.
  - The original caption sequence and CLIP text embedding come first, followed immediately by the CLIP image embedding.
  - DALL-E 2 also experimented with inserting the quantized similarity value $z_i \cdot z_t$ (between image and text) before the image sequence, which was found to improve performance.
  - Since the original CLIP image embedding is 1024-dimensional, the authors applied PCA to reduce its dimensionality to one-third, resulting in 319 dimensions.

- **Method 2: Diffusion approach**
  - Also uses a decoder-only network for sequence prediction.
  - The input concatenation order is: original caption sequence, CLIP text embedding, timestamp embedding, noised CLIP image embedding (equivalent to $z_t$), and unnoised CLIP image embedding (equivalent to $z_{t-1}$). The unnoised CLIP image embedding serves as the target output position.
  - A UNet is not used here because the output token position for the unnoised CLIP image embedding must be preserved. With a UNet, the output would be produced directly.
  - The model $f_\theta(z_i^{(t)}, t, y)$ directly predicts $z_i$ instead of predicting the noise $\epsilon$.
  - Mean squared error (MSE) is used as the loss function, expressed as:

$$
L_{\text{prior}}=\mathbb{E}_{t \sim [1, T], z_i^{(t)}\sim q_t}[||f_\theta(z_i^{(t)}, t, y)-z_i||^2]
$$

An interesting application is performing interpolation at the level of image prompt embeddings to generate smooth transitional images, or interpolating at the text embedding level.

![](https://www.waytoagi.com/api/kb-media/Hnd5b66YKozCR7x8fBmc6Lj9n0f)

**Limitations**

- The main issues stem from the CLIP model itself, making it difficult to capture abstract concepts such as spatial position, size, and relationships.

- Text generation within images is also unsatisfactory.

![](https://www.waytoagi.com/api/kb-media/HUM4bFT4BoNorIxw2TmchDdnn3b)

**ControlNet**

ControlNet is built upon the Stable Diffusion (SD) network and supports a variety of conditioning formats, such as Canny Edge and User Sketching. First, let’s briefly introduce the SD network.

**Stable Diffusion**

- It shifts the pixel space commonly used in Diffusion Models (DM) to latent space, which significantly reduces computational cost and improves training efficiency.
- It introduces various conditional inputs through the transformer’s cross-attention mechanism.
- The ε network is responsible for downsampling the original image and mapping it to a 64×64 latent space, while the D network maps the latent features back to pixel space.

![](https://www.waytoagi.com/api/kb-media/TW8ZbqPHgo1O4tx17s0cFXRinlb)

**ControlBlock Design**

- The block design follows the zero-convolution principle: the original SD network is frozen, and a bypass is added to learn residuals. This bypass is wrapped by 1×1 convolutions initialized to zero at both ends and accepts new conditional inputs.
- Although W and b are initialized to 0, the gradients with respect to W and b are not zero because the input to the convolution layer is non-zero. Therefore, the model parameters can receive gradient updates normally.

![](https://www.waytoagi.com/api/kb-media/BKZGbY0sToQgsLxF403cKzvsnRe)

**ControlNet Design**

- ControlNet takes as input the current timestep t encoding, the noisy image z_t, the text prompt c_t, and the conditional input c_f. It ultimately outputs ε_θ, which is then used with the DDPM mean formula to compute μ_θ and passed to the next timestep t+1.
- The original image is 512×512. After being downsampled by a factor of 8 in the input layer, it becomes 64×64, which matches the size of the latent features used in the original SD model.
- ControlNet itself does not include a decoder for upsampling. After each stage’s zero convolution, the residual is added back into the corresponding resolution level of the decoder network.
- The entire network can be understood as multiple ControlNets sequentially added onto the SD model at matching resolutions.
- Compared to the original SD network, the decoder part is removed and several new convolutional layers are added. The frozen part of SD incurs almost no extra GPU memory cost for gradients. Overall, memory consumption and training time only increase by 23% and 34% respectively.

![](https://www.waytoagi.com/api/kb-media/Zy5RbrEv4oHzfrxHoB3cMwpAnG6)

**Training Process**

- A pretrained original SD model is required. It is then frozen, and only the newly added ControlNet components are fine-tuned on a conditional dataset.
- Guidance-free training is introduced by randomly dropping the text prompt with 50% probability. The goal is to make the network focus more on the condition input.
- As mentioned earlier, ControlNet takes as input the current timestep t encoding, the noisy image z_t, the text prompt c_t, and the conditional input c_f, and outputs the noise prediction ε_θ. The overall training loss is as follows:

L = \mathbb{E}_{z_0, t, c_t, c_f, \epsilon \sim \mathcal{N}(0, 1)}[||\epsilon - \epsilon_\theta(z_t, t, c_t, c_f)||^2_2]

![](https://www.waytoagi.com/api/kb-media/ZIwPb2TT5ojpGLxlluecxuhEn0g)

## **Summary**

This section introduced the VAE series and the Diffusion series, covering the following main methods:

> 📊 This is an embedded Feishu content (table/whiteboard, etc.). [View the full version in the Feishu knowledge base](https://waytoagi.feishu.cn/wiki/KviywVYBkinDr5kc94zc3gVwnnd)

# Video Generation

Many techniques in video generation originate from image generation. This section introduces two works from Google: Phenaki and Imagen Video, which respectively utilize VAE and Diffusion-based generation techniques.

## **Phenaki**

- A video generation method from Google Brain that can generate videos of variable lengths from text descriptions.

- It primarily relies on two key capabilities:
  - Video pixel generation capability, based on VQ-VAE and mainly drawing from the C-ViViT method.
  - Latent space token prediction capability, based on an encoder-only bidirectional Transformer’s cloze-style (masked) prediction ability, primarily inspired by the MaskGIT method.

![](https://www.waytoagi.com/api/kb-media/DadibYML0oFRduxVvVkcPt0LnYf)

**C-ViViT**

The first training stage follows the approach of ViViT, primarily using VQ-VAE to train the encoder, codebook, and decoder.

![](https://www.waytoagi.com/api/kb-media/NAOIbJh1qoYyrIxyWVeczF0UnAN)

- Attention is performed first spatially, then temporally.

- When C-ViViT performs patch partitioning, it first stacks 1 + t_x frames together to form an input of shape x ∈ ℝ^( (1+t_x) × c_x × h_x × w_x ).

- It performs non-overlapping temporal and spatial partitioning. For each patch in the temporal dimension, the first frame contains only one frame, while the remaining strides contain t_p consecutive frames. Therefore, the first frame’s patch size is c_x × h_p × w_p, while the size of the remaining patches is (t_p × c_x) × h_p × w_p. After passing through a linear projection layer, they are uniformly transformed into features of length d_z.

- The total number of tokens obtained is (1 + t_x / t_p) × (h_x / h_p) × (w_x / w_p). Note that video vision tasks have much longer sequences than LLMs because each frame contains a large number of patches (e.g., 256 or 512).

- C-ViViT removes both the spatial and temporal `CLS tokens` and adds a causal Transformer decoder-only mask. This allows the generation of z sequences of arbitrary length without causing computational complexity to explode.

- The C-ViViT decoder is designed in the opposite order to the encoder: it first performs temporal attention, then spatial attention. Training uses the VQ-VAE reconstruction objective. Once training is complete, a discrete codebook is obtained. Input videos are converted by the encoder into discrete codebook vectors, which are then passed through the decoder to reconstruct pixel-level videos.

- In addition to the reconstruction loss L_VQ, the training loss also includes per-pixel L2 loss L_2, image perceptual loss L_IP, video perceptual loss L_VP, and the adversarial loss L_Adv from StyleGAN.

L_{VQ}=||\text{sg}(\mathbf{z})-\mathbf{e}||^2_2+\beta||\mathbf{z}-\text{sg}(\mathbf{e})||^2_2

L=L_\text{VQ}+1.0 \cdot L_2+0.1\cdot L_\text{IP} + 1.0 \cdot L_\text{VP} +0.1\cdot L_{Adv}

**Bidirectional Transformer**

The second training stage follows the MaskGIT approach, enabling the model to predict latent space tokens for unknown frames.

![](https://www.waytoagi.com/api/kb-media/N7mpbGPtToRemXxA9j0cmvdvnhe)

- It is essentially a seq2seq task that generates video tokens from text prompt tokens, trained unsupervised via a mask-and-predict method.

- It takes the output of the C-ViViT encoder and passes it through a bidirectional full-attention Transformer to perform the mask-and-predict task.

- It does not use a decoder-only autoregressive approach, because that would only allow serial execution. Since the number of visual tokens per video frame is much larger than in LLMs, even with caching, sampling time still grows linearly, resulting in slower inference.

- Training and inference use a consistent mask sampling strategy, adapted from MaskGIT.
  - Step 1: At the beginning, set all input tokens to `MASK token`
  - Step 2: Pass the input through the Transformer to obtain output tokens
  - Step 3: For all output tokens, compute the cosine distance to the nearest vector in the codebook and treat these distances as confidence scores. Sort the tokens from highest to lowest confidence.
  - Step 4: Keep the top βᵢ proportion of tokens and re-mask the rest
  - Step 5: Repeat Step 2–4, gradually increasing βᵢ from 0 to 1 until completion

- MaskGIT sampling reduces the total number of sampling steps by an order of magnitude compared to the original autoregressive approach — from several hundred steps down to around 20.

- During this training stage, massive image-text data can also be incorporated. When masking, only the first frame needs to be masked. If one relies solely on video-text description data, the dataset may not be large enough to learn certain concepts, such as pencil drawings.

**Long Video Inference**

The inference stage can generate long videos that may contain one or multiple text prompts. The process is as follows:

![](https://www.waytoagi.com/api/kb-media/GBSSbAgLnownIQxKt6jcbh3RnTe)

- **Cold Start**: Begin with all `MASK tokens`. Under the guidance of the 1st prompt, generate the first video segment using the MaskGIT sampling strategy.

- **Shift Time**: Take the last K frames of the previous segment, encode them with the C-ViViT encoder to obtain their codebook indices.

- **MaskGIT**: Set the remaining video tokens of the current segment to `MASK token`. Under the guidance of the Next Prompt, perform MaskGIT sampling to fill in the masked tokens and generate the second video segment.

- Repeat the **Shift Time** and **MaskGIT** steps until the video is complete.

**Imagen Video**

Its sister model is Imagen, which is used for image generation. This article focuses on Imagen Video for video generation. The overall architecture is shown below. Apart from the T5 text feature extraction network, there are a total of 7 independently trained Diffusion Models (DMs).

![](https://www.waytoagi.com/api/kb-media/QN3JblwdLo4wfGxnZf0cnDPDnec)

- The Base network generates an initial output of shape `#frames × h × w = 16 × 40 × 24`. It then progressively upsamples through Temporal Super Resolution (TSR) and Spatial Super Resolution (SSR), ultimately producing approximately 5-second 720p video clips at 24 fps.

- For each DM, diffusion is performed simultaneously across all video frames rather than frame by frame.

- Similar to Phenaki, the model first performs spatial information aggregation per frame, followed by temporal information aggregation across multiple frames.
  - The spatial aggregation includes both convolution and transformer attention operations. At lower resolutions, both are used together. At higher resolutions, only convolution is used to save GPU memory.
  - Temporal aggregation uses only convolution operations, because transformer attention consumes significantly more memory without providing noticeable benefits.

![](https://www.waytoagi.com/api/kb-media/H7MSbWv5IojwUIxxcHccOz2Ln1f)

- For TSR and SSR models, the input consists of the noisy latent `z_t` concatenated with the output video from the previous stage. For TSR (temporal expansion), duplicated frames from the previous stage are concatenated; for SSR (spatial expansion), resized frames are concatenated.

- Training used a private dataset of 14M image-video pairs, 60M image-text pairs, and the public LAION-400M image-text dataset.

Imagen Video introduces three particularly important training techniques:

**v-prediction Objective**

The original DDPM and DDIM both use ε-prediction, i.e., using `ε_θ(x_t, t)` to predict the noise `ε`, and then solving for the next step according to different sampling algorithms.

```math
\begin{align}
\text{DDPM: } x_{t-1} &= \mathcal{N}\left(x_{t-1};\frac{1}{\sqrt{\alpha_t}} \left(x_t-\frac{1-\alpha_t}{\sqrt{1-\bar{\alpha}_t}} \epsilon_\theta(x_t,t)\right), \beta_t\right) \\
\text{DDIM: } x_{t-1} &= \sqrt{\bar{\alpha}_{t-1}}\left(\frac{x_t-\sqrt{1-\bar{\alpha}_t} \cdot \epsilon_\theta(x_t,t)}{\sqrt{\bar{\alpha}_t}}\right) + \sqrt{1-\bar{\alpha}_{t-1}} \cdot \epsilon_\theta(x_t,t)
\end{align}
```

v-prediction comes from [this paper](https://www.notion.so/imagen-be64c4326d0246da965679de8295a273?pvs=21). It attempts to predict `v` using `v_θ(x_t, t)`, where

```math
v = \sqrt{\bar{\alpha}_t} \epsilon - \sqrt{1 - \bar{\alpha}_t} x_0
```

The authors found that v-prediction produces significantly better details than ε-prediction.

![](https://www.waytoagi.com/api/kb-media/YlO8bm5X0oBqaBxxj7DcBREZnyf)

**Classifier-Free Guidance**

During training, the text prompt condition is randomly replaced with a null condition `c = ∅` with a fixed probability. During inference, the following formula is used:

```math
\hat{v}_\theta(z_t, c) = (1 + w) \cdot v_\theta(z_t, c) - w \cdot v_\theta(z_t, c = \varnothing)
```

**Conditioning Augmentation**

For cascaded diffusion models, conditioning augmentation is very important. It improves the robustness of each super-resolution model, allowing the entire cascade to align better and generalize more effectively.

Specifically, during training, Gaussian noise with a certain signal-to-noise ratio (SNR) is added to the conditioning video. During inference, noise with an SNR of 3–5 is also added. In practice, this significantly reduces artifacts.

# Audio Generation

Audio generation is generally divided into speech generation and music generation. In this section, we introduce two papers from Google: AudioLM and MusicLM, which have achieved impressive results in speech generation and music generation respectively.

**AudioLM**

AudioLM draws on two methods—SoundStream and w2v-BERT—to extract features from raw audio signals.

- SoundStream is used to extract acoustic features, producing **acoustic tokens** that enable high-fidelity audio reconstruction.
- w2v-BERT is used to extract long-term semantic features, producing **semantic tokens** that ensure long-range semantic coherence.

![](https://www.waytoagi.com/api/kb-media/K2SLbh1c9o84ZRxaf88cNjpTnAf)

Raw audio is a one-dimensional discrete signal with a fixed sampling rate (e.g., 16 kHz). Its sequence length is extremely long—much longer than typical LLM context lengths—so downsampling is essential. AudioLM employs SoundStream as its encoder. The following section briefly explains how SoundStream achieves highly efficient compression.

**SoundStream**

SoundStream aims to achieve the lowest possible bitrate while preserving reconstruction quality, thereby reducing transmission bandwidth. Its network architecture is shown below:

![](https://www.waytoagi.com/api/kb-media/YXKLbzqdLoGYvvxqF8pcQAMXnOc)

- It adopts a training approach similar to VQ-GAN: on top of a VQ-VAE, a Discriminator is added to perform real/fake classification.
- The raw audio input is a 1D signal. Both the encoder and decoder use 1D convolutions with downsampling strides of (2, 4, 5, 8). The resulting output length is 1/320 of the original. Thus, a 24 kHz audio signal is mapped to a latent feature at 75 Hz.

Next, we consider how to encode this 75 Hz latent representation:

- If the target bitrate is 6000 bps, each frame can be allocated 80 bits, which can represent 2^80 discrete values. However, this would require storing a codebook of size 2^80.
- To address this, a residual quantization scheme is used: N_q quantization layers are employed, each quantizing the residual of the previous layer. For example, when N_q = 8, each codebook only needs to be of size 2^(80/8) = 2^10 = 1024. The encoding process is illustrated below.
- This reduces the total codebook size to 8 × 1024 = 8192, at the cost of increased computational complexity (trading time for space).

![](https://www.waytoagi.com/api/kb-media/BYrJbXfK3oV1fZxJ43gcA6dHnx8)

**w2v-BERT**

The w2v-BERT network can be understood as a feature extractor that generates long-term semantic features with a downsampling factor of 1/640. It is trained in a fully unsupervised manner, incorporating objectives similar to contrastive loss and masked language modeling loss from multimodal learning. The final output is a rich semantic feature representation. We will not expand on the training details here.

![](https://www.waytoagi.com/api/kb-media/I5SybWkdYo6FQsxghkHc3OYhnfe)

**Three-Stage Training**

From the above, we can derive the following:

- SoundStream produces acoustic feature sequences downsampled by a factor of 1/320. For a 16 kHz input, the output frame rate is T_A = T/320 = 50 Hz. Using Q = 4 quantization layers, each with a codebook size of N = 1024, the resulting bitrate is T_A · Q · log₂N = 50 × 4 × 10 = 2000 bps.

- Therefore, the acoustic tokens have shape Y ∈ {1, ..., N}^{T_A × Q}. When flattened, they can be written as:  
  y = (y₁¹, ..., y₁^Q, y₂¹, ..., y₂^Q, ..., y_{T_A}¹, ..., y_{T_A}^Q),  
  where each y_i^j ∈ {1, ..., N}.

- w2v-BERT produces long-term semantic features downsampled by a factor of 1/640. For a 16 kHz input, the output frame rate is T_S = T/640 = 25 Hz. AudioLM applies k-means clustering (K = 1024) to these features, resulting in a bitrate of T_S · log₂K = 25 × 10 = 250 bps.

- Thus, the semantic tokens are z = (z₁, ..., z_{T_S}) ∈ {1, ..., K}^{T_S}.

With acoustic tokens and semantic tokens in place, AudioLM undergoes 3-stage training.

![](https://www.waytoagi.com/api/kb-media/Nw83bLkH7oth1UxYV70cQfubnHc)

- Stage 1: Semantic Modeling. Invoke the w2v-BERT network to obtain the semantic sequence **z** = (z₁, ..., z_{T_S}).

- Stage 2: Coarse Acoustic Modeling. Select one quantizer **Q'** from **Q**, and attempt to reconstruct the first **Q'** levels of the acoustic sequence from **z** using a decoder-only network. That is, the network learns the following sequence **y'**:

  **y'** = (z₁, ..., z_{T_S}, y₁¹, ..., y₁^{Q'}, y₂¹, ..., y₂^{Q'}, ..., y_{T_A}¹, ..., y_{T_A}^{Q'})

- Stage 3: Fine Acoustic Modeling. Based on the first **Q'** levels of the acoustic sequence, attempt to recover the acoustic tokens from level **Q'+1** to **Q** using another decoder-only network. That is, the network learns the following sequence **y''**:

  **y''** = (y₁¹, ..., y₁^{Q'}, y₁^{Q'+1}, ..., y₁^Q, ..., y_{T_A}¹, ..., y_{T_A}^{Q'}, y_{T_A}^{Q'+1}, ..., y_{T_A}^Q)

After training, AudioLM supports multiple usage modes. One of the most practical is **continuation**: given a segment of speech audio, let AudioLM continue it. The steps are as follows:

- Obtain acoustic tokens through the SoundStream encoder.
- Predict the complete **Q**-level semantic tokens from the acoustic tokens.
- Map the semantic tokens back to the audio space using the SoundStream decoder.

## **MusicLM**

The DALL·E 2 of the music generation world. Its model architecture and training process are shown below.

![](https://www.waytoagi.com/api/kb-media/DUgcbbq4dof807xqgWvc0pFVngb)

- It consists of three independent models: SoundStream, w2v-BERT, and MuLan. These three models are pre-trained independently.

- SoundStream and w2v-BERT have already been introduced in AudioLM. They are used to encode acoustic features and long-term semantic features, respectively.

- MuLan is essentially the audio-domain equivalent of CLIP. It is trained in a self-supervised manner using paired audio and text, so that MuLan text embeddings and MuLan audio embeddings lie in the same feature space.

- The three models are then chained together for further pre-training on audio-only data. Specifically:
  - Audio is passed through MuLan to obtain the MuLan audio embedding.
  - The MuLan audio embedding is used in a decoder-only autoregressive model to predict w2v-BERT semantic tokens.
  - The MuLan audio embedding together with the semantic tokens are then used to predict acoustic tokens. As in AudioLM, this is divided into coarse and refine stages. The ground-truth acoustic tokens come directly from SoundStream’s encoding of the original audio.

- Finally, the three models are connected for inference:
  - Given lyrics as text input, MuLan is used to extract the MuLan text embedding.
  - Since MuLan text embeddings and MuLan audio embeddings already reside in the same feature space, the model trained in the audio-only stage can directly take the MuLan text embedding as input to generate semantic tokens.
  - The audio-only trained model is called again to generate acoustic tokens.
  - The acoustic tokens are fed into the SoundStream decoder to reconstruct the final audio.

# 3D Generation

In my personal opinion, 3D generation is significantly more challenging than video or audio generation. First, there are many different ways to represent 3D data, primarily divided into Euclidean and non-Euclidean approaches.

- **Euclidean methods** refer to representations that have a global coordinate system and an underlying grid structure, making it relatively easy to transfer 2D deep learning techniques.
  - **Voxel Grid**: A 3D spatial grid that can directly utilize convolutional neural networks.
  - **Multi-view Images**: 3D capture is expensive, so data is typically collected as the same object from multiple viewpoints.

- **Non-Euclidean methods** lack a global coordinate system and grid structure, making it much harder to transfer 2D deep learning techniques.
  - **Meshes**: Represented using polygons such as triangular faces; can be processed with graph neural networks.
  - **Point Clouds**: Discrete 3D coordinate points, which can be handled using PointNet.
  - **Neural Fields**: Fully or partially represented by neural networks. Inference is very fast, but training is extremely slow, and they do not handle complex lighting scenes well.

This section focuses primarily on Neural Field representations. We will begin with the groundbreaking NeRF algorithm.

**NeRF**

![](https://www.waytoagi.com/api/kb-media/EzWobrv7todWn2xkqBAcijWhnAh)

NeRF attempts to represent 3D objects using neural networks. We begin with the inference stage:

- From a 3D position $\mathbf{x}=(x,y,z)$, we obtain the density function $\sigma(\mathbf{x})$, which represents the probability density that a ray is blocked at that point.

- From the 3D position $\mathbf{x}$ and the viewing ray direction $\mathbf{d}=(\theta, \phi)$, we obtain the RGB color $\mathbf{c}(\mathbf{x}, \mathbf{d})$ at that location.

These two mappings are combined into the following function and learned using an MLP network:

$$
\text{F}_\Theta:(\mathbf{x}, \mathbf{d})=(x,y,z,\theta,\phi) \rightarrow (\mathbf{c}, \sigma)
$$

Once we have this function, for any given viewpoint in the same scene, we simulate the pixel generation process as follows:

- For a specific pixel $(u, v)$, using the camera’s extrinsic and intrinsic parameters, we can map it to a ray $\mathbf{d}$ in space that passes through the camera center $\mathbf{o}$. Any point $\mathbf{x}$ along this ray can be expressed by the equation $\mathbf{r}(t) = \mathbf{o} + t \cdot \mathbf{d}$.

- The RGB value of any point along the ray can be computed using the following formula:

$$
C(\mathbf{r})=\int_{t_n}^{t_f} [T(t)\cdot\sigma(\mathbf{r}(t))\cdot\mathbf{c}(\mathbf{r}(t), \mathbf{d})]\,dt, \quad \text{where } T(t)=\exp\left(-\int_{t_n}^{t}\sigma(\mathbf{r}(s))\,ds\right)
$$

In the formula:

- The integral is taken from the near bound $t_n$ to the far bound $t_f$.

- The volume density function $\sigma(\mathbf{r}(t))$ has been introduced earlier. It is determined by the position $\mathbf{r}(t)$ and represents the probability density that the ray is blocked at that point.

- The color function $\mathbf{c}(\mathbf{r}(t), \mathbf{d})$ is also defined earlier. It is jointly determined by the position $\mathbf{r}(t)$ and the viewing direction $\mathbf{d}$.

- $T(t)$ can be interpreted as the accumulated transmittance from the near plane to the current position — that is, the probability that the ray has not hit any object from $t_n$ up to the current $t$.

Since continuous integration cannot be computed numerically, it is discretized into a summation. First, we define the sampling points as follows: uniformly divide the interval from $t_n$ to $t_f$, then randomly sample one point within each sub-interval:

$$
t_i \sim \mathcal{U}\left[t_n + \frac{i-1}{N}(t_f-t_n), \, t_n + \frac{i}{N}(t_f-t_n)\right]
$$

Substituting into the formula yields:

$$
\hat{C}(\mathbf{r})=\sum_{i=1}^N T_i \left(1-\exp(-\sigma_i \delta_i)\right) \mathbf{c}_i, \quad \text{where } T_i=\exp\left(-\sum_{j=1}^{i-1}\sigma_j \delta_j\right)
$$

**Derivation Hints**

- $\delta_i = t_{i+1} - t_i$, which is the distance between consecutive sample points.

- It can be shown that $\lim_{x \to 0} (1 - e^{-x} - x) \to 0$, therefore $\sigma(\mathbf{r}(t)) \, dt = \sigma_i \delta_i \approx 1 - \exp(-\sigma_i \delta_i)$.

**NeRF Network Details**

As mentioned earlier, an MLP neural network is used to learn the mapping $(x_i, y_i, z_i, \theta_i, \phi_i) \rightarrow (\sigma_i, \mathbf{c}_i)$. Once this mapping is obtained, the pixel value corresponding to a ray can be computed using the $\hat{C}(\mathbf{r})$ expression. The network is then trained by minimizing the mean squared error (MSE) between the predicted and ground-truth pixel values.

The raw input consists of 5-dimensional variables. However, experiments show that adding high-frequency components helps the network learn better. Therefore, a positional encoding function $\gamma(\cdot)$ is introduced to map a single scalar into a $2L$-dimensional vector:

$$
\gamma(p)=(\sin(2^0 \pi p), \cos(2^0\pi p), \dots, \sin(2^{L-1} \pi p), \cos(2^{L-1}\pi p))
$$

The input preprocessing is as follows:

- For position $\mathbf{x}=(x,y,z)$, we choose $L=10$, resulting in a $3 \times 2 \times 10 = 60$-dimensional vector: $\gamma(\mathbf{x}) \in \mathbb{R}^{1 \times 60}$.

- For direction $\mathbf{d}=(\theta, \phi)$, we first convert it to Cartesian coordinates $(x', y', z')$, then apply positional encoding with $L=4$, yielding a $3 \times 2 \times 4 = 24$-dimensional vector: $\gamma(\mathbf{d}) \in \mathbb{R}^{1 \times 24}$.

The network architecture is as follows:

- $\gamma(\mathbf{x})$ is fed into the network at the beginning and is concatenated with intermediate layer features to predict $\sigma$.

- $\gamma(\mathbf{d})$ is concatenated with intermediate layer features to predict $\mathbf{c}$.

![](https://www.waytoagi.com/api/kb-media/Ol9jbSq7XovdXWxR0gSciIwTnee)

**DreamFusion**

DreamFusion is built on NeRF. At first glance, it feels almost magical — it can learn directly without any data. Its core structure is as follows:

- The idea is extremely straightforward: treat the NeRF output as \( z_0 \), and directly back-propagate gradients through a pretrained, frozen text-to-image Diffusion model.

- For each text prompt, a dedicated NeRF is trained to model a 3D object. The prompt should ideally include viewpoint information, such as adding descriptions like “overhead view.”

- The classifier-free guidance weight \( w \) is set to a very large value — around 100 — whereas typical text-to-image models use 30–50.

![](https://www.waytoagi.com/api/kb-media/PwKnbeIcpoqm6Mx9wpacpRRIn4c)

Another key innovation in this paper is the analysis of the gradients. The original loss is given by:

\[ L_\text{Diff}(\phi, \mathbf{z}_t)=\mathbb{E}_{t \sim \mathcal{U}(0, 1), \epsilon \sim \mathcal{N}(\textbf{0}, \textbf{I})}[w(t)||\epsilon_\theta(\alpha_t \mathbf{z}_0 + \sigma_t \epsilon;t)-\epsilon||^2_2] \]

where

- \( w(t) \) is a manually designed weighting coefficient.
- Following the assumption in DDPM, \( \alpha_t^2 + \sigma_t^2 = 1 \).

Substituting the NeRF output \( z_0 = g(\theta) \) into the above equation and taking the derivative with respect to the NeRF parameters \( \theta \), we obtain:

\begin{align}
\nabla_{\theta} L_\text{Diff}(\phi, \mathbf{z}_t)
&=\mathbb{E}_{t \sim \mathcal{U}(0, 1), \epsilon \sim \mathcal{N}(\textbf{0}, \textbf{I})}[2\cdot w(t)(\epsilon_\theta(\alpha_t \mathbf{z}_0 + \sigma_t \epsilon;t)-\epsilon) \cdot \frac{\partial \epsilon_\theta}{\partial \textbf{z}_t}\cdot \frac{\partial \textbf{z}_t}{\partial \textbf{z}_0}\cdot \frac{\partial \textbf{z}_0}{\partial \theta}] \\
&=\mathbb{E}_{t \sim \mathcal{U}(0, 1), \epsilon \sim \mathcal{N}(\textbf{0}, \textbf{I})}[w(t)(\epsilon_\theta(\alpha_t \mathbf{z}_0 + \sigma_t \epsilon;t)-\epsilon) \cdot \frac{\partial \epsilon_\theta}{\partial \textbf{z}_t}\cdot \frac{\partial \textbf{z}_0}{\partial \theta}]
\end{align}

where

- \( \frac{\partial \mathbf{z}_t}{\partial \mathbf{z}_0} = \alpha_t \mathbf{I} \) is absorbed into \( w(t) \).
- \( \epsilon_\theta(\alpha_t \mathbf{z}_0 + \sigma_t \epsilon;t) - \epsilon \) is the residual term.
- \( \frac{\partial \epsilon_\theta}{\partial \mathbf{z}_t} \) is the gradient of the U-Net, which is computationally expensive. DreamFusion chooses to remove it.
- \( \frac{\partial \mathbf{z}_0}{\partial \theta} \) is the gradient of the NeRF network.

By removing the U-Net gradient, the resulting loss is called **SDS (Score Distillation Sampling)**:

\begin{align}
\nabla_{\theta} L_\text{Diff}(\phi, \mathbf{z}_t)
&=\mathbb{E}_{t \sim \mathcal{U}(0, 1), \epsilon \sim \mathcal{N}(\textbf{0}, \textbf{I})}[w(t)(\epsilon_\theta(\alpha_t \mathbf{z}_0 + \sigma_t \epsilon;t)-\epsilon) \cdot \frac{\partial \textbf{z}_0}{\partial \theta}]
\end{align}

The final model results are shown below:

![](https://www.waytoagi.com/api/kb-media/PynYbbfwaotUNXxfJgWcEIUPnGh)

**Closing Thoughts**

This article is divided into 4 sections, providing a concise overview of how generative algorithms are applied across various domains.

- **Image Generation**  
  The article focuses on the VAE family and the Diffusion family, selecting three representative methods from each.  
  - **VAE Series**  
    [VQ-VAE (2017.11)](https://arxiv.org/abs/1711.00937) discretizes the latent space of VAE;  
    [dVAE (2021.02)](https://arxiv.org/abs/2102.12092) improves the stochasticity of VQ-VAE using the Gumbel-Softmax trick;  
    [DALL·E (2021.02)](https://arxiv.org/abs/2102.12092) models *pθ(x|z)* and *pψ(z|y)* separately to accomplish the text-to-image task.  
  - **Diffusion Series**  
    [GLIDE (2021.12)](https://arxiv.org/abs/2112.10741) fully embraces the classifier-free guidance approach, enabling both text-to-image generation and text-guided image editing;  
    [DALL·E 2](https://arxiv.org/abs/2204.06125) (2022.04) combines GLIDE with DALL·E, pushing performance to a whole new level;  
    [ControlNet (2023.02)](https://arxiv.org/abs/2302.05543) injects various conditions into Stable Diffusion via side networks and zero convolutions, leading to widespread adoption.

- **Video Generation**  
  Two works from Google that respectively employ VAE and Diffusion algorithms.  
  - **VAE Approach**  
    [Phenaki (2022.10)](https://arxiv.org/abs/2210.02399) integrates C-ViViT and MASK-GIT. The former is used for encoding and decoding, while the latter performs masked prediction in latent space to forecast future frames.  
  - **Diffusion Approach**  
    [Imagen Video (2022.10)](https://arxiv.org/abs/2210.02303) employs a 7-stage cascaded Diffusion model. It first generates a low-resolution, low-frame-rate initial video, then applies 3 stages of spatial super-resolution and 3 stages of temporal super-resolution to produce approximately 5-second 720p videos at 24 fps.

- **Audio Generation**  
  - **Speech Generation**  
    [AudioLM (2022.09)](https://arxiv.org/abs/2209.03143) draws on SoundStream and w2v-BERT to extract acoustic features and long-term semantic features from raw audio. It then uses a 3-stage seq2seq framework to generate high-quality speech.  
  - **Music Generation**  
    [MusicLM (2023.01)](https://arxiv.org/abs/2301.11325) also leverages SoundStream and w2v-BERT, combined with MuLan (the “CLIP of audio”), training the three models jointly to achieve text-to-music generation.

- **3D Generation**  
  The article first explains the basic principles of [NeRF (2020.03)](https://arxiv.org/abs/2003.08934), then demonstrates how [DreamFusion (2022.09)](https://arxiv.org/abs/2209.14988) utilizes a pre-trained text-to-image Diffusion model together with NeRF to produce text-to-3D results.

**Next Up**: The planned next article is *“What is 3D Parallelism in Distributed Training?”* — stay tuned.

**P.S.**  
Since the author, Xiao A, has not personally implemented every detail mentioned above, most of the content was synthesized through studying code and carefully reading excellent papers in a bottom-up manner. Essentially, this is a collection and re-organization of others’ wisdom — ultimately, it remains “talking on paper.” I sincerely welcome experts with real hands-on experience to critique and correct it. Only through the collision of ideas can sparks fly, and truth emerges clearer through debate.

**If you want to learn about Transformer-based algorithms in NLP, multimodal learning, and AIGC, knowledge of distributed training, as well as how to perform PTQ quantization and deployment on TVM, feel free to follow me — aaronxic~**

# Series Article Guide

- [(1) What Exactly Is the Perplexity Metric?](https://ywh1bkansf.feishu.cn/wiki/E1pjwy9OMirKTdkFQDEcDDlfnTh) 

- [(2) First Look at LLM Foundation Models](https://ywh1bkansf.feishu.cn/wiki/UU9pwtOFtiKIqAkQiSVc3Zdun7e) 

- [(3) How Is a ChatBot Built?](https://ywh1bkansf.feishu.cn/wiki/HRnLw588DiTDLPkSTXCcKit8nbD) 

- [(4) The Path to Multimodal Unification](https://ywh1bkansf.feishu.cn/wiki/ReVzwZUr0ivgWfkaQ91cXrYUnoh) 

- [(5) AIGC Composition Principles (Part 1)](https://ywh1bkansf.feishu.cn/wiki/KmkAwqnXPisrvfkK7RJcK9GqnAf) 


# References

- [Some Notes on AIGC](https://zhuanlan.zhihu.com/p/615522634)

- [PyTorch 32. Gumbel-Softmax Trick](https://zhuanlan.zhihu.com/p/166632315)

- [DALL·E 2 (Includes Diffusion Model Introduction) [Paper Reading] - Bilibili](https://www.bilibili.com/video/BV17r4y1u77B)
