Qwen-Image
A text-to-image model that starts from white noise in latent space and moves it step by step along a learned path to the target image.
It's built around a multimodal LLM as the encoder and a transformer as the denoiser.
** text+image->image **
positive and negative prompts, and image
|
Qwen2.5-VL multimodal LLM creates the positive and negative embeddings.
It understands long, complex prompts, and can also read images, but for image2image it reads only text prompts.
|
VAE encodes the input image into image latent, and adds noise, to form a 'noised' image latent as starting point, instead of a white-noise image
|
MMDiT (Multimodal Diffusion Transformer) is the Flow Matching denoiser.
The noised image latent is cut into small 2x2 patches, and each patch becomes one image token, so the image becomes a sequence of tokens.
This is different to Stable Diffusion's convolution U-Net.
It predicts the velocity (direction and speed) from noise to image, not the noise itself.
Conceptually: (noisy latent) + (step size) × (velocity) → (cleaner latent).
It uses only text prompt tokens, and never use image-meaning tokens for prediction.
The image only helps to create a starting 'noised' image latent, and doesn't help with steering the denoiser.
|
CFG blends the positive and negative velocities.
Conceptually: (blended velocity) = (negative velocity) + w × (positive velocity − negative velocity), in latent space.
The weight w is a constant guidance strength.
|
The sampler (a flow-matching Euler solver) takes a step along the blended velocity.
Conceptually: (cleaner latent) = (noisy latent) + Δσ × (blended velocity).
The scheduler holds a sequence of noise levels σ, going from 1 (pure noise) to 0 (clean).
|
Loop back to MMDiT for the next step.
|
Complete all t steps.
|
The VAE decodes the output image from latent space.
** text+image-> eidt image **
positive and negative prompts, and the image to edit
|
Qwen2.5-VL multimodal LLM creates the positive and negative embeddings.
It reads both text prompts, and also the input image, outputting text tokens and image-meaning tokens.
|
VAE encodes a white-noise image to latent space as starting point, like Stable Diffusion.
VAE also reads the input image again and encode it to reference image latent.
|
MMDiT (Multimodal Diffusion Transformer) is the Flow Matching denoiser.
Both the white-noise latent and reference image latent are cut into small 2x2 patches, and each patch becomes one image token, so an image becomes a sequence of tokens.
It predicts the velocity (direction and speed) from noise to image, not the noise itself.
Conceptually: (noisy latent) + (step size) × (velocity) → (cleaner latent).
It uses text prompt tokens sequence, image-meaning tokens sequence, and reference-image tokens sequence to predict.
The reference-image helps steer the prediction, and the denoiser may even copy patches of the reference image latent.
The full sequence of images' tokens and text tokens, are self-attention'ed, so text, image-meaning and reference-image patches influence each other (joint attention).
|
CFG blends the positive and negative velocities.
Conceptually: (blended velocity) = (negative velocity) + w × (positive velocity − negative velocity), in latent space.
The weight w is a constant guidance strength.
|
The sampler (a flow-matching Euler solver) takes a step along the blended velocity.
Conceptually: (cleaner latent) = (noisy latent) + Δσ × (blended velocity).
The scheduler holds a sequence of noise levels σ, going from 1 (pure noise) to 0 (clean).
|
Loop back to MMDiT for the next step.
|
Complete all t steps.
|
The VAE decodes the output image from latent space.
Qwen2.5-VL : multimodal LLM encoder, text/image -> embedding
VAE : Variational Autoencoder, image <-> latent
MMDiT : transformer denoiser, predicts velocity (noise -> image direction), moving from convolution in U-Net to self-attention of image and text tokens.
Flow matching : training method that learns a near-straight path from noise to image, so it needs fewer, more stable steps
CFG : Classifier-Free Guidance, velocity blending
Sampler : steps along the velocity
Advantages over Stable Diffusion:
Qwen2.5-VL + MMDiT joint attention. Text and image tokens interact in every block, so the model follows the prompt more closely and renders text better.
Flow matching. The path from noise to image is close to a straight line, so fewer and more stable sampling steps are needed.
Transformer instead of U-Net. It scales well. The MMDiT has about 20B parameters.
Qwen-Image-Edit (the Edit version of Qwen-Image)
The input image is encoded twice.
Qwen2.5-VL reads input image meaning. What's in the image and what the instruction wants changed.
VAE encodes input image into latents which are added to MMDiT's token sequence alongside the noisy-starting-image latents. Attention keeps what should stay the same and changes only what the instruction asks for.
Meaning keeps the edit consistent with the instruction. The VAE's latent keeps the result faithful to the original image.
LoRA
The original model is essentially y = Wx.
Now freeze model weights W, but add a small extra, y = Wx + aBAx
Matrix multiplication BAx, shrinks x to r dimensions, and retores back to original dimensions. Alpha "a" is a small scaling factor.
A has shape (r, in_dim)
B has shape (out_dim, r)
Why? similar to Autoencoder, it compresses the extra updates so can only change in r important features.
These r features are supposed (not guaranteed) to capture the most significant updates (e.g portrait aesthetic) to enhance the original image.
It's attached to MMDiT's attention and MLP layers to add styles, characters or editing skills.
ControlNet
A trainable copy of some MMDiT blocks takes a control map (pose, Canny edges, depth) as patch tokens.
Its residuals are added back to the original blocks' outputs to enforce structure.
Alternative: Qwen-Image-Edit can take the control map as its input image, with an instruction describing what to generate.