Sashuai Zhou1,2*, Qiang Zhou2*, Jijin Hu2*, Hanqing Yang2*, Yue Cao3, Junpeng Ma4,
Yinchao Ma2, Jun Song2†, Tiezheng Ge2, Cheng Yu2, Bo Zheng2, Zhou Zhao1†
1Zhejiang University 2Alibaba Group 3Nanjing University 4Fudan University
* Equal contribution † Corresponding authors
Unified Thinker is a task-agnostic reasoning core for general image generation. It decouples a trainable Thinker (MLLM) from an image Generator (e.g., diffusion models), enabling executable planning that bridges the persistent reasoning–execution gap in reasoning-driven image generation and editing.


Dataset Structure: Create local directories and symlink or download the datasets as follows:
data/UniREdit-Data-100K/uniredit-data/original_images/data/Banana-400K/source_images/und.jsonl and gen.jsonl to data/.Pre-trained Weights:
Download and organize the models in the model/ directory:
model/Qwen-Image-Edit-2509 (The Image Generator)model/Qwen2.5-VL-7B-Instruct (Base MLLM, only needed for training from scratch)model/UnifiedThinker-7B (The trained Reasoning Core — required for inference)pip install -U pip
pip install -r requirements.txt
bash scripts/thinker_editor/train.sh
Both entry points load two models: the generator (--model_path) and the Thinker
(--thinker_path, defaults to --processor_path). Because the two together exceed
80GB in bf16, they are swapped between CPU and GPU per stage by default; pass
--no_offload if you have enough free VRAM to keep both resident.
bash inference/infer_single.sh
bash inference/infer_gradio.sh
IMAGE=path/to/input.png \
PROMPT="Draw what it will look like after being bitten by people." \
OUTPUT=out.png \
bash inference/infer_single.sh
Set
PYTHON=<interpreter>to pick a specific Python. LeavingIMAGE/PROMPTunset keeps the original interactive loop.
The reasoning-based editing pipeline is two independent models in two stages:
UnifiedThinker-7B reasons over (image, instruction) and emits
<think>…</think><answer>enhanced prompt</answer>; the <answer> is then handed to
the full Qwen-Image-Edit-2509 pipeline for diffusion editing. The Thinker is loaded
explicitly (load_thinker) — it is not the generator's frozen pipe.text_encoder.
Scripts live in benchmark/image-generation/RISEBench/:
Generate (Thinker CoT → editor). Two phases keep only one model resident at a time (the pair exceeds 80GB in bf16):
PYTHONPATH=$(pwd) python3 benchmark/image-generation/RISEBench/gen_risebench.py \
--data <RISEBench>/datav2_total_w_subtask.json \
--input <RISEBench>/data \
--output outputs/UnifiedThinker-7B \
--model_path model/Qwen-Image-Edit-2509 \
--thinker_path model/UnifiedThinker-7B \
--phase cot # then rerun with --phase image
Generation is seed=0, num_inference_steps=50, guidance_scale=4.0. If the
Thinker hits the token limit without closing <answer>, the pipeline falls back to
the raw instruction (never the truncated CoT), so reruns are deterministic.
Evaluate with a GPT-4o judge (RISEBench's paper uses a GPT-family judge). The
scorer is the shipped gpt_eval.py; gpt4o_eval.py is a thin wrapper that only
swaps the API layer and reads config from env (no secrets in source):
OPENAI_API_KEY=sk-... \
PYTHONPATH=benchmark/image-generation/RISEBench \
python3 benchmark/image-generation/RISEBench/gpt4o_eval.py \
--data <RISEBench>/datav2_total_w_subtask.json \
--input <RISEBench>/data \
--output outputs/UnifiedThinker-7B \
--prefix eval_risebench_by_ --nproc 8
Override OPENAI_API_BASE to use any OpenAI-compatible gateway; OPENAI_MODEL
defaults to gpt-4o-2024-08-06. A local open-source judge alternative
(qwen_eval.py, Qwen2.5-VL) is also provided.
This repository currently serves as the project homepage.
📖 If you find this work useful, please cite:
@misc{zhou2026unifiedthinker,
title={Unified Thinker: A General Reasoning Modular Core for Image Generation},
author={Sashuai Zhou and Qiang Zhou and Jijin Hu and Hanqing Yang and Yue Cao and Junpeng Ma and Yinchao Ma and Jun Song and Tiezheng Ge and Cheng Yu and Bo Zheng and Zhou Zhao},
year={2026},
eprint={2601.03127},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2601.03127},
}
Python
99.4%
Sashuai Zhou1,2*, Qiang Zhou2*, Jijin Hu2*, Hanqing Yang2*, Yue Cao3, Junpeng Ma4,
Yinchao Ma2, Jun Song2†, Tiezheng Ge2, Cheng Yu2, Bo Zheng2, Zhou Zhao1†
1Zhejiang University 2Alibaba Group 3Nanjing University 4Fudan University
* Equal contribution † Corresponding authors
Unified Thinker is a task-agnostic reasoning core for general image generation. It decouples a trainable Thinker (MLLM) from an image Generator (e.g., diffusion models), enabling executable planning that bridges the persistent reasoning–execution gap in reasoning-driven image generation and editing.


Dataset Structure: Create local directories and symlink or download the datasets as follows:
data/UniREdit-Data-100K/uniredit-data/original_images/data/Banana-400K/source_images/und.jsonl and gen.jsonl to data/.Pre-trained Weights:
Download and organize the models in the model/ directory:
model/Qwen-Image-Edit-2509 (The Image Generator)model/Qwen2.5-VL-7B-Instruct (Base MLLM, only needed for training from scratch)model/UnifiedThinker-7B (The trained Reasoning Core — required for inference)pip install -U pip
pip install -r requirements.txt
bash scripts/thinker_editor/train.sh
Both entry points load two models: the generator (--model_path) and the Thinker
(--thinker_path, defaults to --processor_path). Because the two together exceed
80GB in bf16, they are swapped between CPU and GPU per stage by default; pass
--no_offload if you have enough free VRAM to keep both resident.
bash inference/infer_single.sh
bash inference/infer_gradio.sh
IMAGE=path/to/input.png \
PROMPT="Draw what it will look like after being bitten by people." \
OUTPUT=out.png \
bash inference/infer_single.sh
Set
PYTHON=<interpreter>to pick a specific Python. LeavingIMAGE/PROMPTunset keeps the original interactive loop.
The reasoning-based editing pipeline is two independent models in two stages:
UnifiedThinker-7B reasons over (image, instruction) and emits
<think>…</think><answer>enhanced prompt</answer>; the <answer> is then handed to
the full Qwen-Image-Edit-2509 pipeline for diffusion editing. The Thinker is loaded
explicitly (load_thinker) — it is not the generator's frozen pipe.text_encoder.
Scripts live in benchmark/image-generation/RISEBench/:
Generate (Thinker CoT → editor). Two phases keep only one model resident at a time (the pair exceeds 80GB in bf16):
PYTHONPATH=$(pwd) python3 benchmark/image-generation/RISEBench/gen_risebench.py \
--data <RISEBench>/datav2_total_w_subtask.json \
--input <RISEBench>/data \
--output outputs/UnifiedThinker-7B \
--model_path model/Qwen-Image-Edit-2509 \
--thinker_path model/UnifiedThinker-7B \
--phase cot # then rerun with --phase image
Generation is seed=0, num_inference_steps=50, guidance_scale=4.0. If the
Thinker hits the token limit without closing <answer>, the pipeline falls back to
the raw instruction (never the truncated CoT), so reruns are deterministic.
Evaluate with a GPT-4o judge (RISEBench's paper uses a GPT-family judge). The
scorer is the shipped gpt_eval.py; gpt4o_eval.py is a thin wrapper that only
swaps the API layer and reads config from env (no secrets in source):
OPENAI_API_KEY=sk-... \
PYTHONPATH=benchmark/image-generation/RISEBench \
python3 benchmark/image-generation/RISEBench/gpt4o_eval.py \
--data <RISEBench>/datav2_total_w_subtask.json \
--input <RISEBench>/data \
--output outputs/UnifiedThinker-7B \
--prefix eval_risebench_by_ --nproc 8
Override OPENAI_API_BASE to use any OpenAI-compatible gateway; OPENAI_MODEL
defaults to gpt-4o-2024-08-06. A local open-source judge alternative
(qwen_eval.py, Qwen2.5-VL) is also provided.
This repository currently serves as the project homepage.
📖 If you find this work useful, please cite:
@misc{zhou2026unifiedthinker,
title={Unified Thinker: A General Reasoning Modular Core for Image Generation},
author={Sashuai Zhou and Qiang Zhou and Jijin Hu and Hanqing Yang and Yue Cao and Junpeng Ma and Yinchao Ma and Jun Song and Tiezheng Ge and Cheng Yu and Bo Zheng and Zhou Zhao},
year={2026},
eprint={2601.03127},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2601.03127},
}
Python
99.4%