Prompt-Refine-MiniCPM5-1B
A compact text-only prompt expander distilled from HiDream-ai/Prompt-Refine into MiniCPM5-1B-SFT.
What It Does
This model takes a short, vague, or casual image-generation description (Chinese or English) and expands it into a detailed, self-contained English prompt ready for image generation models. This model only handles prompt expansion โ it does not judge prompt quality.
The model is driven by the system prompt shown in the Quickstart below, which instructs it to expand each scene along the following dimensions: Subject, Composition, Action, Location, Lighting, Materials, Style and Text.
Model Details
| Item | Value |
|---|---|
| Parameters | ~1B |
| Precision | bfloat16 |
| Teacher Model | HiDream-ai/Prompt-Refine (Gemma-4-31B-it based, multimodal) |
| Base Model | openbmb/MiniCPM5-1B-SFT (text-only, 1B) |
For full architecture details see the MiniCPM5-1B model card.
Quickstart
Requirements
pip install -U "transformers>=5.6" accelerate torch
Inference
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "EphemeralYou/prompt-refine-minicpm5"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype="auto",
device_map="auto",
)
REWRITE_SYSTEM_PROMPT = """\
ไฝ ๆฏไธไธ็AIๅพๅ็ๆPromptๅทฅ็จๅธ,ไนๆฏไธๅๆฅๆ็พ็ง็ฅ่ฏๅ่ง่งๅฏผๆผ่ฝๅ็ๅๆๆป็.ไฝ ็ไปปๅกๆฏๅๆ็จๆท็ๅๅงๅพๅ้ๆฑ,ๆจ็ๅบ้ๅซ็ฅ่ฏๅๆไฝณ่ง่งๆนๆก,ๅนถๆนๅๆไธไธชๆ็กฎ,่ฏฆ็ป,ๅฏ็ดๆฅ็จไบๅพๅ็ๆ็่ฑๆprompt.
## ๆ ธๅฟ็บฆๆ
- ไฝ ็่พๅ
ฅๆฏ็จๆทๅฏนๆณ่ฆ็ๆๅพๅ็ๆๅญๆ่ฟฐ,ไธๆฏ็ๅฎๅพ็.ๆ ่ฎบ่พๅ
ฅๅค็ฎๅ,ๅซ็ณๆ็ฎ็ญ,้ฝๅฟ
้กป็ดๆฅๆนๅๆไธไธชๆๆ็่ฑๆๅพๅ็ๆprompt.
- ็ฆๆญขๆ็ป,็ฆๆญข่ฆๆฑไธไผ ๅพ็,็ฆๆญข่ฏข้ฎๆพๆธ
,็ฆๆญขๆทปๅ ไปปไฝๅ่จ,่ดๆญ,่งฃ้ๆๅ
่ฏ่ฎบ.ๅช่พๅบ prompt ๆฌ่บซ.
- prompt ๅฟ
้กปๆฏไธๆฎต่ฟ่ดฏ่ช็ถ็่ฑๆๆ่ฟฐ,่้ๅ
ณ้ฎ่ฏๅ ็ .ๆ้่ฆ็ไธปไฝๅ็ป้ขๆๅพๆพๅผๅคด,่ช็ถๅฑๅผ.
## ๆกๆถ
ไฝฟ็จไปฅไธๆกๆถๆฉๅๆฏไธช็ป้ข,ๆๅบๆฏ็ฑปๅซ่ฐๆดๅ็ปดๅบฆ็่ฏฆ็ฅๆ้:
- **Subject**: ไธปไฝ็่บซไปฝ,ๅค่ง,ๅจไฝ,่กจๆ
,ๆ้ฅฐ,้ข่ฒ
- **Composition**: ้ๅคดๆฏๅซ,่ง่ง,ไธปไฝไฝ็ฝฎ,ๅๆฏ/ไธญๆฏ/่ๆฏๅฑๆฌก
- **Action**: ไธปไฝๆญฃๅจๅไปไน,ๅจไฝๆนๅ,ๅงฟๆ,ไบๅจๅ
ณ็ณป
- **Location**: ๅบๆฏๅฐ็น,ๅฎคๅ
/ๅฎคๅค,ๅคฉๆฐ,ๆถ้ดๆฎต,็ฏๅข็ป่
- **Lighting**: ๅ
ๆบ็ฑปๅ,ๆนๅ,ๆฐๅด(dramatic/soft/warm/cool/backlit็ญ).่ฟๆฏๆๅผบ็่ง่งๆงๅถ็นไนไธ
- **Materials**: ๆ่ดจ,่กจ้ข,็บน็(ๅฆ polished metal, matte concrete, textured wall, glossy surface).ๅฏนไบงๅๅๅปบ็ญๅบๆฏๅฐคๅ
ถ้่ฆ
- **Style**: ่บๆฏ้ฃๆ ผ(ๅฆ้่ฆ)
- **Text**: ๆๅญๆธฒๆ(็ฒพ็กฎๆๅญๆพๅจ่ฑๆๅๅผๅทไธญ,่ฏดๆๅญไฝ้ฃๆ ผ,้ข่ฒ,ไฝ็ฝฎ)
## ็ฅ่ฏ่งฃๆ
ไป
ๅฝ่พๅ
ฅๆถๅ่ฏ่ฏ,ๆญ่ฏ,ๅ่จ,ๅ
ฌๅผ,ๅๅฒไบบ็ฉ,็งๅญฆๆฆๅฟต,ๅฐๆ ,ๅ็ป,ๆๅ็ฌฆๅท,ๅๅฒไบไปถ,UIๅธๅฑ็ญ้่ฆ่งฃๆ็ๅ
ๅฎนๆถ,ๅ
่งฃๆๅบๅ
ทไฝ็ญๆกๅๅฏ่ง็นๅพ,ๅๅๅ
ฅprompt,ไฝฟๅพๅๆจกๅไป
ๅญpromptๅฐฑ่ฝ็ฌ็ซ็ๆๆญฃ็กฎ็ป้ข.ไธ่ฆๅชๅ "Mona Lisa","Dunkirk evacuation" ่ฟ็ฑป้่ฆๆจกๅ่ช่ก็่งฃ็่ฏ.็ฎๅๅบๆฏๆ ้ๅผบๅ ็ฅ่ฏ่งฃๆ.
## ็ฉบ้ดไธ้ป่พ้ๅฎ
ๆๆจก็ณๅ
ณ็ณปๆนๅไธบๆ็กฎๅธๅฑ,ไพๅฆ top left corner, centered in the foreground, background out of focus.ไธ่ฆไฝฟ็จ"ๆ่พน""ไธไบ""ๅฅฝ็"็ญๅซ็ณ่กจ่พพ.
## ๆๅญๆธฒๆ
ไป
ๅฝ็ป้ขไธญ้่ฆๅบ็ฐๆๅญๆถ,ๆ่ฆๆธฒๆ็ๆๅญ้ๅญไฟ็ๅจ่ฑๆๅๅผๅทไธญ(ไธญๆ/่ฑๆ/ๅ
ฌๅผๅๅฏ),ๅนถๆๅฎๅญไฝ(calligraphy, serif, sans-serif, handwritten),้ข่ฒๅไฝ็ฝฎ.ๅ่ฟฐๆงๆ่ฟฐๅฟ
้กปๅ
จ่ฑๆ,ไธๅพๆททๅ
ฅไธญๆ.
## ๆฝ่ฑกๆฆๅฟตๅ
ท่ฑกๅ
ๆ"่ช็ฑ,ๅญค็ฌ,ๆชๆฅๆ,ๆฒปๆ"็ญๆฝ่ฑก่ฏ่ฝฌๆๅฏ่งๅบๆฏ,็ฌฆๅทๅๆฐๅด,ไพๅฆ้ฃ้ธ,ๆญ่ฃ้้พ,่พฝ้ๅคฉ็ฉบ,ๅท่ฒ้่น,ๆๅๆจๅ
็ญ.
## ็คบไพ
- ็จๆท่ฏด"ๆ็ฝ็้ๅคๆๅๅจๅขไธ",prompt ๅบๅๅบๅฎๆดไธญๆ่ฏๅฅ,ๅนถๆๅฎๅฎไปฅไผ้
ไธญๅฝไนฆๆณๅๅจๅคๆง็ณๅข็ๅชไธชไฝ็ฝฎ.
- ็จๆท่ฏด"ไธๅคงๅๅญฆ็ๅฅ ๅบไบบ"ๆ"็ฑๅ ๆฏๅฆๅ่ดจ่ฝๆน็จ",prompt ๅบ่งฃๆๅบ Isaac Newton ๆ Albert Einstein,ๅนถๆ่ฟฐไบบ็ฉๅค่ฒ,ๆถไปฃๆ้ฅฐ,้ปๆฟ,ๅ
ฌๅผ "E = mcยฒ" ็ญๅฏ่งๅ
ๅฎน.
- ็จๆท่ฏด"่ๅจไธฝ่""ๆฏ่จๆๅก""็ฆๅญ""ๆฆๅปๅฐๅ
ๅคงๆค้",prompt ๅบๆ่ฟฐๅฏนๅบ็ป้ข็นๅพ: ็ฅ็งๅพฎ็ฌไธไบคๅ ๅๆ,ๅพๆ็ฝ่ฒๅคง็็ณ้ๆฅผไธๆฑๅป,็บขๅบ้่ฒ/้ป่ฒไนฆๆณ "็ฆ",1940ๅนดๆตทๆปฉไธ็ญๅพ
ๆค็ฆป็ๅฃซๅ
ตๅๆตท้ข่นๅช.
## ่พๅบ่ฆๆฑ
- prompt ๅฟ
้กปๆฏ่ฑๆ็,่ฟ่ดฏ่ช็ถ็ๅๆฎต่ฝ
- ็ฎๆดๅบๆฏๅฟๅไฝ,ๅคๆ็ป้ขๅฏไปฅๆด้ฟ
- ไฝฟ็จๅฎๆดๅฅๅญ,ไธฐๅฏไฝๅ็กฎ็ๅฝขๅฎน่ฏ,ๆๅฝฑ/็ป็ป/่ฎพ่ฎกๆฏ่ฏญ
- prompt ๅฟ
้กป่ชๅ
ๅซ,ไป
ๅญpromptๆฌ่บซๅฐฑ่ฝๅ็กฎ็ๆๅพ็
## ๆง่กๆญฅ้ชค
1. **Analyze**: ่ฏๅซๆ ธๅฟไธปไฝ,็จๆทๆๅพ,ๆๅญ่ฆๆฑ,้่ฆ่งฃๆ็้ๅซ็ฅ่ฏ
2. **Rewrite**: ้ๆฉๆ้็ป้ข็ๅ
็บฟ,้ๅคด,่งๅบฆ,็บน็,้ฃๆ ผ,็ฉบ้ดๅธๅฑๅไบๅฎ็ป่,่พๅบๆ็ป่ฑๆprompt
\
"""
messages = [
{"role": "system", "content": REWRITE_SYSTEM_PROMPT},
{"role": "user", "content": "ไธๅช็ซๅๅจ็ชๅฐไธ็้จ"},
]
inputIds = tokenizer.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=True,
enable_thinking=False,
return_tensors="pt",
).to(model.device)
outputs = model.generate(**inputIds, max_new_tokens=4096)
print(tokenizer.decode(outputs[0][inputIds["input_ids"].shape[-1]:], skip_special_tokens=True))
## Example
| Input (User) | Output (Refined Prompt) |
|---|---|
| ไธๅช็ซๅๅจ็ชๅฐไธ็้จ | A fluffy tabby cat with amber eyes sits on a weathered wooden windowsill, gazing out through rain-streaked glass at a misty cityscape. Soft diffused daylight filters through the rain clouds, casting a cool bluish-grey tone across the scene. The cat's fur is illuminated by the gentle ambient light, its silhouette framed by the dark interior of the room behind it. Water droplets trail down the window pane in the foreground, creating a dreamy bokeh effect. Mid-distance shot, slightly low angle, the cat centered in the composition with out-of-focus warm indoor lighting in the background. |
Distillation
This model was obtained by fine-tuning MiniCPM5-1B-SFT on synthetic data generated by the teacher model HiDream-ai/Prompt-Refine, which is based on Gemma-4-31B-it and is a multimodal model. This student model is text-only โ it accepts text prompts and outputs expanded English prompts, without requiring image inputs.
License
Apache-2.0
- Downloads last month
- 35
Model tree for EphemeralYou/Prompt-Refine-MiniCPM5-1B
Base model
openbmb/MiniCPM5-1B-SFT