Run this model with HF Jobs
Run render-attribution/RA-GRPO-TikZ-4B on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/render-attribution/RA-GRPO-TikZ-4B. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/render-attribution/RA-GRPO-TikZ-4B on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/render-attribution/RA-GRPO-TikZ-4B. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/render-attribution/RA-GRPO-TikZ-4B. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use render-attribution/RA-GRPO-TikZ-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use render-attribution/RA-GRPO-TikZ-4B with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("JackieLin0123/SciTikZer-4B") model = PeftModel.from_pretrained(base_model, "render-attribution/RA-GRPO-TikZ-4B") - Notebooks
- Google Colab
- Kaggle
RA-GRPO-TikZ-4B
LoRA adapter for SciTikZer-4B that turns an image into TikZ code. It is the TikZ model of RA-GRPO (Table 3 of the paper), trained for 200 steps with render-attributed credit: each rendered element is traced back to the code that drew it, matched to the reference element it should reproduce, and scored. The tokens that drew it get this score, standardized over the 8 samples, mixed half and half with the GRPO advantage.
Paper | Code | Project page
Result
On DaTikZ-v3 test, LPIPS (x100) goes from 48.2 with GRPO to 44.8 with RA-GRPO and the compile rate from 92.1% to 96.1%; RA-GRPO also beats IR4RL on all seven metrics. Full tables are in the paper.
Usage
The adapter is applied unmerged on top of the base model, as in every evaluation of the paper (rank 32 on the language model). With vLLM:
from huggingface_hub import snapshot_download
from vllm import LLM, SamplingParams
from vllm.lora.request import LoRARequest
llm = LLM("JackieLin0123/SciTikZer-4B", enable_lora=True, max_lora_rank=32, max_model_len=16384, enforce_eager=True)
lora = LoRARequest("ragrpo", 1, snapshot_download("render-attribution/RA-GRPO-TikZ-4B"))
prompt = 'Generate precise, well-structured TikZ/LaTeX code to faithfully recreate the image. The code must be complete and compilable.'
messages = [{"role": "user", "content": [
{"type": "image_url", "image_url": {"url": "file:///path/to/image.png"}},
{"type": "text", "text": prompt}]}]
params = SamplingParams(temperature=0, max_tokens=4096, repetition_penalty=1.05)
print(llm.chat(messages, params, lora_request=lora)[0].outputs[0].text)
eval/decode.py in the code repository
reproduces the paper's decoding exactly, and train/configs/tikz.yaml ragrpo reproduces the training run.
Citation
@article{wang2026whodrew,
title = {Who Drew That Pixel? Fine-Grained Visual Attribution for Image-to-Code Generation and Editing},
author = {Hexuan Wang and Zixian Ma and Ranjay Krishna and Jaemin Cho},
journal = {arXiv preprint arXiv:2612.00307},
year = {2026}
}
- Downloads last month
- 24
Model tree for render-attribution/RA-GRPO-TikZ-4B
Base model
JackieLin0123/SciTikZer-4B