Summary (Overview)
- Compact 4B-scale generative stack for text-to-image generation and instruction-based image editing, co-designed for efficiency without scaling to tens of billions of parameters.
- Mage-VAE: a lightweight latent tokenizer using one-step diffusion-style encoding/decoding with anchor-latent regularization, reducing tokenization cost by >10× compared to strong public VAEs while preserving reconstruction quality.
- Native-Resolution Multimodal Diffusion Transformer (NR-MMDiT) trained with rectified flow matching, supporting flexible resolutions (512–2048) and aspect ratios via packing; combined with fused CUDA kernels achieving ~2.5× end-to-end training speedup.
- Complete model family (Base, RL-aligned, Turbo) for both generation and editing; Diffusion-NFT post-training improves prompt following and text rendering; 4-step Turbo models achieve 0.59s generation and 1.02s editing at 1024² on a single A100 GPU with ~18–20 GB peak memory.
- Competitive performance against much larger open-source systems (e.g., Qwen-Image, FLUX.2, FireRed-Image-Edit) across standard benchmarks, establishing a strong quality–speed–memory frontier.
Introduction and Theoretical Foundation
Large-scale visual generators (e.g., GPT-Image, FLUX.2, HunyuanImage-3.0) increasingly rely on backbones with 6B–80B parameters, creating barriers to training, fine-tuning, and deployment under realistic compute budgets. The paper argues that strong generation does not require continued backbone scaling; instead, system-level co-design of the tokenizer, backbone, and training infrastructure can deliver high-quality results at a compact 4B scale.
The theoretical foundation builds on two pillars:
-
Rectified flow matching – The backbone is trained to predict a velocity field that transports noise to data along a straight-line interpolation . The objective is:
-
Latent diffusion with efficient tokenization – Public VAEs (e.g., FLUX.2-VAE) are optimized for pixel-level reconstruction but have encoder/decoder costs that scale poorly at high resolution, becoming a pipeline bottleneck. Mage-VAE replaces heavy autoencoder components with lightweight one-step diffusion-style encoding/decoding, regularized toward an anchor latent distribution from FLUX.2-VAE.
Methodology
Mage-VAE: Lightweight Image Tokenizer
Architecture. The decoder is a fully convolutional one-step pixel diffusion model (inspired by CoD-Lite), avoiding global attention. The encoder is its architectural dual: a one-step diffusion model generating latents from pixels. Both use stacked convolutional diffusion blocks and a decoupled pixel diffusion head.
Anchor-latent regularization. Instead of a standard Gaussian prior, the posterior is regularized toward the latent distribution of FLUX.2-VAE:
Mage-VAE directly produces downsampled latents with 128 channels (internalizing the patchification of FLUX.2 latents).
Training stages.
- Stage I: Multi-step flow-matching pre-training (encoder predicts anchor latents, decoder predicts pixels).
- Stage II: One-step decoder distillation with , LPIPS, DMD, and DINOv2-projected GAN losses.
- Stage III: Joint one-step encoder–decoder optimization with anchor-latent KL.
Native-Resolution MMDiT (NR-MMDiT)
- 4B-parameter MMDiT with modality-specific normalization and joint self-attention.
- Native-resolution packing: images of different resolutions are flattened into variable-length latent token sequences and packed together with variable-length text tokens under a fixed token budget. FlashAttention with per-sample cumulative offsets enables efficient variable-length attention.
- Packed CFG inference: conditional and unconditional branches are packed into a single forward pass, achieving 1.09×–1.15× speedup.
- Conditioning: frozen Qwen3-VL-4B-Instruct text encoder. For editing, source image latents are concatenated with target latents using a 3D RoPE with a frame dimension to distinguish source/target tokens.
Training Infrastructure
- Stack-level CUDA kernel fusion fuses normalization–activation–residual chains in Mage-VAE, adaptive normalization/RoPE/gating in Qwen3-VL and NR-MMDiT.
- Table 4 shows full system achieves 77.26% MFU (vs. 33.20% without optimizations) and 2.49× training speedup.
Data Pipelines
- Generation: ~10B raw image–text pairs → sample-level filtering (progressive thresholds), cross-sample deduplication (SSCD + FAISS), multi-granularity captioning (Qwen3-VL-32B), concept-aware synthesis → ~1.3B high-quality pairs.
- Editing: ~90M triples (50M open-source + 40M in-house) → VLM-based voting filter (three Qwen3.5-9B experts, majority vote) → 45M retained → edit-type tagging and balancing across 19 categories.
Post-training and Distillation
Diffusion-NFT (RL alignment). Operates on the forward process with reward-weighted flow matching:
Reward evaluators: PaddleOCR-VL-1.5 (text), Qwen3.5-27B (aesthetic/semantic), RationalRewards (editing).
Few-step distillation (Turbo models). Combines Decoupled DMD with adversarial perceptual guidance:
where and . Adversarial guidance uses a feature discriminator on frozen DINOv2/CLIP features.
Empirical Validation / Results
Text-to-Image Generation (Table 8, summary)
| Model | #Params | GenEval | DPG | TIIF-Short | TIIF-Long | CVTG-2K | OneIG-EN | OneIG-CN | LongText-EN | LongText-CN |
|---|---|---|---|---|---|---|---|---|---|---|
| Mage-Flow (ours) | 4B | 0.90 | 86.49 | 82.19 | 84.70 | 0.887 | 0.536 | 0.505 | 0.944 | 0.823 |
| Mage-Flow-Turbo (ours) | 4B | 0.88 | 85.48 | 83.58 | 84.16 | 0.873 | 0.523 | 0.491 | 0.911 | 0.801 |
| Qwen-Image | 20B | 0.87 | 88.32 | 86.14 | 86.83 | 0.829 | 0.539 | 0.548 | 0.943 | 0.946 |
| FLUX.2-dev | 32B | 0.87 | 87.57 | 88.82 | 88.10 | 0.893 | 0.551 | 0.516 | 0.963 | 0.757 |
| FLUX.2-Klein-4B | 4B | 0.83 | 85.53 | 78.91 | 79.04 | 0.628 | 0.500 | 0.364 | 0.649 | 0.068 |
- Mage-Flow achieves the best GenEval score among all compared systems (0.90) and strong text rendering (CVTG-2K 0.887, LongText-EN 0.944).
- Turbo variant preserves most quality with only 4 steps.
Instruction-Based Image Editing (Table 13, summary)
| Model | #Params | ImgEdit | GEdit-EN | GEdit-CN | TextEdit-Syn | TextEdit-Real |
|---|---|---|---|---|---|---|
| Mage-Flow-Edit (ours) | 4B | 4.34 | 8.127 | 8.123 | 14.14 | 16.26 |
| Mage-Flow-Edit-Turbo (ours) | 4B | 4.38 | 8.271 | 8.264 | 12.77 | 15.41 |
| FireRed-Image-Edit-1.0 | 20B | 4.56 | 7.943 | 7.887 | 15.19 | 17.23 |
| Qwen-Image-Edit-2511 | 20B | 4.51 | 7.877 | 7.819 | 13.53 | 16.81 |
| JoyAI-Image-Edit | 16B | 4.46 | 8.276 | 8.125 | 14.80 | 17.23 |
- Mage-Flow-Edit achieves best open-source GEdit-CN score and competitive ImgEdit/TextEdit scores.
- Turbo variant maintains performance with 4 steps.
Efficiency (Fig. 4, Tables 1, 4)
- Mage-VAE: 12.3× fewer encoding MACs/pixel and 22.3× fewer decoding MACs/pixel vs. FLUX.2-VAE, with comparable reconstruction (PSNR 36.61 vs. 36.88 on CLIC 2020).
- Training: 2.49× speedup, MFU 77.26%, memory 141.44 GB vs. 175.45 GB.
- Inference: Mage-Flow-Turbo 0.59s/image, Mage-Flow-Edit-Turbo 1.02s/image at 1024² on A100 (80GB), peak memory ~18–20 GB.
Ablation Studies
- Anchor-latent tokenizer compatibility (Table 2): Swapping Mage-VAE and FLUX.2-VAE in downstream backbones yields similar benchmark performance, confirming latent space compatibility.
- Adversarial perceptual guidance (Table 6): Improves generation and text editing under 4-step distillation (e.g., TIIF-Short 83.58 vs. 80.99); gains on general editing are benchmark-dependent.
- Generation data in editing training (Table 7): Helps ImgEdit for Turbo variant (4.38 vs. 4.20); GEdit changes are mixed.
- Native-resolution packing (Table 3): Packed CFG speeds up inference by 1.09×–1.15×.
Theoretical and Practical Implications
Theoretical Insights
- Tokenizer–backbone–system co-design is a viable alternative to backbone scaling: a lightweight tokenizer (Mage-VAE) removes the high-resolution bottleneck, while native-resolution packing and kernel fusion make training efficient.
- Anchor-latent regularization provides a principled way to transfer a generation-ready latent space from an expensive VAE to a lightweight one without breaking downstream compatibility.
- Native-resolution packing turns resolution diversity into a training signal, improving flexibility and enabling efficient packed CFG inference.
Practical Implications
- Accessibility: The entire 4B model family fits in ~18–20 GB GPU memory, enabling local desktop deployment and downstream research on a single consumer GPU.
- Speed: 4-step Turbo models (0.59s generation, 1.02s editing) make high-resolution interactive editing practical.
- Extensibility: The stack is designed for easy adaptation (e.g., scientific diagram generation in Appendix D, fine-tuned from Mage-Flow-Base with a single-stage data mixture).
- Reproducibility: Open-source code, models, and project page provide a research-friendly baseline.
Conclusion
The Mage-Flow generative stack demonstrates that careful co-design of a lightweight tokenizer, native-resolution diffusion backbone, and optimized training infrastructure can deliver strong high-resolution generation and editing at a compact 4B scale. Key contributions include:
- Mage-VAE: a high-fidelity one-step encoder–decoder with anchor-latent regularization, reducing tokenization cost by >10×.
- NR-MMDiT: a flexible backbone supporting native-resolution packing and packed CFG inference.
- Complete model family (Base, RL-aligned, Turbo) for both generation and editing, achieving competitive or superior performance against much larger open-source systems while being faster and more memory-efficient.
Future directions include more robust multi-image editing, stronger multilingual long-text rendering, and tighter integration with agentic visual creation workflows. The results show that strong visual generation does not necessarily require tens-of-billions-parameter backbones—a well-designed 4B stack can serve as a practical and research-friendly foundation.
Related papers
- VideoChat3: Fully Open Video MLLM for Efficient and Generalist Video Understanding
VideoChat3 achieves state-of-the-art video understanding at 4B scale with efficient I3D-ViT and adaptive frame resolution, fully open-source
- Text Template Tokens Are Implicit Semantic Registers in Diffusion Transformers
Chat-template tokens in diffusion transformers become implicit semantic registers, dominating attention and enabling 20% FLOP reduction via training-free head pruning.
- Boogu-Image-0.1: Boosting Open-Source Unified Multimodal Understanding and Generation
Boogu-Image-0.1 achieves competitive text-to-image generation and editing with only 208M images and $400K training cost.