Hunyuan-PromptEnhancer/PromptEnhancer

★ 3,773⑂ 326

[CVPR 2026] PromptEnhancer is a prompt-rewriting tool, refining prompts into clearer, structured versions for better image generation.

About Hunyuan-PromptEnhancer/PromptEnhancer

Hunyuan-PromptEnhancer/PromptEnhancer is an open-source project on GitHub, mainly written in Python. [CVPR 2026] PromptEnhancer is a prompt-rewriting tool, refining prompts into clearer, structured versions for better image generation. It currently holds 3,773 stars and 326 forks with 0 open issues, and was last pushed on an unknown date (repository created unknown).

Project Overview

AI Homed tracks it on the AI Prompt Engineering board.

GitHub Repository Details

Repository Hunyuan-PromptEnhancer/PromptEnhancer · default branch - · size 0 KB · watchers 0 · source: GitHub REST API and repository README

README

PromptEnhancer: A Simple Approach to Enhance Text-to-Image Models via Chain-of-Thought Prompt Rewriting

Linqing Wang · Ximing Xing · Zhiyong Xu · Yiji Cheng · Zhiyuan Zhao · Donghao Li · Tiankai Hang · Zhenxi Li · Jiale Tao · QiXun Wang · Ruihuang Li · Comi Chen · Xin Li · Mingrui Wu · Xinchi Deng · Shuyang Gu · Chunyu Wang* · Qinglin Lu

Tencent Hunyuan

Project Lead · *Corresponding Author

https://github.com/Hunyuan-PromptEnhancer/PromptEnhancer/blob/HEAD/arXiv https://github.com/Hunyuan-PromptEnhancer/PromptEnhancer/blob/HEAD/Zhihu https://github.com/Hunyuan-PromptEnhancer/PromptEnhancer/blob/HEAD/HuggingFace Model https://github.com/Hunyuan-PromptEnhancer/PromptEnhancer/blob/HEAD/HuggingFace Model https://github.com/Hunyuan-PromptEnhancer/PromptEnhancer/blob/HEAD/T2I-Keypoints-Eval Dataset https://github.com/Hunyuan-PromptEnhancer/PromptEnhancer/blob/HEAD/Homepage https://github.com/Hunyuan-PromptEnhancer/PromptEnhancer/blob/HEAD/HunyuanImage2.1 Code https://github.com/Hunyuan-PromptEnhancer/PromptEnhancer/blob/HEAD/HunyuanImage2.1 Model

---

https://github.com/Hunyuan-PromptEnhancer/PromptEnhancer/blob/HEAD/PromptEnhancer Teaser

Overview

Hunyuan-PromptEnhancer is a prompt rewriting utility that supports both Text-to-Image generation and Image-to-Image editing. It restructures input prompts while preserving original intent, producing clearer, structured prompts for downstream image generation tasks.

Key Features:

🔥🔥🔥Updates

Installation

Option 1: Standard Installation (Recommended)

pip install -r requirements.txt

Option 2: GGUF Installation (For quantized models with CUDA support)

chmod +x script/install_gguf.sh && ./script/install_gguf.sh
💡 Tip: Choose GGUF installation if you want faster inference with lower memory usage, especially for the 32B model.

Model Download

🎯 Quick Start

For most users, we recommend starting with the PromptEnhancer-7B model:

# Download PromptEnhancer-7B (13GB) - Best balance of quality and efficiency
huggingface-cli download tencent/HunyuanImage-2.1/reprompt --local-dir ./models/promptenhancer-7b

📊 Model Comparison & Selection Guide

| Model | Size | Quality | Memory | Best For | |-------|------|---------|--------|----------| | PromptEnhancer-7B | 13GB | High | 8GB+ | Most users, balanced performance | | PromptEnhancer-32B | 64GB | Highest | 32GB+ | Research, highest quality needs | | 32B-Q8_0 (GGUF) | 35GB | Highest | 35GB+ | High-end GPUs (H100, A100) | | 32B-Q6_K (GGUF) | 27GB | Excellent | 27GB+ | RTX 4090, RTX 5090 | | 32B-Q4_K_M (GGUF) | 20GB | Good | 20GB+ | RTX 3090, RTX 4080 |

Standard Models (Full Precision)

# PromptEnhancer-7B (recommended for most users)
huggingface-cli download tencent/HunyuanImage-2.1/reprompt --local-dir ./models/promptenhancer-7b

PromptEnhancer-32B (for highest quality)

huggingface-cli download PromptEnhancer/PromptEnhancer-32B --local-dir ./models/promptenhancer-32b

PromptEnhancer-Img2Img-Edit (for image editing tasks)

huggingface-cli download PromptEnhancer/PromptEnhancer-Img2img-Edit --local-dir ./models/promptenhancer-img2img-edit

GGUF Models (Quantized - Memory Efficient)

Choose one based on your GPU memory:

# Q8_0: Highest quality (35GB)
huggingface-cli download mradermacher/PromptEnhancer-32B-GGUF PromptEnhancer-32B.Q8_0.gguf --local-dir ./models

Q6_K: Excellent quality (27GB) - Recommended for RTX 4090

huggingface-cli download mradermacher/PromptEnhancer-32B-GGUF PromptEnhancer-32B.Q6_K.gguf --local-dir ./models

Q4_K_M: Good quality (20GB) - Recommended for RTX 3090/4080

huggingface-cli download mradermacher/PromptEnhancer-32B-GGUF PromptEnhancer-32B.Q4_K_M.gguf --local-dir ./models
🚀 Performance Tip: GGUF models offer 50-75% memory reduction with minimal quality loss. Use Q6_K for the best quality/memory trade-off.

Quickstart

Using HunyuanPromptEnhancer (Text-to-Image)

from inference.prompt_enhancer import HunyuanPromptEnhancer

models_root_path = "./models/promptenhancer-7b"

enhancer = HunyuanPromptEnhancer(models_root_path=models_root_path, device_map="auto")

Enhance a prompt (Chinese or English)

user_prompt = "Third-person view, a race car speeding on a city track..." new_prompt = enhancer.predict( prompt_cot=user_prompt, # Default system prompt is tailored for image prompt rewriting; override if needed temperature=0.7, # >0 enables sampling; 0 uses deterministic generation top_p=0.9, max_new_tokens=256, )

print("Enhanced:", new_prompt)

Using PromptEnhancerImg2Img (Image Editing)

For image editing tasks where you want to enhance editing instructions based on input images:

from inference.prompt_enhancer_img2img import PromptEnhancerImg2Img

Initialize the image-to-image prompt enhancer

enhancer = PromptEnhancerImg2Img( model_path="./models/your-model", device_map="auto" )

Enhance an editing instruction with image context

edit_instruction = "Remove the watermark from the bottom" image_path = "./examples/sample_image.png"

enhanced_prompt = enhancer.predict( edit_instruction=edit_instruction, image_path=image_path, temperature=0.1, top_p=0.9, max_new_tokens=2048 )

print("Enhanced editing prompt:", enhanced_prompt)

Using GGUF Models (Quantized, Faster)

from inference.prompt_enhancer_gguf import PromptEnhancerGGUF

Auto-detects Q8_0 model in models/ folder

enhancer = PromptEnhancerGGUF( model_path="./models/PromptEnhancer-32B.Q8_0.gguf", # Optional: auto-detected n_ctx=1024, # Context window size n_gpu_layers=-1, # Use all GPU layers )

Enhance a prompt

user_prompt = "woman in jungle" enhanced_prompt = enhancer.predict( user_prompt, temperature=0.3, top_p=0.9, max_new_tokens=512, )

print("Enhanced:", enhanced_prompt)

Command Line Usage (GGUF)

# Simple usage - auto-detects model in models/ folder
python inference/prompt_enhancer_gguf.py

Or specify model path

GGUF_MODEL_PATH="./models/PromptEnhancer-32B.Q8_0.gguf" python inference/prompt_enhancer_gguf.py

GGUF Model Benefits

🚀 Why use GGUF models?

| Model | Size | Quality | VRAM Usage | Best For | |-------|------|---------|------------|----------| | Q8_0 | 35GB | Highest | ~35GB | High-end GPUs (H100, A100) | | Q6_K | 27GB | Excellent | ~27GB | RTX 4090, RTX 5090 | | Q4_K_M| 20GB | Good | ~20GB | RTX 3090, RTX 4080 |

Usage Comparison

| Model | Input Type | Use Case | Model Backend | |-------|------------|----------|---------------| | HunyuanPromptEnhancer | Text only | Text-to-Image generation | Transformers (7B/32B) | | PromptEnhancerImg2Img | Text + Image | Image editing tasks | Transformers (32B) | | PromptEnhancerGGUF | Text only | Memory-efficient T2I | llama.cpp (quantized) |

Parameters

Standard Models (Transformers)

GGUF Models

Image-to-Image Models (PromptEnhancerImg2Img)

Citation

If you find this project useful, please consider citing:

@article{promptenhancer,
  title={PromptEnhancer: A Simple Approach to Enhance Text-to-Image Models via Chain-of-Thought Prompt Rewriting},
  author={Wang, Linqing and Xing, Ximing and Cheng, Yiji and Zhao, Zhiyuan and Donghao, Li and Tiankai, Hang and Zhenxi, Li and Tao, Jiale and Wang, QiXun and Li, Ruihuang and Chen, Comi and Li, Xin and Wu, Mingrui and Deng, Xinchi and Gu, Shuyang and Wang, Chunyu and Lu, Qinglin},
  journal={arXiv preprint arXiv:2509.04545},
  year={2025}
}

Acknowledgements

We would like to thank the following open-source projects and communities for their contributions to open research and exploration: Transformers and HuggingFace.

Contact

If you would like to leave a message for our R&D and product teams, Welcome to contact our open-source team. You can also contact us via email (hunyuan_opensource@tencent.com).

Github Star History

Star History

Star History Chart

GitHub Stars & Activity

3,773Stars
326Forks
0Open issues
PythonLanguage

GitHub Popularity

GitHub stars3,773
Forks326
Open issues0
Primary languagePython
License-
Stars gained today0
Created-
Last pushed-

Trending History

Trending statusnot on today's boards

Related AI Projects

1

headroomlabs-ai / headroom

Python★ 73,186⑂ 5,631
2

blader / humanizer

Python★ 50,467⑂ 4,061
3

Imbad0202 / academic-research-skills

Python★ 48,823⑂ 3,789
4

mlflow / mlflow

Python★ 28,051⑂ 6,328
5

alirezarezvani / claude-skills

Python★ 26,168⑂ 3,686
6

comet-ml / opik

Python★ 22,157⑂ 1,809
7
8

tradecatlabs / vibe-coding-cn

Python★ 16,314⑂ 1,653

More AI Rankings