How to use from the
Use from the
Transformers library
# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("text-generation", model="CodeImageGen/CIG-27B-avgR")
messages = [
    {"role": "user", "content": "Who are you?"},
]
pipe(messages)
# pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("CodeImageGen/CIG-27B-avgR")
model = AutoModelForCausalLM.from_pretrained("CodeImageGen/CIG-27B-avgR", device_map="auto")
messages = [
    {"role": "user", "content": "Who are you?"},
]
inputs = tokenizer.apply_chat_template(
	messages,
	add_generation_prompt=True,
	tokenize=True,
	return_dict=True,
	return_tensors="pt",
).to(model.device)

outputs = model.generate(**inputs, max_new_tokens=256)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))
Quick Links

CIG-27B-avgR

Qwen3.8-27B after SFT and GRPO with the avgR reward: the mean of separate IR and PR judge calls.

Base Qwen/Qwen3.8-27B
Training SFT, then GRPO
Reward avgR (mean of IR and PR)
Steps GRPO step 250
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/CIG-27B-avgR --prompt "a red fox in the snow" --out fox.png

Setup (renderer, environment): https://github.com/codeimagegen/codeimagegen

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

Results

GenEval2: GM 48.3, AM 76.5.

Other models

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

Model tree for CodeImageGen/CIG-27B-avgR

Base model

Qwen/Qwen3.8-27B
Finetuned
(1,070)
this model