Skywalker-yqz/CodingDINO
حول
We introduce CodingDINO, a unified agentic reinforcement learning (RL) framework for learning internal visual representations through code-based reconstruction. Inspired by DINO, our approach uses observation-to-render consistency as a general learning principle across 2D and 3D images and videos.
التصميم والوسائطما يمكنك فعله
- We propose CodingDINO, a framework that jointly trains a vision-to-code model with a unified harness and agentic RL across 2D and 3D, images and videos. This self-training, driven by the consistency between what we see and what the code draws, carries DINO’s label-free principle from features to programs.
- We study code as a visual representation for LLMs and isolate what interactive training puts into the model. As with a frozen DINO feature, we read the representation out in one pass, and we show that training in the loop improves first draft and reduces the renders needed at inference.
- CodingDINO surpasses its base model and its teacher and rivals frontier LLMs such as Opus 5.5 and GPT-6 Astra. Across six benchmarks it ranks first on 10 of 12 headline metrics and in the top three on 10. Without rendering feedback, CodingDINO-Single retains 85.4% of multi-turn quality on average across those 12 metrics.
النمو المقاس للنجوم
- خلال 24 ساعة
- +١٢
- خلال 7 أيام
- جارٍ جمع السجل
- خلال 15 يومًا
- جارٍ جمع السجل
- خلال شهر
- جارٍ جمع السجل
تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.
README.md
الأصلEnglish | 简体中文
Learning to Represent What We See as Code with Agentic Reinforcement Learning
Demo Video · Deployment · Quick Start · Training · Evaluation · Citation

📰 News
- 2026-12-01 · The CodingDINO code is now available.
- 2026-11-30 · The model weights are available on Hugging Face.
- 2026-11-30 · The CodingDINO paper is available on arXiv (PDF).
- 2026-11-27 · The project page is live.
🧭 Contents
- Highlights · Code as a Visual Representation · Demo Video · Results
- Download · Deployment Options · Environment Setup · Connect to vLLM
- Harness · Quick Start · Batch Inference · Tasks & Outputs
- Training · Evaluation · Documentation · Citation · License
✨ Highlights
- We propose CodingDINO, a framework that jointly trains a vision-to-code model with a unified harness and agentic RL across 2D and 3D, images and videos. This self-training, driven by the consistency between what we see and what the code draws, carries DINO’s label-free principle from features to programs.
- We study code as a visual representation for LLMs and isolate what interactive training puts into the model. As with a frozen DINO feature, we read the representation out in one pass, and we show that training in the loop improves first draft and reduces the renders needed at inference.
- CodingDINO surpasses its base model and its teacher and rivals frontier LLMs such as Opus 5.5 and GPT-6 Astra. Across six benchmarks it ranks first on 10 of 12 headline metrics and in the top three on 10. Without rendering feedback, CodingDINO-Single retains 85.4% of multi-turn quality on average across those 12 metrics.
🧩 Code as a Visual Representation
Reconstructing images and videos as executable programs makes appearance, geometry, and temporal dynamics explicit. LLMs can directly inspect, reason over, and edit the resulting compositional representations.
CodingDINO-Single and CodingDINO share the same weights. CodingDINO-Single writes the program directly from the input in one pass. With the harness, CodingDINO can inspect renders and revise the program.
🎬 Demo Video
📦 Download the Code and Model
Use the local code checkout and a compatible checkpoint with its tokenizer. The harness accepts a local base model or a Hugging Face export. Run the examples below from the repository root.
GitHub · Hugging Face · ModelScope (coming soon)
🧰 Deployment Options
| Goal | What to run | Entry point |
|---|---|---|
| Reconstruct one image or video | The supplied inference client, an external vLLM endpoint and a renderer for the target format | vLLM · Quick Start |
| Process a collection | A shared model endpoint and a JSONL input manifest with separate agent and render concurrency | Batch inference |
| Train a policy | Full-parameter SFT on H800 or PPU SDK22, then multi-turn Agentic RL with GRPO | Training |
| Score a checkpoint | The distributed generation runner and official scoring stage | Evaluation |
🛠️ Environment Setup
The model server and agent can run in separate environments. The server needs a compatible vLLM GPU environment. The agent needs Linux, Python 3.12+, OpenHands, the Gym runtime and the renderer for each selected task. Supply the runtime directories separately.
Before starting a job, set the UID/GID pool path on every node that runs agent or training workers. Follow the sandbox identity setup.
Copy the harness YAML and set the paths in your copy. Pass it with --config at inference. The agent launcher expects OpenHands/ and agent_venv/ under V2C_AGENT_RUNTIME, and Gym-workspace/Gym under V2C_RL_DEPENDENCIES.
| YAML field | Point it to |
|---|---|
context_tokenizer |
The local tokenizer directory matching the served checkpoint |
shell_base |
The prepared Linux shell sandbox |
runtime_profiles.<profile>.base |
The browser sandbox for HTML, SVG or Three.js. Use the corresponding video_* profile for video. With the supplied profile, HTML and Three.js tasks also load the local module at threejs_asset. |
runtime_profiles.pythoncode / runtime_profiles.blender.config.jail |
For charts, set the Python sandbox and browser render base. For Blender, supply the Blender 5.0.1 jail. |
For video, put ffmpeg and ffprobe on PATH or set V2C_FFMPEG and V2C_FFPROBE. The harness guide describes the sandbox layouts and host prerequisites.
⚡ Connect the Harness to vLLM
The standalone inference client sends requests to an OpenAI-compatible chat completions endpoint. The following example from the harness guide starts the external vLLM server for an SFT export. Replace the checkpoint path with your local export. Qwen3.5-27B is the serving alias used in the original example. Set the client’s --model to the same alias. Original harness guide
vllm serve ./checkpoints/sft_qwen27b_medium/hf_final \
--served-model-name Qwen3.5-27B --host 127.0.0.1 --port 8000 \
--tensor-parallel-size 4 --dtype bfloat16 --max-model-len 163840 \
--enable-prefix-caching --enable-auto-tool-choice --tool-call-parser qwen3_coder \
--reasoning-parser qwen3 --limit-mm-per-prompt '{"image": 160}' --trust-remote-code
Distributed evaluation uses a separate launcher in this repository. It builds the command for vllm.entrypoints.openai.api_server using the evaluation runtime and worker configuration. Evaluation server launcher
🛠️ Visual Coding Harness
The same harness runs standalone inference and online RL. It selects a prompt for the input modality and output format, gives the model a starter file, and returns rendered observations on success and diagnostics on failure. The model can compare its output with the target, edit the source, and render again. finish accepts the current entrypoint after a successful render of that revision. For video, that render must cover all required timestamps.
| Step | Tools |
|---|---|
| Inspect the workspace | list_dir, grep_files, read_file |
| Write code and run local analysis | apply_patch, shell_command |
| Run the program and compare with the target | render, view_image |
| Submit the verified entrypoint | finish |
The agent loop calls the tool gateway, which dispatches execution to the rendering backend. To change the default budget of 100 model calls, 100 tool calls or six renders, edit max_model_calls, max_tool_calls or max_renders in your harness configuration. Pass a task-specific request with --instruction, or use --task-prompts and --system-prompt to supply your own task templates and system prompt.
🚀 Quick Start
With the model server running, use the two commands from the harness guide to reconstruct an image as editable SVG or a video as a Three.js scene. Replace the sample input paths with your own. If your runtime layout differs from the bundled profile, pass --config /absolute/path/to/harness.yaml to each invocation. Inference guide
./v2c infer --input /path/to/target.png --task svg \
--config research/vision2code_agentic_rl/configs/harness/vision2code_harness_v1.yaml \
--endpoint http://127.0.0.1:8000/v1/chat/completions --model Qwen3.5-27B \
--thinking medium --output ./outputs/infer_svg
./v2c infer --input /path/to/motion.mp4 --task threejs \
--endpoint http://127.0.0.1:8000/v1/chat/completions --model Qwen3.5-27B \
--thinking medium --output ./outputs/infer_threejs
📦 Batch Inference
./v2c infer --input-jsonl reads one sample per line. Give each sample a unique sample_id. Relative input paths are resolved from the working directory where you start inference. Save the following example as a JSONL file and replace the three paths with your own inputs. Original JSONL example
{"sample_id":"case_01","input_path":"/path/to/ui.png","task":"html"}
{"sample_id":"case_02","input_path":"/path/to/chair.png","task":"blender"}
{"sample_id":"case_03","input_path":"/path/to/motion.mp4","task":"svg"}
./v2c infer --input-jsonl /path/to/samples.jsonl \
--endpoint http://127.0.0.1:8000/v1/chat/completions --model Qwen3.5-27B \
--thinking medium --concurrency 8 --render-concurrency 8 --output ./outputs/infer_batch
The runner uses one semaphore for concurrent samples (--concurrency) and another for renderer execution (--render-concurrency). The default for each is 4. Completed episodes write results to samples/<sample_id>/ under the chosen output directory. An existing result.json is reused on rerun. Batch implementation
🗂️ Tasks and Outputs
Select the source format with --task for a single input or task in a JSONL record. All five formats accept images and videos. The supplied profiles use these entrypoints.
| Task | Submitted entrypoint |
|---|---|
svg |
result.svg |
html |
index.html |
threejs |
index.html with a native Three.js scene |
chart (alias pythoncode) |
figure.py for a Matplotlib chart |
blender |
scene.py for Blender |
- Receipt.
result.jsonrecordssubmitted,failure,model_callsandtool_counts. Successful submissions also listentrypoint,code_filesandrendered_files. - Reconstruction.
submitted/holds the submitted source files and available final renders. Openrendered.pngfor a single observation orrendered_000.png,rendered_001.png, … for a sequence. - Trajectory. Inspect
episode/events.jsonlfor the ordered interaction andepisode/completions/for individual model calls.
🏋️ Training
In the reported experiments, we initialize CodingDINO from Qwen3.8-27B, run supervised fine-tuning on verified trajectories of DeepSeek-V4.1-Flash, and then train with multi-turn agentic RL in the harness. Trajectory rewards depend on execution validity and visual consistency with the target. The visual score uses frozen DINO features and, for Three.js and Blender, relative depth. Paper, §4.1 · Reward, Appendix B.3

Supervised fine-tuning (SFT)
The H800 encoder supervises the assistant’s generated reasoning, program edits and tool calls. It requires a supervised finish call and masks the synthetic end marker on length-truncated turns. Prepare an export of complete trajectories with accessible media, the matching base model and tokenizer, and a compatible Megatron learner environment. Trajectory encoder · Corpus builder
Run from the repository root on Linux, using shared paths visible to every training node. Replace the released SFT example’s /path/to/Qwen3.5-27B with the local path to your initialization checkpoint. Encode the trajectories, seal the corpus, then prepare a run.
SFT="$PWD/research/vision2code_sft"
export V2C_LEARNER_RUNTIME=/path/to/learner-runtime
export V2C_MODEL_PATH=/path/to/Qwen3.5-27B
EXPORT=/path/to/export_manifest.json
ENCODED=/path/to/encoded
CORPUS=/path/to/sealed-corpus
bash "$SFT/gpu_environment.sh" "$SFT/fulltrace_encode.py" \
--export-manifest "$EXPORT" --model "$V2C_MODEL_PATH" --output "$ENCODED"
bash "$SFT/gpu_environment.sh" "$SFT/fulltrace_corpus.py" \
--export-manifest "$EXPORT" --encoded "$ENCODED" --output "$CORPUS"
CAMPAIGN=/path/to/shared/new-sft-campaign
bash "$SFT/scripts/prepare_sft.sh" --manifest "$CORPUS/think/manifest.json" \
--model "$V2C_MODEL_PATH" --output "$CAMPAIGN" --nodes 16 --seq-len 163840
On each of the 16 eight-GPU nodes, export the same MASTER_ADDR, NNODES=16 and numeric JOB_ID. Export a distinct NODE_ID, zero-based NODE_RANK and the eight local CUDA_VISIBLE_DEVICES. With the paths above set on each node, launch once per node.
bash "$SFT/scripts/train_sft_h800.sh" --campaign "$CAMPAIGN"
The final Hugging Face export is in $CAMPAIGN/sft_model/weights. The completion receipt is $CAMPAIGN/sft_completed.json. H800 training and export
The SDK22 launcher registers eight nodes with 16 PPUs each. Prepare its corpus with data/READY.json and data/{think,no_think}/manifest.json. Set the sample count and manifest hashes in the deployment file to match that corpus. Launch once per node. Deployment template · Corpus checks · PPU launcher
export V2C_SFT_DEPLOYMENT=/path/to/your-deployment.json
python3 -B research/vision2code_sft/verify_sources.py
# On every PPU node, with MASTER_ADDR and a common numeric JOB_ID set
bash research/vision2code_sft/scripts/train_sft_ppu.sh think
Agentic reinforcement learning (RL)
This Agentic RL preset initializes the SingleController GRPO trainer from the SFT export. Each prompt has eight rollouts. A failed episode or a trajectory without a valid finish and render receives zero reward. For a valid submission, the reward is the mean of DINOv2-L and DINOv3-L similarity at each matched frame. Three.js and Blender add relative depth agreement as a third, equally weighted term. The episode reward averages those frame scores. Training preset · GRPO trainer · Reward calculation
Prepare the train and validation JSONL splits, manifests and local reward-model weights on shared storage. In the example below, CAMPAIGN refers to the H800 SFT run above, whose export is passed to --model. When starting from another SFT checkpoint, supply its Hugging Face export directory. --freeze-source snapshots the code for this RL run. Path configuration
project=research/vision2code_agentic_rl
campaign="$PWD/outputs/rl_sft_medium_depth"
./v2c rl prepare \
--settings "$project/configs/rl/qwen27b_sft_medium_dino_depth_third.yaml" \
--model "$CAMPAIGN/sft_model/weights" \
--campaign "$campaign" --freeze-source
Complete the sandbox identity setup on each allocated node, then launch once per node. Set a shared MASTER_ADDR, NNODES and numeric JOB_ID, and a distinct zero-based NODE_RANK on each node. The campaign writes recovery checkpoints to checkpoints/, validation metrics to run/evaluations/ and the selected checkpoint path to best_validation_checkpoint.json.
export MASTER_ADDR="rank0.example.org" NNODES=16 JOB_ID=1001
export NODE_RANK=0 # Set separately on each node: 0 through NNODES-1.
campaign="$PWD/outputs/rl_sft_medium_depth"
bash "$campaign/source/RL/research/vision2code_agentic_rl/scripts/train_rl.sh" \
--campaign "$campaign"
The preparation script validates the split manifests and writes the configuration used by the distributed launcher. Campaign preparation · Checkpoint selection
📈 Evaluation
The evaluation runner exports submitted source and invokes the scorers for each benchmark. The table lists records in the frozen cohort. Each metric has its own scoring coverage. Benchmark configuration · Scoring jobs
| Benchmark / scorer | Records | Input → submission | Scoring path |
|---|---|---|---|
| 3DHarnessBench | 100 | Textured single view → Blender | Wrap the submitted scene and run the official Blender evaluator in its Single-view setting. |
| CC-HARD | 128 | Web screenshot → HTML | Compare DOM trees, then render the reference and candidate in the same browser for CLIP and VisualScore. |
| VFIG-Bench | 598 | Figure → SVG | Score the target and rendered image with local VFig metrics, including SSIM and raw LPIPS distance. Aggregate ID and OOD separately. |
| DrawAI-Bench Lite | 80 | Diagram → SVG | Run the nine official rule-based criteria on submitted SVGs. Track valid counts per criterion. |
| AnimWeb-Bench | 124 | Animation → HTML | Re-render at 30 fps. Score keyframe appearance and motion across segments with the official evaluator. |
| Code2Video-Compass (V2V) | 693 | Video → HTML | Run the local Compass stages on re-rendered videos, including temporal alignment, appearance fidelity and motion fidelity. |
Campaign preparation checks for 1,723 records and 1,555 available inputs. Code2Video-Compass has 525 available videos among its 693 records. The remaining 168 are marked missing_input and receive no model request. Prepare the frozen cohort JSON, media, metric weights and pinned scorer checkouts on shared storage. The benchmark guide links the datasets and main-model logs. Benchmark guide · Cohort checks · Runtime paths · Scorer configuration
The example below assumes a self-contained Hugging Face export. For an export with a separate native GDN delta, supply the actual delta directory via --gdn-export-root and set --checkpoint-step to the step in its export receipt. Distributed evaluation guide
EVAL=research/vision2code_bench/harness_v1_eval
CAMPAIGN=/path/to/shared/new-campaign
python3 "$EVAL/prepare_campaign.py" \
--output "$CAMPAIGN" --cohort /path/to/cohort.json \
--model-weights /path/to/exported/weights \
--paths /path/to/paths.json --official-config /path/to/local.json \
--modes medium xhigh --nodes 32 --gpus-per-node 8
On each allocated node, set SOFY_NODE_RANK, SOFY_NUM_NODES, SOFY_TASK_ID, CUDA_VISIBLE_DEVICES and the sandbox identity configuration. Run generation on every node, wait for all generation to finish, then run scoring on every node. The official scorers execute submitted programs, so provide an isolated scoring environment. Run collection once after scoring finishes.
RUN="$CAMPAIGN/source/RL/research/vision2code_bench/harness_v1_eval"
bash "$RUN/run_256gpu_node.sh" generate "$CAMPAIGN"
# On all nodes after generation
bash "$RUN/run_256gpu_node.sh" score "$CAMPAIGN"
# Once after scoring
python3 "$RUN/collect_campaign.py" --campaign "$CAMPAIGN"
After scoring, inspect reports/progress.json in each mode’s run directory for per-benchmark metrics, coverage and scorer errors. DrawAI’s nine-rule summary is in official_drawai_rules/summary.json. The campaign-wide file is campaign_summary.json. Report collector
📊 Results
The radar chart compares CodingDINO, CodingDINO-Single, and leading baselines across six benchmarks. The paper ranks CodingDINO against the baseline models, excluding its Single variant and training-stage ablations from the headline ranks. Paper, Fig. 3 and Table 1

Render budget and reconstruction examples



📚 Developer Guides
| Guide | What you will find |
|---|---|
| Harness & inference | Agent setup, render profiles, image/video inputs and batch jobs |
| Supervised fine-tuning | Trajectory export, token supervision, H800 and PPU SDK22 launchers |
| Agentic RL | Training splits, reward presets, campaign configuration and checkpoints |
| Benchmark suite | Six benchmark datasets, scorer setup and main-model evaluation logs |
| Distributed evaluation | Path templates, generation workers, official scoring and report collection |
📖 Citation
📄 License
Original CodingDINO code is licensed under Apache 2.0. Bundled third-party components retain their respective copyrights and licenses. See Third-party notices.
استكشف مشاريع مشابهة ومرتبطة
جارٍ التحميل…

