How to use from
SGLang
Install from pip and serve model
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
    --model-path "CodeImageGen/Pictor-9B" \
    --host 0.0.0.0 \
    --port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
	-H "Content-Type: application/json" \
	--data '{
		"model": "CodeImageGen/Pictor-9B",
		"messages": [
			{
				"role": "user",
				"content": "What is the capital of France?"
			}
		]
	}'
Use Docker images
docker run --gpus all \
    --shm-size 32g \
    -p 30000:30000 \
    -v ~/.cache/huggingface:/root/.cache/huggingface \
    --env "HF_TOKEN=<secret>" \
    --ipc=host \
    lmsysorg/sglang:latest \
    python3 -m sglang.launch_server \
        --model-path "CodeImageGen/Pictor-9B" \
        --host 0.0.0.0 \
        --port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
	-H "Content-Type: application/json" \
	--data '{
		"model": "CodeImageGen/Pictor-9B",
		"messages": [
			{
				"role": "user",
				"content": "What is the capital of France?"
			}
		]
	}'
Quick Links

Pictor-9B

Pictor-9B is the 9B version of Pictor-27B: Qwen3.5-9B trained with SFT on teacher programs and GRPO with the image+program reward (IPR).

Paper (coming soon) ยท Project page (coming soon) ยท Code (coming soon)

Base Qwen/Qwen3.5-9B
Training SFT, then GRPO
Reward IPR (program + image)
Precision fp16, merged weights

The model writes a JavaScript program for a text prompt. The image is the program rendered in headless Chrome.

Use

python -m grpo.t2i.eval.generate_one --model CodeImageGen/Pictor-9B --prompt "a red fox in the snow" --out fox.png

Setup (renderer, environment): the GitHub repo, coming soon.

model-mtp.safetensors is the MTP head for speculative decoding. It is optional.

Results

GenEval2: GM 38.4, AM 69.7.

Other models

License

Apache-2.0, the licence of the base model. This is a modified version of Qwen3.5-9B: fine-tuned with SFT and GRPO.

Citation

@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}
}
Downloads last month
57
Safetensors
Model size
9B params
Tensor type
F16
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for CodeImageGen/Pictor-9B

Finetuned
Qwen/Qwen3.5-9B
Finetuned
(1,603)
this model
Quantizations
2 models

Collection including CodeImageGen/Pictor-9B