TwinFlow  by inclusionAI

Taming large-scale few-step generative model training

Created 2 months ago
431 stars

Top 68.9% on SourcePulse

GitHubView on GitHub
Project Summary

TwinFlow addresses the challenge of efficient, large-scale full-parameter training for generative models, enabling high-quality one-step or few-step generation without pipeline bloat. It targets researchers and engineers working with large models, offering a simplified, memory-efficient framework that significantly reduces training complexity and resource requirements.

How It Works

The core innovation is a self-adversarial flow mechanism that creates an internal "twin trajectory." By extending the time interval and using a negative time branch, TwinFlow maps noise to "fake" data, generating a self-adversarial signal. The model then rectifies itself by minimizing velocity field differences ($\Delta_v$) between real and fake trajectories, effectively performing distribution matching as velocity matching. This unique approach eliminates the need for computationally expensive JVP operations, complex GAN discriminators, or auxiliary networks like frozen teachers, leading to a "one-model simplicity."

Quick Start & Requirements

Installation for inference requires the latest `diffusers` library (`pip install git+https://github.com/huggingface/diffusers`). Core implementation tutorials are available for MNIST within the `tutorials/mnist` directory. Links to the project page (https://zhenglin-cheng.com/twinflow), Hugging Face model (https://huggingface.co/inclusionAI/TwinFlow), and GitHub repository (https://github.com/inclusionAI/TwinFlow) are provided.

Highlighted Details

  • Achieves high-quality, diverse image generation at 1-NFE (Number of Function Evaluations), outperforming standard methods like Qwen-Image at similar step counts.
  • Demonstrates scalability to large models (e.g., 20B parameters) due to its unified, one-model architecture, avoiding the memory constraints and complexity of multi-model distillation approaches.
  • Significantly simplifies the training pipeline by removing dependencies on JVPs, GANs, and auxiliary networks, reducing GPU memory overhead.
  • Offers flexible initialization, allowing training to commence from any model stage for further distillation.

Maintenance & Community

The README does not detail specific community channels (e.g., Discord, Slack), roadmap updates, or notable contributors beyond the listed authors. The project is associated with InclusionAI.

Licensing & Compatibility

The license type is not specified in the README. This omission requires clarification for potential commercial use or integration into closed-source projects.

Limitations & Caveats

Key training functionalities, such as code for SD3.5 and general large-scale training, are marked as planned but not yet released. The project's core contribution is based on a recent arXiv preprint (2025), suggesting it may still be under active development. The absence of explicit licensing information poses a significant adoption risk.

Health Check
Last Commit

3 days ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
13
Star History
295 stars in the last 30 days

Explore Similar Projects

Starred by Jeremy Howard Jeremy Howard(Cofounder of fast.ai) and Stas Bekman Stas Bekman(Author of "Machine Learning Engineering Open Book"; Research Engineer at Snowflake).

SwissArmyTransformer by THUDM

0.1%
1k
Transformer library for flexible model development
Created 4 years ago
Updated 1 year ago
Starred by Benjamin Bolte Benjamin Bolte(Cofounder of K-Scale Labs), Patrick von Platen Patrick von Platen(Author of Hugging Face Diffusers; Research Engineer at Mistral), and
10 more.

consistency_models by openai

0.1%
6k
PyTorch code for consistency models research paper
Created 2 years ago
Updated 1 year ago
Feedback? Help us improve.