Views
No views yet
1vllm serve google/gemma-3-12b-it \
2 --enable-lora \
3 --lora-modules grpo-region-tree=AmirMohseni/curvebench-gemma-3-12b \
4 --max-lora-rank 4 \
5 --max-model-len 32768 \
6 --gpu-memory-utilization 0.90 \
7 --dtype bfloat16 \
8 --trust-remote-code1from openai import OpenAI
2from datasets import load_dataset
3import base64
4from io import BytesIO
5
6client = OpenAI(base_url="http://localhost:8000/v1", api_key="token")
7
8# Load the first test image from the benchmark
9ds = load_dataset("AmirMohseni/CurveBench-Easy", split="total_test")
10image = ds[0]["image"]
11
12buf = BytesIO()
13image.save(buf, format="PNG")
14image_b64 = base64.b64encode(buf.getvalue()).decode()
15
16response = client.chat.completions.create(
17 model="grpo-region-tree",
18 messages=[{
19 "role": "user",
20 "content": [
21 {
22 "type": "image_url",
23 "image_url": {"url": f"data:image/png;base64,{image_b64}"},
24 },
25 {
26 "type": "text",
27 "text": (
28 "The image shows a set of pairwise non-intersecting closed curves drawn on a plane. "
29 "Each curve creates a boundary between an interior region and its surroundings. "
30 "Output the containment tree of the regions as a list of edges in the format: "
31 "[(parent, child), ...] where 0 is the outermost (unbounded) region."
32 ),
33 },
34 ],
35 }],
36 max_tokens=2048,
37)
38print(response.choices[0].message.content)
39print("Ground truth:", ds[0]["tree"])1from peft import PeftModel
2from transformers import AutoModelForImageTextToText, AutoProcessor
3from datasets import load_dataset
4import torch
5
6base_id = "google/gemma-3-12b-it"
7adapter_id = "AmirMohseni/curvebench-gemma-3-12b"
8
9processor = AutoProcessor.from_pretrained(base_id, trust_remote_code=True)
10model = AutoModelForImageTextToText.from_pretrained(
11 base_id, torch_dtype=torch.bfloat16, device_map="auto", trust_remote_code=True
12)
13model = PeftModel.from_pretrained(model, adapter_id)
14
15# Load the first test image from the benchmark
16ds = load_dataset("AmirMohseni/CurveBench-Easy", split="total_test")
17image = ds[0]["image"]
18
19prompt = (
20 "The image shows a set of pairwise non-intersecting closed curves drawn on a plane. "
21 "Each curve creates a boundary between an interior region and its surroundings. "
22 "Output the containment tree of the regions as a list of edges in the format: "
23 "[(parent, child), ...] where 0 is the outermost (unbounded) region."
24)
25
26inputs = processor(
27 text=processor.apply_chat_template(
28 [{"role": "user", "content": [{"type": "image"}, {"type": "text", "text": prompt}]}],
29 add_generation_prompt=True,
30 ),
31 images=[image],
32 return_tensors="pt",
33).to(model.device)
34
35output = model.generate(**inputs, max_new_tokens=2048)
36print(processor.decode(output[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
37print("Ground truth:", ds[0]["tree"])

total_train (210 images) from CurveBench-Easy1@misc{mohseni2026curvebench,
2 title={CurveBench: A Benchmark for Exact Topological Reasoning over Nested Jordan Curves},
3 author={Amirreza Mohseni and Mona Mohammadi and Morteza Saghafian and Naser Talebizadeh Sardari},
4 year={2026},
5 eprint={2605.14068},
6 archivePrefix={arXiv},
7 primaryClass={cs.CV},
8 url={https://arxiv.org/abs/2605.14068},
9}1@article{shao2024deepseekmath,
2 title = {{DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models}},
3 author = {Zhihong Shao and Peiyi Wang and Qihao Zhu and Runxin Xu and Junxiao Song and Mingchuan Zhang and Y. K. Li and Y. Wu and Daya Guo},
4 year = 2024,
5 eprint = {arXiv:2402.03300},
6}1@misc{vonwerra2022trl,
2 title = {{TRL: Transformer Reinforcement Learning}},
3 author = {Leandro von Werra and Younes Belkada and Lewis Tunstall and Edward Beeching and Tristan Thrush and Nathan Lambert and Shengyi Huang and Kashif Rasul and Quentin Gallou{\'e}dec},
4 year = 2020,
5 journal = {GitHub repository},
6 publisher = {GitHub},
7 howpublished = {\url{https://github.com/huggingface/trl}}
8}