Instructions to use render-attribution/RA-GRPO-HTML-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use render-attribution/RA-GRPO-HTML-4B with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("render-attribution/Qwen3-VL-4B-SFT-HTML") model = PeftModel.from_pretrained(base_model, "render-attribution/RA-GRPO-HTML-4B") - Notebooks
- Google Colab
- Kaggle
Initial release
Browse filesFiles changed (3)
- README.mdAdded+59
- adapter_config.jsonAdded+45
- adapter_model.safetensorsAdded+3
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859---license: apache-2.0base_model: render-attribution/Qwen3-VL-4B-SFT-HTMLlibrary_name: peftpipeline_tag: image-text-to-texttags:- lora- image-to-code- html- reinforcement-learning- ra-grpo---
# RA-GRPO-HTML-4B
LoRA adapter for [Qwen3-VL-4B-SFT](https://huggingface.co/render-attribution/Qwen3-VL-4B-SFT-HTML) that turns an image into HTML code. It isthe HTML model of RA-GRPO (Table 4 of the paper), trained for 300 steps with render-attributedcredit: each rendered element is traced back to the code that drew it, matched to the reference element it shouldreproduce, scored, and its score is sent to the responsible tokens as the GRPO advantage.
[Paper](https://arxiv.org/abs/TBD.00000) | [Code](https://github.com/render-attribution/render-attribution) | [Project page](https://render-attribution.github.io)
## Result
On Design2Code, the Block / Text / Position / Color scores (x100) go from 69.0 / 74.2 / 64.8 / 65.7 with GRPO to 77.4 / 82.9 / 72.9 / 73.2 with RA-GRPO. 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 thelanguage model). With vLLM:
```pythonfrom huggingface_hub import snapshot_downloadfrom vllm import LLM, SamplingParamsfrom vllm.lora.request import LoRARequest
llm = LLM("render-attribution/Qwen3-VL-4B-SFT-HTML", enable_lora=True, max_lora_rank=32, max_model_len=16384, enforce_eager=True)lora = LoRARequest("ragrpo", 1, snapshot_download("render-attribution/RA-GRPO-HTML-4B"))prompt = 'Generate the complete HTML document (with inline CSS) that reproduces this webpage screenshot. The page is 1280 pixels wide.'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=8192, repetition_penalty=1.0)print(llm.chat(messages, params, lora_request=lora)[0].outputs[0].text)```
`eval/decode.py` in the code repositoryreproduces the paper's decoding exactly, and `train/configs/html.yaml ragrpo` reproduces the training run.
## Citation
```bibtex@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:TBD.00000}, year = {2026}}```123456789101112131415161718192021222324252627282930313233343536373839404142434445{ "alpha_pattern": {}, "auto_mapping": { "base_model_class": "Qwen3VLForConditionalGeneration", "parent_library": "transformers.models.qwen3_vl.modeling_qwen3_vl" }, "base_model_name_or_path": "render-attribution/Qwen3-VL-4B-SFT-HTML", "bias": "none", "corda_config": null, "eva_config": null, "exclude_modules": null, "fan_in_fan_out": false, "inference_mode": true, "init_lora_weights": true, "layer_replication": null, "layers_pattern": null, "layers_to_transform": null, "loftq_config": {}, "lora_alpha": 64, "lora_bias": false, "lora_dropout": 0.0, "megatron_config": null, "megatron_core": "megatron.core", "modules_to_save": null, "peft_type": "LORA", "qalora_group_size": 16, "r": 32, "rank_pattern": {}, "revision": null, "target_modules": [ "o_proj", "gate_proj", "k_proj", "v_proj", "up_proj", "q_proj", "down_proj" ], "target_parameters": null, "task_type": null, "trainable_token_indices": null, "use_dora": false, "use_qalora": false, "use_rslora": false}123version https://git-lfs.github.com/spec/v1oid sha256:a114662e077b1c70ccfe9ea8e840ca01c8b8da541b2f826f613bbe97cdd8990esize 264316456README.mdAdded+59
adapter_config.jsonAdded+45
adapter_model.safetensorsAdded+3