---
title: README
emoji: 🖼️
colorFrom: green
colorTo: gray
sdk: static
pinned: false
---
Code-based Image Generation: Benchmarking, Baselines, and Improved Rewards
Nicole Wang ·
Zhanhao Liang ·
Xingjian Leng ·
Liang Zheng
Australian National University
🌐 Project Page (coming soon)
💻 Code (coming soon)
📃 Paper (coming soon)
---
Every image above is a program. In **code-based image generation**, a language model writes a JavaScript program
and a fixed renderer turns it into an image, so every image can be read, edited and redrawn at any resolution.
We post-train Qwen3.8-27B for it with SFT from a mix of GPT teachers, then GRPO. A judge shown both the program and
the rendered image (**IPR**) is a better reward than either alone: **+18.0** GenEval2 GM over the base model,
against +15.5 for the program alone and +14.3 for the image alone.
## Models
| model | base | training | reward |
|---|---|---|---|
| [Pictor-27B](https://huggingface.co/CodeImageGen/Pictor-27B) (released model) | Qwen3.8-27B | SFT + GRPO | image + program |
| [Pictor-27B-ablation-IR](https://huggingface.co/CodeImageGen/Pictor-27B-ablation-IR) | Qwen3.8-27B | SFT + GRPO | image |
| [Pictor-27B-ablation-PR](https://huggingface.co/CodeImageGen/Pictor-27B-ablation-PR) | Qwen3.8-27B | SFT + GRPO | program |
| [Pictor-27B-ablation-avgR](https://huggingface.co/CodeImageGen/Pictor-27B-ablation-avgR) | Qwen3.8-27B | SFT + GRPO | mean of image and program |
| [Pictor-27B-SFT](https://huggingface.co/CodeImageGen/Pictor-27B-SFT) | Qwen3.8-27B | SFT | |
| [Pictor-9B](https://huggingface.co/CodeImageGen/Pictor-9B) | Qwen3.5-9B | SFT + GRPO | image + program |
| [Pictor-9B-SFT](https://huggingface.co/CodeImageGen/Pictor-9B-SFT) | Qwen3.5-9B | SFT | |
Dataset: [Pictor-SFT-35k](https://huggingface.co/datasets/CodeImageGen/Pictor-SFT-35k), 35k prompt and program pairs.
## Usage and training
The code for setup, generating images, training and evaluation is coming soon on GitHub. One prompt to one image:
```
python -m grpo.t2i.eval.generate_one --model CodeImageGen/Pictor-27B --prompt "a red fox in the snow" --out fox.png
```
## 📚 Citation
```bibtex
@article{wang2026codeimagegen,
title = {Code-based Image Generation: Benchmarking, Baselines, and Improved Rewards},
author = {Wang, Nicole and Liang, Zhanhao and Leng, Xingjian and Zheng, Liang},
journal = {arXiv preprint},
year = {2026}
}
```