TeEFusion is a simple yet powerful distillation method that fuses classifier-free guidance directly into text embeddings, enabling student models to mimic complex teacher sampling strategies with a single forward pass—achieving up to 6× faster inference without sacrificing image quality .
-
Embed-Level Guidance Fusion.
Incorporates guidance magnitude w by linearly combining conditional and null prompt embeddings, eliminating the need for two forward passes .
-
Test-Time Sampling Agnostic.
Distills from complex teacher sampling strategy (Euler + CFG, Z-Sampling + CFG, W2SD + CFG) into a simple student that uses standard Euler sampling .
-
Parameter-Free.
No extra network modules beyond the pretrained model’s encoder and decoder.
1git clone https://github.com/AIDC-AI/TeEFusion.git
2cd TeEFusion
3pip install -r requirements.txt
1import torch
2from pipelines.sd3_teefusion_pipeline import TeEFusionSD3Pipeline
3
4pipe = TeEFusionSD3Pipeline.from_pretrained(
5 "AIDC-AI/TeEFusion",
6 torch_dtype=torch.bfloat16,
7 trust_remote_code=True
8)
9pipe.to("cuda")
10
11
12images = pipe(
13 prompt=["A serene mountain lake at sunset"],
14 num_inference_steps=50,
15 guidance_scale=5,
16 seed=0
17)
18
19for i, img in enumerate(images):
20 img.save(f"output_{i}.png")
1@inproceedings{fu2025teefusion,
2 title={{TeEFusion}: Blending Text Embeddings to Distill Classifier-Free Guidance},
3 author={Fu, Minghao and Wang, Guo-Hua and Chen, Xiaohao and Chen, Qing-Guo and Xu, Zhao and Luo, Weihua and Zhang, Kaifu},
4 booktitle={the IEEE/CVF International Conference on Computer Vision (ICCV)},
5 year={2025}
6}
This project is licensed under the Attribution-NonCommercial 4.0 International License (SPDX-License-Identifier: CC-BY-NC-4.0).
We used compliance checking algorithms during the training process, to ensure the compliance of the trained model to the best of our ability. Due to complex data and the diversity of language model usage scenarios, we cannot guarantee that the model is completely free of copyright issues or improper content. If you believe anything infringes on your rights or generates improper content, please contact us, and we will promptly address the matter.