Lakonik/LakonLab

Official implementation of AsymFlow, pi-Flow, GMFlow

What it solves

LakonLab provides a high-performance framework for experimenting with and training large diffusion models. It specifically addresses the need for efficient few-step image generation and editing by implementing advanced flow-matching techniques that reduce the number of sampling steps required to produce high-quality images.

How it works

The codebase implements three primary research projects:

  • AsymFlow: Asymmetric flow models for image generation.
  • pi-Flow: A policy-based imitation distillation method that enables few-step generation (e.g., 4-step sampling for FLUX and Qwen-Image).
  • GMFlow: Gaussian Mixture Flow Matching models.

To support these, LakonLab includes performance optimizations like seamless switching between DDP, FSDP, and FSDP2, weight tying for LoRA fine-tuning to save memory, and advanced flow SDE solvers (FlowSDEScheduler and FlowMapSDEScheduler) for flexible sampling.

Who it’s for

It is designed for AI researchers and developers working with large-scale diffusion models, specifically those interested in flow matching, distillation for faster inference, and high-performance training infrastructure.

Highlights

  • Few-Step Generation: Enables high-quality image generation in as few as 4 steps for models like FLUX.1 and FLUX.2.
  • Infrastructure Optimizations: Supports gradient accumulation, mixed precision, and flexible distributed training (DDP/FSDP).
  • Flexible I/O: Native support for loading checkpoints from HuggingFace, HTTP/HTTPS URLs, and AWS S3.
  • Comprehensive Evaluation: Integrated support for standard metrics like FID, KID, IS, and CLIP similarity, as well as external benchmarks like GenEval and DPG-Bench.