Spaces:
Running

mattwang123 commited on
Commit
0ddc77d
·
verified ·
1 Parent(s): 97a1569

Update README.md

Browse files
Files changed (3) hide show
  1. .gitattributes +1 -0
  2. README.md +20 -129
  3. teaser.png +3 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ teaser.png filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,142 +1,33 @@
 
 
 
 
 
 
 
 
 
1
  # Who Drew That Pixel? Fine-Grained Visual Attribution for Image-to-Code Generation and Editing
2
 
3
- <p align="center">
4
- <a href="https://arxiv.org/abs/TBD.00000"><img src="https://img.shields.io/badge/arXiv-Paper-b31b1b?style=for-the-badge&logo=arxiv&logoColor=white" alt="Paper"></a>
5
- &nbsp;&nbsp;
6
- <a href="https://render-attribution.github.io"><img src="https://img.shields.io/badge/%F0%9F%8C%90%20Project-Page-3F6496?style=for-the-badge" alt="Project page"></a>
7
- &nbsp;&nbsp;
8
- <a href="https://huggingface.co/render-attribution"><img src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Models-FFD21E?style=for-the-badge" alt="Models"></a>
9
- </p>
10
 
11
  [Hexuan Wang](https://mattwang123.github.io)<sup>1</sup>, [Zixian Ma](https://zixianma.github.io)<sup>2</sup>, [Ranjay Krishna](https://ranjaykrishna.com)<sup>2</sup>, [Jaemin Cho](https://j-min.io)<sup>1</sup><br><sup>1</sup>Johns Hopkins University, <sup>2</sup>University of Washington
12
 
13
- [![Render attribution overview](assets/teaser.png)](https://render-attribution.github.io)
14
-
15
- > [!NOTE]
16
- > The **[project page](https://render-attribution.github.io)** has an animated overview and interactive examples.
17
-
18
- Render attribution finds which line of an SVG, TikZ or HTML program drew each pixel.
19
- RA-GRPO uses this to reward or penalize each line on its own during training.
20
- The attribution tools give the same information to a coding agent that edits a figure.
21
-
22
- ## Repository structure
23
-
24
- ```
25
- ragrpo/ render attribution and RA-GRPO
26
- train/ training code and the configs of all paper runs
27
- agent/ attribution tools for coding agents
28
- eval/ metrics used in the paper
29
- baselines/ir4rl/ our version of IR4RL
30
- data/ lists of training images
31
- scripts/ model and asset download
32
- tests/ quick tests that run on the CPU
33
- ```
34
-
35
- Most folders have their own README with more details.
36
-
37
- ## Installation
38
-
39
- Training needs two Python environments. The first one runs the trainer, the attribution tools and the metrics. The second one holds [vLLM](https://github.com/vllm-project/vllm), which samples the programs during training and runs the models for evaluation. vLLM pins its own versions of PyTorch and transformers, so it gets a separate environment. If you only use the attribution tools or score existing outputs, the first environment is enough.
40
-
41
- ```
42
- pip install -r requirements.txt # trainer, tools and metrics
43
- python -m playwright install chromium # renders HTML
44
- pip install -r requirements-vllm.txt # in the second environment
45
- ```
46
-
47
- TikZ also needs [tectonic](https://tectonic-typesetting.github.io), for example `conda install -c conda-forge tectonic=0.17.0`. HTML needs three files that `bash scripts/get_html_assets.sh` downloads.
48
 
49
- ## Quick example
50
-
51
- ```
52
- python examples/run_example.py --out examples/out
53
- ```
54
-
55
- This runs render attribution on a toy SVG with eight sampled programs, on the CPU in under a minute. It prints the matched elements, the score of every element, and the advantage that GRPO and RA-GRPO give to each code line. It saves the renders and id renders of all programs to `examples/out`.
56
 
57
  ## Models
58
 
59
- ```
60
- bash scripts/download_models.sh
61
- ```
62
-
63
- This puts the start models in `models/` and our adapters in `checkpoints/`.
64
-
65
- | Model | Paper | Base model |
66
- |---|---|---|
67
- | [RA-GRPO-SVG-4B](https://huggingface.co/render-attribution/RA-GRPO-SVG-4B) | Table 2 | [VFIG-4B](https://huggingface.co/XunmeiLiu/VFIG-4B) |
68
- | [RA-GRPO-SVG-Code-4B](https://huggingface.co/render-attribution/RA-GRPO-SVG-Code-4B) | Table 6 | [VFIG-4B](https://huggingface.co/XunmeiLiu/VFIG-4B) |
69
- | [RA-GRPO-TikZ-4B](https://huggingface.co/render-attribution/RA-GRPO-TikZ-4B) | Table 3 | [SciTikZer-4B](https://huggingface.co/JackieLin0123/SciTikZer-4B) |
70
- | [RA-GRPO-HTML-4B](https://huggingface.co/render-attribution/RA-GRPO-HTML-4B) | Table 4 | Qwen3-VL-4B-SFT-HTML |
71
- | [Qwen3-VL-4B-SFT-HTML](https://huggingface.co/render-attribution/Qwen3-VL-4B-SFT-HTML) | Table 4 (Qwen3-VL-4B-SFT) | [Qwen3-VL-4B-Instruct](https://huggingface.co/Qwen/Qwen3-VL-4B-Instruct) |
72
-
73
- The RA-GRPO models are LoRA adapters. They are applied on top of the base model without merging, as in all our evaluations.
74
-
75
- ## Training
76
-
77
- Build the training records as explained in `data/README.md`. Each run uses two GPUs.
78
- Use `ragrpo` for our method and `grpo` for the baseline.
79
-
80
- ```
81
- export TRAIN_PY=/path/to/train-env/python VLLM_PY=/path/to/vllm-env/python GPUS=0,1
82
- train/launch.sh train/configs/svg.yaml ragrpo runs/svg_ragrpo
83
- train/launch.sh train/configs/tikz.yaml ragrpo runs/tikz_ragrpo
84
- train/launch.sh train/configs/html.yaml ragrpo runs/html_ragrpo
85
- train/launch.sh train/configs/svg.yaml grpo runs/svg_grpo
86
- ```
87
-
88
- All settings are in `train/configs/`. For a quick check, add `--set steps=2 eval_every=2 dev_n=4 save_every=2`.
89
-
90
- We trained every run on two NVIDIA RTX PRO 6000 GPUs with 96 GB each. On each GPU, the vLLM server takes 35% of the memory (`--util` in `train/gen_server.py`) and the trainer uses the rest.
91
-
92
- | Config | Steps | Time per run | Time per step |
93
  |---|---|---|---|
94
- | `svg.yaml` | 150 | 13.7 h | 328 s |
95
- | `tikz.yaml` | 200 | 8.5 h | 153 s |
96
- | `html.yaml` | 300 | 7.2 h | 87 s |
97
-
98
- GRPO takes the same time as RA-GRPO, within 1.3%.
99
-
100
- `launch.sh` first does a 2-step check in `runs/svg_ragrpo/smoke` and then the full run in `runs/svg_ragrpo/run`, which holds
101
-
102
- ```
103
- config.json the settings of the run
104
- log_r0.jsonl one line per training step (mean reward, KL, gradient norm)
105
- dev_summary.jsonl render rate and LPIPS on the dev images, every 25 steps
106
- step25, step50, ... the LoRA adapters, to use with --lora
107
- ```
108
-
109
- ## Evaluation
110
 
111
- ```
112
- python data/build_records.py test --out data --bench_svgs VFIG_BENCH_SVGS
113
- python eval/decode.py --domain svg --model models/VFIG-4B --lora checkpoints/RA-GRPO-SVG-4B --records data/vfig_bench_test.json --out preds/svg.jsonl
114
- python eval/svg_metrics.py --records data/vfig_bench_test.json --pred preds/svg.jsonl --out scores/svg
115
- ```
116
-
117
- Run `decode.py` in the vLLM environment. It writes one model reply per test image to `preds/svg.jsonl`. `svg_metrics.py` prints the mean of every metric and saves `summary.json` and `per_item.json` to `scores/svg`. With our adapter, the numbers should match the RA-GRPO row of Table 2, for example LPIPS 15.9 and DreamSim 92.2 on VFIG-Bench. `eval/README.md` has the commands for every table.
118
-
119
- ## Attribution tools
120
-
121
- ```
122
- python -m agent.mcp_server --arm attribution --workdir DIR
123
- ```
124
-
125
- This starts an MCP server with the tools `who_draws`, `fit` and `findings` for a coding agent. `DIR` holds the reference `input.png` and the agent's `program.svg`.
126
-
127
- ```
128
- python agent/run_claude_code.py --image input.png --draft draft.svg --out runs/fig1 --arm attribution --max-turns 4
129
- ```
130
-
131
- This runs Claude Code with the tools on one figure. It saves the edited program to `runs/fig1/final.svg` and the turns, tokens and tool calls to `runs/fig1/run.json`. `agent/README.md` explains the tools and the setup.
132
-
133
- ## Tests
134
-
135
- ```
136
- PYTHONPATH=. python tests/test_smoke.py
137
- ```
138
-
139
- The tests take about a minute and end with `all smoke tests passed`.
140
 
141
  ## Citation
142
 
@@ -147,4 +38,4 @@ The tests take about a minute and end with `all smoke tests passed`.
147
  journal = {arXiv preprint arXiv:TBD.00000},
148
  year = {2026}
149
  }
150
- ```
 
1
+ ---
2
+ title: README
3
+ emoji: 🎨
4
+ colorFrom: blue
5
+ colorTo: indigo
6
+ sdk: static
7
+ pinned: false
8
+ ---
9
+
10
  # Who Drew That Pixel? Fine-Grained Visual Attribution for Image-to-Code Generation and Editing
11
 
12
+ [Paper](https://arxiv.org/abs/TBD.00000) | [Code](https://github.com/render-attribution/render-attribution) | [Project page](https://render-attribution.github.io)
 
 
 
 
 
 
13
 
14
  [Hexuan Wang](https://mattwang123.github.io)<sup>1</sup>, [Zixian Ma](https://zixianma.github.io)<sup>2</sup>, [Ranjay Krishna](https://ranjaykrishna.com)<sup>2</sup>, [Jaemin Cho](https://j-min.io)<sup>1</sup><br><sup>1</sup>Johns Hopkins University, <sup>2</sup>University of Washington
15
 
16
+ ![Render attribution overview](https://huggingface.co/spaces/render-attribution/README/resolve/main/teaser.png)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
 
18
+ Render attribution finds which line of an SVG, TikZ or HTML program drew each pixel. RA-GRPO uses it to reward or penalize each line on its own during training.
 
 
 
 
 
 
19
 
20
  ## Models
21
 
22
+ | Model | Task | Base model | Paper |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  |---|---|---|---|
24
+ | [RA-GRPO-SVG-4B](https://huggingface.co/render-attribution/RA-GRPO-SVG-4B) | image to SVG | [VFIG-4B](https://huggingface.co/XunmeiLiu/VFIG-4B) | Table 2 |
25
+ | [RA-GRPO-SVG-Code-4B](https://huggingface.co/render-attribution/RA-GRPO-SVG-Code-4B) | image to SVG, editable code | [VFIG-4B](https://huggingface.co/XunmeiLiu/VFIG-4B) | Table 6 |
26
+ | [RA-GRPO-TikZ-4B](https://huggingface.co/render-attribution/RA-GRPO-TikZ-4B) | image to TikZ | [SciTikZer-4B](https://huggingface.co/JackieLin0123/SciTikZer-4B) | Table 3 |
27
+ | [RA-GRPO-HTML-4B](https://huggingface.co/render-attribution/RA-GRPO-HTML-4B) | screenshot to HTML | [Qwen3-VL-4B-SFT-HTML](https://huggingface.co/render-attribution/Qwen3-VL-4B-SFT-HTML) | Table 4 |
28
+ | [Qwen3-VL-4B-SFT-HTML](https://huggingface.co/render-attribution/Qwen3-VL-4B-SFT-HTML) | screenshot to HTML (start model) | [Qwen3-VL-4B-Instruct](https://huggingface.co/Qwen/Qwen3-VL-4B-Instruct) | Table 4 |
 
 
 
 
 
 
 
 
 
 
 
29
 
30
+ The RA-GRPO models are LoRA adapters, applied on top of the base model without merging. Each model page has a usage example.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
  ## Citation
33
 
 
38
  journal = {arXiv preprint arXiv:TBD.00000},
39
  year = {2026}
40
  }
41
+ ```
teaser.png ADDED

Git LFS Details

  • SHA256: 5970d984d4a0a95c7d1ca70cdbe4bb989003c5640d60386616cd10272fe8ee75
  • Pointer size: 131 Bytes
  • Size of remote file: 235 kB