Skip to content

About

Code for VideoRSI: Verifiable Self-Improvement for Code-to-Video Generation

Resources

Stars

167 stars

Watchers

0 watching

Forks

Repository files navigation

VideoRSI

Verifiable Self-Improvement for Code-to-Video Generation

Cheng Chen · Yi Tan · Tianrun Chen · Qi Guo · Xinyao Liao · Deyi Ji · Qi Zhu · Lanyun Zhu · Keyu Wen · Zhenshan Tan · Guosheng Lin · Fayao Liu

arXiv Project page Short film Hugging Face paper ModelScope model License

Manual_Override_VideoRSI_short_film.mp4

Manual Override, a short film directed by VideoRSI. Every shot is a 3D scene program written by the director, then rendered by a video model.
Sound on. In full quality (1080p) on the project page.

News

  • 2026-12-02: Director weights released on ModelScope.
  • 2026-12-01: Paper on arXiv and code released.

Overview

Final videos from the Base director, VideoRSI and GPT-6.1, four frames per row.

Final videos, four frames per row. Rows 1–2: the Base director (Qwen3.8-27B) lets the bicycle wheel clip through the bridge; VideoRSI does not. Rows 3–5: Base builds wrong walls and its camera fails to sweep around the gallery and look into the rear room; VideoRSI follows this move, more closely than GPT-6.1.

VideoRSI is a video director that writes code. For each prompt it writes a 3D scene program, which is rendered into a proxy video; a video model then turns the proxy into the final, realistic video. The video model keeps the proxy's layout, motion and camera, so a mistake in the program, such as a wheel passing through the bridge or a camera that never reaches the room it was asked to show, ends up in the video. A VLM judge looking at the frames often misses these mistakes.

VideoRSI checks the program itself, in 4D. It runs each scene program, tracks every object and the camera over time, and checks geometric plausibility, camera control, motion readability and spatial grounding. The director then learns only from scenes that pass: it is fine-tuned on its own verified scenes (the weights), and its harness evolves under the same checks (the workflow). The resulting 27B director builds more plausible scenes and follows camera instructions more closely, approaching GPT-6.1.

VideoRSI overview: executable 4D verification and verifier-guided self-improvement.

How it works

VideoRSI turns a text prompt into a video through an executable 3D scene. A director model writes a Three.js scene program for the prompt and checks it with an executable 4D self-check; the program is rendered into a proxy video that lays out the scene's geometry, motion and camera; a video model then generates the final video guided by it.

prompt ──► director ──► scene program ──► proxy video
proxy video ──► reference image
proxy video + reference image + prompt ──► video
Step Commands
1. Scene program and proxy video python -m inference.generate_program
2. Video python -m inference.generate_reference_local, then python -m inference.generate_video

The steps can be run on their own: the examples ship scene programs, proxy videos and reference images.

Installation

Linux x86_64 with NVIDIA GPUs, Python 3.10, an NVIDIA driver compatible with CUDA 12.6.

conda create -n videorsi python=3.10 -y
conda activate videorsi
conda install -c conda-forge "ffmpeg>=6" "nodejs>=22" -y
python -m pip install --upgrade pip
python -m pip install torch==2.7.1 torchvision==0.22.1 torchaudio==2.7.1 \
  --index-url https://download.pytorch.org/whl/cu126
python -m pip install -r requirements.txt
python -m playwright install --with-deps chromium   # renderer and 4D self-check (step 1)
npm install -g @openai/codex@0.163.0                 # agent runtime (step 1)

requirements.txt pins Diffusers to the commit that provides both the MiniMax-H3 modular pipeline and the Qwen-Image-Edit pipeline. Serve the director from a separate environment, since vLLM pins its own PyTorch and Transformers:

conda create -n videorsi-serve python=3.10 -y
conda activate videorsi-serve
python -m pip install vllm==0.32.0

Model weights

Weights are not included. Put them anywhere; the paths below are placeholders.

VideoRSI director (step 1), built on Qwen3.8-27B: ModelScope.

python -m pip install modelscope
modelscope download --model cheng021/VideoRSI-Director-27B --local_dir /path/to/models/VideoRSI-Director

MiniMax-H3 (step 2). Downloads the pinned revision and checks it against configs/h3_checkpoint.json:

python download_h3.py --output /path/to/models/MiniMax-H3-ref2va
# optional, reads every file: python download_h3.py --output /path/to/models/MiniMax-H3-ref2va --verify-only

The downloader writes the absolute checkpoint path into the checkpoint's modular_model_index.json, so run it again (or move the folder back) if you relocate it.

Qwen-Image-Edit (step 2). Either let Diffusers fetch it from Hugging Face on first use, or download it once and point to it:

hf download Qwen/Qwen-Image-Edit-2511 --local-dir /path/to/models/Qwen-Image-Edit
export QWEN_IMAGE_EDIT_ROOT=/path/to/models/Qwen-Image-Edit   # or pass --model-root

Disk: about 55 GB for the director, 210 GB for MiniMax-H3 and 55 GB for Qwen-Image-Edit.

Step 1: scene program and proxy video

Serve the director (OpenAI-compatible API on 127.0.0.1:8000). TP is the number of GPUs to shard it over (default 1); choose it so the BF16 weights and a 128K-token context fit:

conda activate videorsi-serve
MODEL_PATH=/path/to/models/VideoRSI-Director scripts/serve_director.sh

In another shell, point Codex CLI at it and write a scene:

conda activate videorsi
mkdir -p ~/.videorsi-codex && cp configs/codex.toml ~/.videorsi-codex/config.toml
export CODEX_HOME=~/.videorsi-codex

python -m inference.generate_program \
  --prompt "On a sunny wooden porch, a red rubber ball rolls down three wooden steps and knocks over a row of six standing dominoes. The camera is low and follows the ball. Realistic, warm afternoon light." \
  --output my_scene/ws

The director works in the workspace my_scene/ws: it fills in a plan (case/plan.md), builds the scene (case/*.js), renders keyframes, runs the 4D self-check (skills/verify4d.py) and refines the scene until it is done. The trusted renderer then re-renders the delivered scene into the proxy video my_scene/ws/proxy.mp4 (960×544, 124 frames, 24 FPS, H.264). A session can take a long time; --timeout-min stops it.

The agent executes shell commands. By default Codex runs without approvals or sandbox, so run step 1 in a container or VM. --sandbox workspace-write keeps the agent's writes inside its workspace instead.

The harness the director works with is in harness/: its role (program.agent.md), session instructions (program.md), task and camera contracts, the plan worksheet (skills/plan.md) and the 4D self-check (skills/verify4d.py). The self-check steps the scene through reconstruction.seek(), records every object's boxes and the camera over time, and reports physics suspects (rising, jumping, resting in mid-air, starting alone, passing into objects), shot problems and motion the video generator would lose.

To re-render a scene program yourself:

mkdir -p ws/case ws/vendor
cp examples/toy_train/scene/* ws/case/ && cp vendor/* ws/vendor/
echo '{"width": 960, "height": 544, "fps": 24, "frames": 124}' > ws/settings.json
python inference/render.py video --scene ws     # -> ws/case/reconstruction.mp4

Step 2: video

First make the reference image: one frame of the proxy video is edited into a realistic still, with every object and the camera kept in place (prompts/reference.txt). Run it as its own process, so that its GPU memory is released before the video model loads.

python -m inference.generate_reference_local \
  --video my_scene/ws/proxy.mp4 \
  --output my_scene/reference.png \
  --device cuda:0

Then generate the video from the proxy video, the reference image and the prompt:

python -m inference.generate_video \
  --code-video my_scene/ws/proxy.mp4 \
  --reference-image my_scene/reference.png \
  --prompt-file my_scene/prompt.txt \
  --model-root /path/to/models/MiniMax-H3-ref2va \
  --keep-steps 10 \
  --seed 50 \
  --output my_scene/video.mp4

The output is a 960×544, 124-frame, 24 FPS H.264 video with an audio track. generate_video places the text encoder and the generator on two devices (--text-device, --generation-device) with CPU offload. A proxy video must be exactly 960×544, 124 frames, 24 FPS, H.264, yuv420p, without audio; inputs are checked with ffprobe before the model loads. The scripts refuse to overwrite an existing output.

Options of generate_reference_local (see --help):

Option Effect
--style "golden hour, light haze" Change lighting, time of day, weather and atmosphere only.
--materials "brushed steel frame, oak floor" Describe the materials of the existing objects.
--identity IMAGE NAME LOOK Give an object the look shown in an image, e.g. to keep a character identical across shots. Up to two.
--frame-time SECONDS Use a later frame instead of the first one.
--crop X0 Y0 X1 Y1 Crop the frame first (fractions of width and height).

Options of generate_video:

Option Default Effect
--keep-steps 5 How many of the 20 denoising steps see the proxy video. Higher values follow its geometry and camera more closely; lower values give the model more freedom.
--seed 42 Seed for all noise streams.
--text-device cuda:1 Device for the Qwen3-VL text/vision encoder.
--generation-device cuda:0 Device for the MiniMax-H3 transformer and VAEs.
--prompt / --prompt-file — Text prompt, given directly or read from a file.

With the same inputs and seed, the reference image is reproduced exactly; the video can differ by small GPU-level numerical noise but shows the same scene and motion.

Examples

Four scenes written by the VideoRSI director. Each folder holds the scene program (scene/), its proxy video (code_video.mp4), the reference image made from it with the default settings (reference.png) and the prompt (prompt.txt).

Folder Scene
examples/pendulum_wave Twelve brass balls on threads of increasing length swing in and out of phase, forming travelling waves.
examples/orrery A brass orrery on a study desk; the planets circle the sun at different speeds.
examples/barrel_crates A barrel rolls down a ramp in a winery courtyard and knocks over a stack of crates.
examples/toy_train A toy train runs along its track and knocks over a tower of wooden blocks.

Generate a video from the shipped inputs (only MiniMax-H3 is needed):

EX=examples/pendulum_wave   # or orrery, barrel_crates, toy_train
python -m inference.generate_video \
  --code-video $EX/code_video.mp4 \
  --reference-image $EX/reference.png \
  --prompt-file $EX/prompt.txt \
  --model-root /path/to/models/MiniMax-H3-ref2va \
  --keep-steps 10 \
  --seed 50 \
  --output outputs/$(basename $EX).mp4

Citation

@article{chen2026videorsi,
  title   = {VideoRSI: Verifiable Self-Improvement for Code-to-Video Generation},
  author  = {Chen, Cheng and Tan, Yi and Chen, Tianrun and Guo, Qi and Liao, Xinyao and Ji, Deyi and Zhu, Qi and Zhu, Lanyun and Wen, Keyu and Tan, Zhenshan and Lin, Guosheng and Liu, Fayao},
  journal = {arXiv preprint arXiv:2611.38151},
  year    = {2026}
}

License and acknowledgements

The code is released under the Apache License 2.0 (LICENSE). It is derived from CodeVideoModel by the Code Video Model Team (Apache-2.0); NOTICE lists what was changed. Three.js (vendor/) is under the MIT License (vendor/LICENSE.threejs). The example scene programs, videos, images and prompts in examples/ are licensed under CC BY 4.0 (examples/LICENSES/).

Model weights are not included and are governed by their own licenses: the VideoRSI director, MiniMax-H3 and Qwen-Image-Edit.

About

Code for VideoRSI: Verifiable Self-Improvement for Code-to-Video Generation

Resources

Stars

167 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages