File size: 33,565 Bytes
4711fff
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ee58d1a
4711fff
ee58d1a
7e79ca3
ee58d1a
4711fff
 
 
 
 
 
58c4a63
4711fff
58c4a63
4711fff
 
 
 
 
 
 
 
 
ee58d1a
7e79ca3
ee58d1a
 
 
 
7e79ca3
4711fff
 
 
 
7e79ca3
4711fff
 
 
 
 
 
58c4a63
 
 
4711fff
 
 
 
 
 
 
58c4a63
 
4711fff
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58c4a63
4711fff
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58c4a63
 
4711fff
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58c4a63
4711fff
 
 
 
 
 
58c4a63
4711fff
58c4a63
 
 
 
 
4711fff
ee58d1a
4711fff
 
 
 
 
58c4a63
4711fff
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ee58d1a
4711fff
ee58d1a
7e79ca3
ee58d1a
4711fff
 
 
 
 
 
58c4a63
4711fff
58c4a63
4711fff
 
 
 
 
 
 
 
 
ee58d1a
7e79ca3
ee58d1a
 
 
 
7e79ca3
4711fff
 
 
 
7e79ca3
4711fff
 
 
 
 
 
58c4a63
 
 
4711fff
 
 
 
 
 
 
58c4a63
 
4711fff
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58c4a63
4711fff
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58c4a63
 
4711fff
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58c4a63
4711fff
 
 
 
 
 
58c4a63
4711fff
58c4a63
 
 
 
 
4711fff
ee58d1a
4711fff
 
 
 
 
58c4a63
4711fff
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
---
license: apache-2.0
base_model: Qwen/Qwen3.8-27B
library_name: transformers
pipeline_tag: image-text-to-text
language:
  - en
  - zh
tags:
  - image-to-code
  - video-to-code
  - agentic-reinforcement-learning
  - safetensors
inference: false
---

<!-- model-card-language: en -->

<a id="english"></a>

# <img src="https://huggingface.co/Skywalker0410/CodingDINO/resolve/main/assets/logo.png" width="40" style="display: inline-block; vertical-align: middle; margin: 0;" alt="CodingDINO" /> CodingDINO: Learning to Represent What We See as Code with Agentic Reinforcement Learning

**English** | [简体中文](#chinese)

<p align="center" style="margin: 0;"><img src="https://huggingface.co/Skywalker0410/CodingDINO/resolve/main/assets/teaser.png" width="100%" alt="Image and video targets alongside their program renders" style="display: block; margin: 0;" /></p>

## 🔗 Quick Links

- 🤗 **Hugging Face** · [CodingDINO](https://huggingface.co/Skywalker0410/CodingDINO)
- <img src="https://huggingface.co/Skywalker0410/CodingDINO/resolve/main/assets/modelscope-logo.svg" width="22" height="20" style="display: inline-block; vertical-align: middle; margin: 0;" alt="ModelScope" /> **ModelScope** · [CodingDINO](https://www.modelscope.ai/models/Skywalker0410/CodingDINO) (coming soon)
- 🌐 **Project Page** · [CodingDINO](https://skywalker-yqz.github.io/CodingDINO/)
- 💻 **GitHub Repository** · [Skywalker-yqz/CodingDINO](https://github.com/Skywalker-yqz/CodingDINO)
- 📄 **Paper** · [arXiv:2611.40817](https://arxiv.org/abs/2611.40817) · [PDF](https://arxiv.org/pdf/2611.40817)
- 📊 **Evaluation Logs** · [Hugging Face](https://huggingface.co/Skywalker0410/CodingDINO-evallog) · [ModelScope](https://www.modelscope.ai/models/Skywalker0410/CodingDINO-evallog) (coming soon)
- 🛠️ **Usage** · [Quick start](#start-en) · [Evaluation worker](#worker-en) · [Benchmarks](#bench-en)

# Model Overview

### Description

CodingDINO is a 27B vision-language model trained with agentic reinforcement learning to represent images and videos as executable programs. It extends DINO’s consistency principle to 2D and 3D reconstruction by comparing each target with what its own code renders at the same viewpoint or timestamp. Code makes layout, geometry and motion explicit and editable. In one Blender reconstruction, for example, a single parameter controls the number of petals on a rose.

The same checkpoint supports two inference settings. **CodingDINO-Single** writes a program in one pass without rendering feedback. In the interactive setting, **CodingDINO** can inspect rendered views and execution diagnostics and revise its code. Across six benchmarks, the interactive model ranks first on **10 of 12** headline metrics. The first draft retains **85.4%** of multi-turn quality, computed by averaging the single-pass to multi-turn score ratio across the 12 metrics.

### Demo Videos

<video controls playsinline preload="none" width="100%" poster="https://huggingface.co/Skywalker0410/CodingDINO/resolve/main/assets/demo-poster.jpg" src="https://huggingface.co/Skywalker0410/CodingDINO/resolve/main/assets/demo.mp4"></video>

### License/Terms of Use

CodingDINO is released under [Apache 2.0](LICENSE). The [original base-model license](LICENSE.base-model) and [attributions](NOTICE.md) accompany the checkpoint. Third-party materials retain their respective rights and terms.

## News

- **Model weights [11/30/2026]** · The [CodingDINO checkpoint](https://huggingface.co/Skywalker0410/CodingDINO/tree/main) is available on Hugging Face.
- **Evaluation logs [11/30/2026]** · We released [sample scores and run logs for six benchmarks](https://huggingface.co/Skywalker0410/CodingDINO-evallog).
- **Paper [11/30/2026]** · Read the paper on [arXiv](https://arxiv.org/abs/2611.40817) or [Hugging Face Papers](https://huggingface.co/papers/2611.40817). [PDF](https://arxiv.org/pdf/2611.40817)
- **Project page [11/27/2026]** · The [CodingDINO project page](https://skywalker-yqz.github.io/CodingDINO/) is online.

<details>
<summary>Citation</summary>

```bibtex

```

</details>

## Model Architecture

CodingDINO starts from Qwen3.8-27B. A vision encoder of width 1,152 feeds a 64-layer language backbone of width 5,120 that combines gated delta-rule layers with causal attention. This release contains the checkpoint at RL step 65 and loads with `Qwen3_5ForConditionalGeneration` in Transformers.

Supervised fine-tuning uses DeepSeek-V4.1-Flash trajectories whose final programs pass execution and rendering checks. During multi-turn reinforcement learning, Group Relative Policy Optimization (GRPO) compares the model’s own attempts at the same task. Invalid submissions earn zero reward. For valid programs, frozen DINOv2-L and DINOv3-L/16 encoders measure how closely the final render resembles the target. For Three.js and Blender, the reward also compares relative-depth maps estimated by Depth Anything V2 Small. A video receives the mean score over corresponding timestamps.

<p align="center"><img src="https://huggingface.co/Skywalker0410/CodingDINO/resolve/main/assets/framework.png" width="100%" alt="Visual coding environment and agentic reinforcement learning" /></p>

## Inputs and Outputs

| Input | What you receive |
| --- | --- |
| Image and requested program type | A single chat request returns candidate source in the assistant message. A screenshot can become HTML, a diagram can become SVG, and an object image can become a Blender script. |
| Image or video, task instructions and any permitted assets passed to the harness | On successful submission, `submitted/` contains the verified entry file and supporting source. For video, one program generates the sequence from shared objects, state and motion rules. The run writes its outcome to `result.json` and its interaction history to `episode/`. |

<a id="start-en"></a>

## Inference

### Environment

| Component | Reference setup |
| --- | --- |
| Model server | Linux, Python 3.13, vLLM 0.29.0, Transformers 5.12.1 |
| Evaluation replica | 4 × NVIDIA H800, tensor parallelism 4, BF16. PyTorch 2.13.0+cu130 and Triton 3.7.1 |
| Evaluation worker | Hopper (SM 9.x), Flash Linear Attention and fla-core 0.5.2, Transformer Engine 2.18.0 with CUDA 13, matching learner environment |
| Rendering client | Python 3.12+, OpenHands, NeMo Gym and the renderer for the output format. Video also uses FFmpeg and ffprobe |

### Start a model server

Download the full checkpoint. Keep the tokenizer, weight shards and `native-gdn/` together. On a Linux GPU host with a CUDA 13-compatible driver, the following starts a local OpenAI-compatible server with a 32,768-token window.

```bash
python3.13 -m venv .venv-codingdino
source .venv-codingdino/bin/activate
python -m pip install 'vllm==0.29.0' huggingface_hub
hf download Skywalker0410/CodingDINO --local-dir ./CodingDINO-model
export MODEL_DIR="$(realpath ./CodingDINO-model)"
vllm serve "$MODEL_DIR" --served-model-name CodingDINO \
  --host 127.0.0.1 --port 8000 --tensor-parallel-size 4 --dtype bfloat16 \
  --max-model-len 32768 --enable-prefix-caching --reasoning-parser qwen3 \
  --enable-auto-tool-choice --tool-call-parser qwen3_coder
```

In a second terminal, check that the service lists `CodingDINO`. Put an image named `target.png` in the current directory, then run the Python example to print the SVG response.

```bash
curl -fsS http://127.0.0.1:8000/v1/models
```

<details>
<summary>PNG → SVG · Python example</summary>

```python
import base64
import json
from pathlib import Path
from urllib.request import Request, urlopen

image = base64.b64encode(Path("target.png").read_bytes()).decode("ascii")
body = {
    "model": "CodingDINO",
    "messages": [{
        "role": "user",
        "content": [
            {"type": "image_url", "image_url": {"url": f"data:image/png;base64,{image}"}},
            {"type": "text", "text": "Reconstruct this image as editable SVG. Return the SVG source."},
        ],
    }],
    "chat_template_kwargs": {
        "enable_thinking": True, "preserve_thinking": True, "reasoning_effort": "xhigh",
    },
    "thinking_token_budget": 4096,
    "max_tokens": 20480,
    "temperature": 0.6,
    "top_p": 0.95,
}
request = Request("http://127.0.0.1:8000/v1/chat/completions",
                  data=json.dumps(body).encode(), headers={"Content-Type": "application/json"})
with urlopen(request, timeout=600) as response:
    print(json.load(response)["choices"][0]["message"]["content"])
```

</details>

## Inference Infrastructure

<a id="worker-en"></a>

### Serve the evaluation worker

The index maps the model parameters to 18 weight shards and one frozen MTP file. The additional tensor file in `native-gdn/` supplies the evaluated worker with the native normalization weights. Serve the directory containing `config.json`.

The released benchmark run used a 262,144-token context and a dedicated vLLM worker on four H800s per replica. The worker restores 48 native BF16 Gated DeltaNet normalization tensors from `native-gdn/` and checks their fingerprints. The frozen MTP weights provide three speculative tokens. To use the same configuration, stop the standard server, activate the matching vLLM environment and set the three local paths below.

Set `MODEL_DIR` to the downloaded checkpoint, `CODE_REPO` to the code checkout that provides `Mix60BenchWorker`, and `LEARNER_PYTHON` to the interpreter containing the matching FLA and Transformer Engine kernels. The launcher points `V2C_MIX60_EXPORT_ROOT` at the native tensors and explicitly selects checkpoint step `65`.

<details>
<summary>Launch one evaluation replica · Bash</summary>

```bash
export MODEL_DIR=/absolute/path/to/Model
export CODE_REPO=/absolute/path/to/CodingDINO
LEARNER_PYTHON=/absolute/path/to/learner-env/bin/python

export SVG_INFERENCE_PACKAGES="$(python -c 'import sysconfig; print(sysconfig.get_path("purelib"))')"
export SVG_LEARNER_PACKAGES="$("$LEARNER_PYTHON" -c 'import sysconfig; print(sysconfig.get_path("purelib"))')"
export CUDNN_HOME="$SVG_LEARNER_PACKAGES/nvidia/cudnn"
export CUDNN_PATH="$CUDNN_HOME"
export LD_LIBRARY_PATH="$CUDNN_HOME/lib:$SVG_LEARNER_PACKAGES/z3/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
export PYTHONPATH="$CODE_REPO/research/vision2code_bench:$CODE_REPO/research/vision2code_agentic_rl/src:$CODE_REPO${PYTHONPATH:+:$PYTHONPATH}"

export V2C_MIX60_EXPORT_ROOT="$MODEL_DIR/native-gdn"
export V2C_EXPECTED_CHECKPOINT_STEP=65
export V2C_EVALUATION_ROOT="$(mktemp -d)"
export V2C_REPLICA_NAME=local
export CUDA_VISIBLE_DEVICES=0,1,2,3
export VLLM_USE_V2_MODEL_RUNNER=0 VLLM_GDN_DECODE_KERNEL=triton
export VLLM_ALLREDUCE_USE_SYMM_MEM=0 VLLM_FLASHINFER_ALLREDUCE_BACKEND=trtllm
export SVG_VLLM_PRESERVE_MM_PREFIX_PAYLOAD=1 SVG_VLLM_MM_PREFIX_REPLAY_WORKAROUND=1

python -m vllm.entrypoints.openai.api_server \
  --model "$MODEL_DIR" --served-model-name CodingDINO --host 127.0.0.1 --port 8000 \
  --tensor-parallel-size 4 --dtype bfloat16 --kv-cache-dtype auto \
  --max-model-len 262144 --gpu-memory-utilization 0.88 \
  --max-num-seqs 16 --max-num-batched-tokens 8192 \
  --worker-cls harness_v1_eval.mix60_worker.Mix60BenchWorker \
  --mamba-cache-mode align --mamba-ssm-cache-dtype float32 --block-size 1600 \
  --gdn-prefill-backend triton --enable-prefix-caching --async-scheduling \
  --attention-config '{"flash_attn_version":4,"flash_attn_max_num_splits_for_cuda_graph":16}' \
  --compilation-config '{"pass_config":{"fuse_allreduce_rms":false}}' \
  --hf-overrides '{"head_dtype":"bfloat16"}' --logprobs-mode raw_logprobs \
  --mm-processor-cache-gb 0 --skip-mm-profiling --limit-mm-per-prompt '{"image":512}' \
  --enable-auto-tool-choice --tool-call-parser qwen3_coder --reasoning-parser qwen3 \
  --default-chat-template-kwargs '{"enable_thinking":false,"preserve_thinking":true,"reasoning_effort":"medium"}' \
  --speculative-config '{"method":"mtp","num_speculative_tokens":3,"rejection_sample_method":"standard"}' \
  --trust-remote-code --seed 20261116
```

</details>

Each GPU worker writes a load receipt under `V2C_EVALUATION_ROOT`. [Native tensor checks](native-gdn/README.md) · [Distributed evaluation](https://github.com/Skywalker-yqz/CodingDINO/tree/HEAD/research/vision2code_bench/harness_v1_eval)

### Run the rendering harness

The harness gives each task its own workspace. After an edit, the model can render the program and inspect a crop beside the corresponding region of the target. For video, it can check selected timestamps while revising. The final render must cover the full prescribed sequence.

With the 262,144-token endpoint running, use the client environment in a second terminal. Set `CODE_REPO` to the code checkout. Copy `vision2code_harness_v1.yaml`, point `context_tokenizer` at the checkpoint and set `shell_base` and the renderer paths for your output format. The examples reconstruct a PNG as SVG and a video as a Three.js scene. [Harness configuration](https://github.com/Skywalker-yqz/CodingDINO/tree/HEAD/research/vision2code_agentic_rl/configs/harness)

<details>
<summary>Run image and video examples · Bash</summary>

```bash
export CODE_REPO=/absolute/path/to/CodingDINO
export V2C_AGENT_PYTHON=/absolute/path/to/agent-env/bin/python
export V2C_AGENT_RUNTIME=/absolute/path/to/agent-runtime
export V2C_RL_DEPENDENCIES=/absolute/path/to/rl-dependencies
export NEMO_RL_UID_GID_POOL_CONFIG=/absolute/path/to/identity-pool.yaml
cd "$CODE_REPO"
HARNESS_CONFIG=/absolute/path/to/your-harness.yaml
./v2c infer --input /absolute/path/to/target.png --task svg \
  --config "$HARNESS_CONFIG" --thinking xhigh --context-tokens 262144 \
  --endpoint http://127.0.0.1:8000/v1/chat/completions --model CodingDINO \
  --output ./outputs/codingdino-svg

./v2c infer --input /absolute/path/to/motion.mp4 --task threejs \
  --config "$HARNESS_CONFIG" --thinking xhigh --context-tokens 262144 \
  --endpoint http://127.0.0.1:8000/v1/chat/completions --model CodingDINO \
  --output ./outputs/codingdino-threejs
```

</details>

<a id="bench-en"></a>

## Evaluation

The paper selects two headline metrics per benchmark, one for appearance and one for structure or motion. On Code2Video-Compass, CodingDINO scores **0.837** on appearance fidelity and **0.520** on motion fidelity, compared with 0.787 and 0.445 for Opus 5.5. On 3DHarnessBench, other models lead both headline metrics. [Benchmark results (Tables 1–6)](https://arxiv.org/pdf/2611.40817#page=8)

| Benchmark | Reconstruction task |
| --- | --- |
| [3DHarnessBench](https://huggingface.co/datasets/lingada/3DHarnessBench) | Single view → Blender scene |
| [CC-HARD](https://huggingface.co/datasets/xcodemind/CC-HARD) | Web screenshot → HTML |
| [VFIG-Bench](https://huggingface.co/datasets/QijiaHe/VFIG-Bench) | Scientific figure → SVG |
| [DrawAI-Bench](https://huggingface.co/datasets/caopu/DrawAI-Bench-Lite) | Reference image → editable graphics |
| [AnimWeb-Bench](https://github.com/starry1001/AnimWeb) | Reference animation → animated web page |
| [Code2Video-Compass (V2V)](https://github.com/code2video-compass/Code2Video-Compass) | Reference clip → code that renders the video |

CodingDINO and its teacher DeepSeek-V4.1-Flash were evaluated on the same 90 tasks at render budgets of 1, 2, 4 and 6. Across these budgets, the teacher used **5.0–6.9×** as many tokens on average as CodingDINO. At four renders, mean cumulative input and output tokens were 0.528 million for CodingDINO and 2.635 million for the teacher. [Inference measurements (Table 12)](https://arxiv.org/pdf/2611.40817#page=23)

The released logs cover the step-65 checkpoint evaluated with Vision2Code Harness v1.1, `xhigh` reasoning and context compaction. The run recorded 1,550 submissions for 1,555 available inputs, with up to 12 renders per task. Each turn allowed 20,480 output tokens including a 4,096-token thinking budget. Sampling used temperature 0.6 and top-p 0.95. The CLI examples above use the v1 client. Match `sample_id` across the scores and events to inspect a run. [Run settings](https://huggingface.co/Skywalker0410/CodingDINO-evallog/blob/main/run.json)

Per-sample scores and event logs: [Hugging Face](https://huggingface.co/Skywalker0410/CodingDINO-evallog) · [ModelScope](https://www.modelscope.ai/models/Skywalker0410/CodingDINO-evallog) (coming soon).

<p align="center"><img src="https://huggingface.co/Skywalker0410/CodingDINO/resolve/main/assets/benchmark-results.png" width="100%" alt="Reconstruction performance across six benchmarks" /></p>

### Editable Scenes

The paper changes one line in each of three reconstructed Three.js programs and renders the same instant again. Raising the freeway camera reveals the truck’s roof while traffic follows its original paths. Tripling the carton’s width leaves the robot’s carrying motion intact. Keeping the ninth of thirteen horses preserves that horse’s trajectory and the phase of its stride.

<p align="center"><img src="https://huggingface.co/Skywalker0410/CodingDINO/resolve/main/assets/editable-scenes.png" width="100%" alt="Original and edited Three.js renders at matching timestamps" /></p>

---

<!-- model-card-language: zh-CN -->

<a id="chinese"></a>

# <img src="https://huggingface.co/Skywalker0410/CodingDINO/resolve/main/assets/logo.png" width="40" style="display: inline-block; vertical-align: middle; margin: 0;" alt="CodingDINO" /> CodingDINO:通过智能体强化学习,将所见表示为代码

[English](#english) | **简体中文**

<p align="center" style="margin: 0;"><img src="https://huggingface.co/Skywalker0410/CodingDINO/resolve/main/assets/teaser.png" width="100%" alt="输入图像、视频与相应程序的渲染结果" style="display: block; margin: 0;" /></p>

## 🔗 快速链接

- 🤗 **Hugging Face** · [CodingDINO](https://huggingface.co/Skywalker0410/CodingDINO)
- <img src="https://huggingface.co/Skywalker0410/CodingDINO/resolve/main/assets/modelscope-logo.svg" width="22" height="20" style="display: inline-block; vertical-align: middle; margin: 0;" alt="ModelScope" /> **ModelScope** · [CodingDINO](https://www.modelscope.ai/models/Skywalker0410/CodingDINO) (待发布)
- 🌐 **项目主页** · [CodingDINO](https://skywalker-yqz.github.io/CodingDINO/)
- 💻 **GitHub 仓库** · [Skywalker-yqz/CodingDINO](https://github.com/Skywalker-yqz/CodingDINO)
- 📄 **论文** · [arXiv:2611.40817](https://arxiv.org/abs/2611.40817) · [PDF](https://arxiv.org/pdf/2611.40817)
- 📊 **评测日志** · [Hugging Face](https://huggingface.co/Skywalker0410/CodingDINO-evallog) · [ModelScope](https://www.modelscope.ai/models/Skywalker0410/CodingDINO-evallog) (待发布)
- 🛠️ **使用指南** · [快速开始](#start-zh) · [评测 worker](#worker-zh) · [评测基准](#bench-zh)

# 模型概述

### 模型介绍

CodingDINO 是一个 27B 视觉语言模型,通过智能体强化学习将图像和视频表示为可执行程序。它将 DINO 的一致性学习用于二维和三维重建,比较目标画面与程序在相同视角或时间点的渲染结果,从中学习视觉表征。布局、几何结构和运动都通过代码显式表达,可以直接查看和编辑。例如,在重建玫瑰的 Blender 脚本中,一个参数就决定了花瓣数量。

同一份权重支持两种推理方式。**CodingDINO-Single** 根据输入一次写出程序,不使用渲染反馈。交互式 **CodingDINO** 可以查看渲染结果和执行诊断,再修改代码。在六个基准的 12 项主要指标中,交互式模型有 **10 项排名第一**。逐项计算单轮得分与多轮得分之比,再对 12 项指标取等权平均,初稿保留了多轮重建质量的 **85.4%**。

### 演示视频

<video controls playsinline preload="none" width="100%" poster="https://huggingface.co/Skywalker0410/CodingDINO/resolve/main/assets/demo-poster.jpg" src="https://huggingface.co/Skywalker0410/CodingDINO/resolve/main/assets/demo.mp4"></video>

### 许可证与使用条款

CodingDINO 以 [Apache 2.0](LICENSE) 发布。仓库随附[底座模型的原始许可证](LICENSE.base-model)和[版权归属说明](NOTICE.md)。第三方材料保留各自的权利和许可条款。

## 发布动态

- **模型权重 [2026/11/30]** · [CodingDINO 权重](https://huggingface.co/Skywalker0410/CodingDINO/tree/main)已在 Hugging Face 上线。
- **评测日志 [2026/11/30]** · 已发布[六项基准的逐样本分数和运行日志](https://huggingface.co/Skywalker0410/CodingDINO-evallog)。
- **论文 [2026/11/30]** · 论文可在 [arXiv](https://arxiv.org/abs/2611.40817) 和 [Hugging Face Papers](https://huggingface.co/papers/2611.40817) 查看。[PDF](https://arxiv.org/pdf/2611.40817)
- **项目主页 [2026/11/27]** · [CodingDINO 项目主页](https://skywalker-yqz.github.io/CodingDINO/)上线。

<details>
<summary>引用</summary>

```bibtex

```

</details>

## 模型架构

CodingDINO 以 Qwen3.8-27B 为底座。视觉编码器的隐藏维度为 1,152,语言主干有 64 层,隐藏维度为 5,120,结合了门控 Delta 规则层和因果注意力层。本仓库发布强化学习第 65 步的权重,可使用 Transformers 的 `Qwen3_5ForConditionalGeneration` 加载。

监督微调使用 DeepSeek-V4.1-Flash 生成的交互轨迹,其中最终提交的程序均通过执行和渲染检查。在多轮强化学习阶段,组相对策略优化(GRPO)比较模型对同一任务的多次尝试。无效提交的奖励为零。对于有效程序,冻结的 DINOv2-L 和 DINOv3-L/16 编码器衡量最终渲染图与目标图像的外观相似度。Three.js 和 Blender 任务还会比较 Depth Anything V2 Small 估计的相对深度图。视频奖励取对应时间点得分的平均值。

<p align="center"><img src="https://huggingface.co/Skywalker0410/CodingDINO/resolve/main/assets/framework.png" width="100%" alt="视觉编程环境与智能体强化学习" /></p>

## 输入与输出

| 输入 | 输出 |
| --- | --- |
| 图像与目标程序类型 | 单次请求在助手回复中返回候选源码。例如,网页截图可以重建为 HTML,示意图可以重建为 SVG,物体图像可以重建为 Blender 脚本。 |
| 传给交互环境的图像或视频、任务要求及允许使用的素材 | 成功提交后,`submitted/` 中包含已验证的入口文件及配套源码。对于视频,同一个程序通过跨帧共享的对象、状态和运动规则生成完整序列。运行结果写入 `result.json`,交互记录写入 `episode/`。 |

<a id="start-zh"></a>

## 推理部署

### 环境

| 组件 | 参考环境 |
| --- | --- |
| 模型服务 | Linux、Python 3.13、vLLM 0.29.0、Transformers 5.12.1 |
| 评测副本 | 4 × NVIDIA H800,张量并行度 4,BF16。PyTorch 2.13.0+cu130、Triton 3.7.1 |
| 评测 worker | Hopper(SM 9.x)、Flash Linear Attention 与 fla-core 0.5.2、带 CUDA 13 扩展的 Transformer Engine 2.18.0,以及版本匹配的训练环境 |
| 渲染客户端 | Python 3.12+、OpenHands、NeMo Gym,以及目标格式对应的渲染器。视频还需 FFmpeg 和 ffprobe |

### 启动模型服务

下载完整模型,让分片权重、分词器和 `native-gdn/` 保持在同一目录。以下命令适用于驱动兼容 CUDA 13 的 Linux GPU 主机,会启动一个上下文窗口为 32,768 token 的本地 OpenAI 兼容服务。

```bash
python3.13 -m venv .venv-codingdino
source .venv-codingdino/bin/activate
python -m pip install 'vllm==0.29.0' huggingface_hub
hf download Skywalker0410/CodingDINO --local-dir ./CodingDINO-model
export MODEL_DIR="$(realpath ./CodingDINO-model)"
vllm serve "$MODEL_DIR" --served-model-name CodingDINO \
  --host 127.0.0.1 --port 8000 --tensor-parallel-size 4 --dtype bfloat16 \
  --max-model-len 32768 --enable-prefix-caching --reasoning-parser qwen3 \
  --enable-auto-tool-choice --tool-call-parser qwen3_coder
```

在另一个终端确认模型列表里出现 `CodingDINO`。将一张名为 `target.png` 的图像放在当前目录,运行下方 Python 示例即可打印模型返回的 SVG。

```bash
curl -fsS http://127.0.0.1:8000/v1/models
```

<details>
<summary>PNG → SVG · Python 示例</summary>

```python
import base64
import json
from pathlib import Path
from urllib.request import Request, urlopen

image = base64.b64encode(Path("target.png").read_bytes()).decode("ascii")
body = {
    "model": "CodingDINO",
    "messages": [{
        "role": "user",
        "content": [
            {"type": "image_url", "image_url": {"url": f"data:image/png;base64,{image}"}},
            {"type": "text", "text": "Reconstruct this image as editable SVG. Return the SVG source."},
        ],
    }],
    "chat_template_kwargs": {
        "enable_thinking": True, "preserve_thinking": True, "reasoning_effort": "xhigh",
    },
    "thinking_token_budget": 4096,
    "max_tokens": 20480,
    "temperature": 0.6,
    "top_p": 0.95,
}
request = Request("http://127.0.0.1:8000/v1/chat/completions",
                  data=json.dumps(body).encode(), headers={"Content-Type": "application/json"})
with urlopen(request, timeout=600) as response:
    print(json.load(response)["choices"][0]["message"]["content"])
```

</details>

## 推理基础设施

<a id="worker-zh"></a>

### 启动评测 worker

索引将模型参数映射到 18 个权重分片和 1 个冻结的 MTP 文件。`native-gdn/` 单独提供评测 worker 所需的原生归一化权重。启动时,模型路径应指向含 `config.json` 的目录。

本次发布的评测日志来自专用的 vLLM worker,每个服务副本配备四张 H800,使用 262,144 token 的上下文。worker 从 `native-gdn/` 恢复 48 个 BF16 Gated DeltaNet 归一化张量,并逐个核对指纹。冻结的 MTP 权重用于每步提出三个推测 token。要使用相同配置,先停止上面的标准服务,激活匹配的 vLLM 环境,再填写下方三个本地路径。

将 `MODEL_DIR` 设为下载的权重目录,`CODE_REPO` 设为提供 `Mix60BenchWorker` 的代码仓库,`LEARNER_PYTHON` 设为含匹配版本 FLA 和 Transformer Engine 的 Python 解释器。启动命令将 `V2C_MIX60_EXPORT_ROOT` 指向原生张量目录,并显式指定检查点步数 `65`。

<details>
<summary>启动一个评测副本 · Bash</summary>

```bash
export MODEL_DIR=/absolute/path/to/Model
export CODE_REPO=/absolute/path/to/CodingDINO
LEARNER_PYTHON=/absolute/path/to/learner-env/bin/python

export SVG_INFERENCE_PACKAGES="$(python -c 'import sysconfig; print(sysconfig.get_path("purelib"))')"
export SVG_LEARNER_PACKAGES="$("$LEARNER_PYTHON" -c 'import sysconfig; print(sysconfig.get_path("purelib"))')"
export CUDNN_HOME="$SVG_LEARNER_PACKAGES/nvidia/cudnn"
export CUDNN_PATH="$CUDNN_HOME"
export LD_LIBRARY_PATH="$CUDNN_HOME/lib:$SVG_LEARNER_PACKAGES/z3/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
export PYTHONPATH="$CODE_REPO/research/vision2code_bench:$CODE_REPO/research/vision2code_agentic_rl/src:$CODE_REPO${PYTHONPATH:+:$PYTHONPATH}"

export V2C_MIX60_EXPORT_ROOT="$MODEL_DIR/native-gdn"
export V2C_EXPECTED_CHECKPOINT_STEP=65
export V2C_EVALUATION_ROOT="$(mktemp -d)"
export V2C_REPLICA_NAME=local
export CUDA_VISIBLE_DEVICES=0,1,2,3
export VLLM_USE_V2_MODEL_RUNNER=0 VLLM_GDN_DECODE_KERNEL=triton
export VLLM_ALLREDUCE_USE_SYMM_MEM=0 VLLM_FLASHINFER_ALLREDUCE_BACKEND=trtllm
export SVG_VLLM_PRESERVE_MM_PREFIX_PAYLOAD=1 SVG_VLLM_MM_PREFIX_REPLAY_WORKAROUND=1

python -m vllm.entrypoints.openai.api_server \
  --model "$MODEL_DIR" --served-model-name CodingDINO --host 127.0.0.1 --port 8000 \
  --tensor-parallel-size 4 --dtype bfloat16 --kv-cache-dtype auto \
  --max-model-len 262144 --gpu-memory-utilization 0.88 \
  --max-num-seqs 16 --max-num-batched-tokens 8192 \
  --worker-cls harness_v1_eval.mix60_worker.Mix60BenchWorker \
  --mamba-cache-mode align --mamba-ssm-cache-dtype float32 --block-size 1600 \
  --gdn-prefill-backend triton --enable-prefix-caching --async-scheduling \
  --attention-config '{"flash_attn_version":4,"flash_attn_max_num_splits_for_cuda_graph":16}' \
  --compilation-config '{"pass_config":{"fuse_allreduce_rms":false}}' \
  --hf-overrides '{"head_dtype":"bfloat16"}' --logprobs-mode raw_logprobs \
  --mm-processor-cache-gb 0 --skip-mm-profiling --limit-mm-per-prompt '{"image":512}' \
  --enable-auto-tool-choice --tool-call-parser qwen3_coder --reasoning-parser qwen3 \
  --default-chat-template-kwargs '{"enable_thinking":false,"preserve_thinking":true,"reasoning_effort":"medium"}' \
  --speculative-config '{"method":"mtp","num_speculative_tokens":3,"rejection_sample_method":"standard"}' \
  --trust-remote-code --seed 20261116
```

</details>

每个 GPU worker 会在 `V2C_EVALUATION_ROOT` 下写入加载记录。[原生张量校验](native-gdn/README.md) · [分布式评测](https://github.com/Skywalker-yqz/CodingDINO/tree/HEAD/research/vision2code_bench/harness_v1_eval)

### 运行交互式渲染

每个任务都有独立的工作目录。模型修改代码后可以执行渲染,将局部渲染图与目标图像中的对应区域并排比较。处理视频时,模型可以在修改过程中选取时间点查看,最终渲染则须覆盖任务指定的完整序列。

保持 262,144 token 服务运行,在另一终端进入客户端环境,将 `CODE_REPO` 指向代码仓库。复制 `vision2code_harness_v1.yaml`,将 `context_tokenizer` 指向权重目录,再配置 `shell_base` 和对应输出格式的渲染器路径。下面两个例子分别把 PNG 重建为 SVG,把视频重建为 Three.js 场景。[交互环境配置](https://github.com/Skywalker-yqz/CodingDINO/tree/HEAD/research/vision2code_agentic_rl/configs/harness)

<details>
<summary>运行图像和视频示例 · Bash</summary>

```bash
export CODE_REPO=/absolute/path/to/CodingDINO
export V2C_AGENT_PYTHON=/absolute/path/to/agent-env/bin/python
export V2C_AGENT_RUNTIME=/absolute/path/to/agent-runtime
export V2C_RL_DEPENDENCIES=/absolute/path/to/rl-dependencies
export NEMO_RL_UID_GID_POOL_CONFIG=/absolute/path/to/identity-pool.yaml
cd "$CODE_REPO"
HARNESS_CONFIG=/absolute/path/to/your-harness.yaml
./v2c infer --input /absolute/path/to/target.png --task svg \
  --config "$HARNESS_CONFIG" --thinking xhigh --context-tokens 262144 \
  --endpoint http://127.0.0.1:8000/v1/chat/completions --model CodingDINO \
  --output ./outputs/codingdino-svg

./v2c infer --input /absolute/path/to/motion.mp4 --task threejs \
  --config "$HARNESS_CONFIG" --thinking xhigh --context-tokens 262144 \
  --endpoint http://127.0.0.1:8000/v1/chat/completions --model CodingDINO \
  --output ./outputs/codingdino-threejs
```

</details>

<a id="bench-zh"></a>

## 评测

论文在每个基准上选取两项主要指标,一项衡量外观,另一项衡量结构或运动。在 Code2Video-Compass 上,CodingDINO 的外观保真度为 **0.837**,运动保真度为 **0.520**,Opus 5.5 的对应得分为 0.787 和 0.445。在 3DHarnessBench 上,两项主要指标均由其他模型领先。[完整评测结果(表 1–6)](https://arxiv.org/pdf/2611.40817#page=8)

| 基准 | 重建任务 |
| --- | --- |
| [3DHarnessBench](https://huggingface.co/datasets/lingada/3DHarnessBench) | 单视图 → Blender 场景 |
| [CC-HARD](https://huggingface.co/datasets/xcodemind/CC-HARD) | 网页截图 → HTML |
| [VFIG-Bench](https://huggingface.co/datasets/QijiaHe/VFIG-Bench) | 科研图表 → SVG |
| [DrawAI-Bench](https://huggingface.co/datasets/caopu/DrawAI-Bench-Lite) | 参考图像 → 可编辑图形 |
| [AnimWeb-Bench](https://github.com/starry1001/AnimWeb) | 参考动画 → 网页动画 |
| [Code2Video-Compass (V2V)](https://github.com/code2video-compass/Code2Video-Compass) | 参考视频 → 能渲染该视频的程序 |

在相同的 90 个配对任务上,渲染预算分别为 1、2、4 和 6 次时,教师模型 DeepSeek-V4.1-Flash 的平均 token 用量为 CodingDINO 的 **5.0–6.9 倍**。以 4 次渲染为例,每个任务累计输入与输出 token 的均值为 52.8 万(CodingDINO)和 263.5 万(教师模型)。[推理开销(表 12)](https://arxiv.org/pdf/2611.40817#page=23)

发布的日志记录了第 65 步权重在 Vision2Code Harness v1.1 下的评测,推理强度为 `xhigh`,启用上下文压缩。每个任务最多渲染 12 次,1,555 个有输入的任务中有 1,550 个产生了提交。每轮最多输出 20,480 个 token,其中思考预算为 4,096 个 token。采样温度为 0.6,top-p 为 0.95。上方命令行示例使用 v1 客户端。按 `sample_id` 可对照同一任务的分数与交互记录。[运行配置](https://huggingface.co/Skywalker0410/CodingDINO-evallog/blob/main/run.json)

逐样本分数与运行日志:[Hugging Face](https://huggingface.co/Skywalker0410/CodingDINO-evallog) · [ModelScope](https://www.modelscope.ai/models/Skywalker0410/CodingDINO-evallog)(待发布)。

<p align="center"><img src="https://huggingface.co/Skywalker0410/CodingDINO/resolve/main/assets/benchmark-results.png" width="100%" alt="六个基准上的重建表现" /></p>

### 可编辑场景

论文在三个由 Three.js 重建的场景中各修改一行代码,再渲染同一时刻。抬高高速公路场景的相机后,卡车车顶进入视野,车辆仍沿原有轨迹行驶。将纸箱宽度改为原来的三倍后,机器人仍按原路径搬运。只保留 13 匹马中的第 9 匹后,这匹马的轨迹和对应时刻的步态也保持一致。

<p align="center"><img src="https://huggingface.co/Skywalker0410/CodingDINO/resolve/main/assets/editable-scenes.png" width="100%" alt="同一时间点的 Three.js 原始渲染与编辑结果" /></p>