Skip to content

feat(rm): add the VideoAlign reward and an LTX-2.3 Flow-GRPO recipe - #421

Open
charon-agi wants to merge 5 commits into
radixark:mainfrom
charon-agi:feat/videoalign-reward
Open

charon-agi wants to merge 5 commits into
radixark:mainfrom
charon-agi:feat/videoalign-reward

Conversation

@charon-agi

@charon-agi charon-agi commented Nov 24, 2026 •

Copy link
Copy Markdown

feat(rollout): add VideoAlign reward and LTX-2.3 Flow-GRPO validation

What

  • Add a local VideoAlign scorer using KwaiVGI/VideoReward and the Qwen2-VL-2B configuration, with checkpoint remapping, the upstream rubric, PIL video preprocessing and sequential reward-model positions.
  • Return vq, mq, ta and overall per sample. Normalization uses the published VideoReward constants; overall = vq_weight*vq + mq_weight*mq + ta_weight*ta, with per-head weights (--videoalign-vq-weight / --videoalign-mq-weight / --videoalign-ta-weight, all defaulting to 1.0). --reward-key selects the scalar optimized by training.
  • Add single/batched reward dispatch, standalone/colocated Ray pools and --videoalign-* CLI flags.
  • Preserve dictionary rewards in the shared actor pool while retaining scalar float conversion.
  • Add an LTX-2.3 Flow-GRPO recipe that wires periodic held-out eval and checkpoint cadence.
  • Add --diffusion-eval-guidance-scale so eval can enable the LTX-2.3 embedded-CFG guider (guidance > 1.0) while the RL rollout stays at guidance 1.0.

Why

PickScore averages framewise CLIP scores. VideoAlign jointly processes sampled video frames and exposes visual quality, motion quality and text alignment as separate scores. This integration makes those heads available to the existing reward/advantage pipeline without introducing a new training algorithm.

The eval guidance flag exists because the RL rollout must run single-branch (guidance 1.0) for log-prob computation, while LTX-2.3 plain generation activates the embedded-CFG guider, which unconditionally reads negative_prompt_embeds. Those embeds are only encoded when classifier-free guidance is enabled, so eval needs its own guidance scale.

Training protocol

  • Model/algorithm: LTX-2.3 + existing Flow-GRPO, LoRA rank 64 / alpha 128, bf16 end-to-end.
  • Hardware: NVIDIA H200 (141 GB) — 5 GPUs used (four colocated train/rollout + one dedicated reward); the node has 8 H200s total, so three stay idle.
  • Software env: isolated venv /fsx/group/kaixiangxu/env/miles_gpu (Torch 2.11 + sglang, with a Torch-2.11-compatible sglang-kernel overlay), LTX-2.3 materialized under /root/.cache/sgl_diffusion/materialized_models/.
  • Data: rockdu/miles-diffusion-datasets, flowgrpo_pickscore/train.jsonl (text prompts only).
  • Generator: 768×512, 57 frames at 24 FPS, 24 denoising steps.
  • Batch: 8 prompts × 8 samples = 64 videos per rollout; two optimizer steps per rollout.
  • Reward: 8 uniformly sampled frames, batch size 4, normalized VQ+MQ+TA (--reward-key overall); the reward-hacking rerun sets --videoalign-ta-weight 3.0 with VQ/MQ left at 1.0.
  • Eval: deterministic 64-prompt subset of test.jsonl (seed 0), --eval-interval 20, --eval-reward-key overall, --diffusion-eval-guidance-scale 3.0.
  • Save: --save-interval 10.

Validation

  • Latest CPU fast suite: 725 passed, 19 skipped, with CUDA_VISIBLE_DEVICES="" /usr/local/bin/python -m pytest tests/fast -x -q.
  • Reward/pool CPU regression subset: 19 passed, including dictionary preservation and the CLI default model path. Ray dispatch is mocked in these tests.
  • GPU scorer alignment: 4 passed against official upstream revision 219ab9db64c045e5181a2202d11f686439351292, using an isolated Transformers 4.45.2 reference subprocess. Exact input IDs, video grids, pixel SHA256 and raw bf16 scores match for three synthetic clips and a padded mixed-resolution batch.
  • Local normalization and summed-score arithmetic checked. This is not an independent upstream normalization comparison.
  • train_diffusion.py --help exits successfully in the prepared GPU environment; the full VideoAlign smoke arguments pass parsing/validation.
  • Two-rollout RL smoke: completed end-to-end (exit 0); finite rewards, 4 optimizer steps, checkpoints written.
  • Training dynamics match the registered LTX-2.3 PickScore e2e: log_prob_new_idx_0 / log_prob_old_idx_0 match the baseline standard to ~5–6 decimal places, and grad_norm stays in the same ~1e-5 range as the baseline. Only the reward (advantage) differs.
  • 200-rollout (400-step) curve: completed end-to-end (exit 0), see Results below.
  • Held-out eval across all 20 checkpoints on the 64-prompt test subset (per-head vq/mq/ta/overall persisted via MILES_METRICS_JSONL); see the ta-weighted rerun in Results.
  • Reward-hacking / overfitting analysis: the unweighted run collapses ta while vq/mq climb; a --videoalign-ta-weight 3.0 rerun holds ta roughly flat — see Results.
  • Real StoredTensor/Mooncake path: not validated; the local runs use inline tensors.
  • fp32 parity, GPU CI.
  • Pre-commit checks pass on all touched source/test/doc files (not a repository-wide run).

Results (200 rollouts / 400 optimizer steps)

A full LTX-2.3 + Flow-GRPO run (exit 0, ~15.2 hours) optimizes the VideoAlign reward on the training set.

  • grad_norm stays small throughout (8.5e-6 at step 1 → 5.6e-5 at step 400), matching the baseline ~1e-5 scale; clipfrac rises from 0% to 7.3%, and ratio_abs_minus_1 from ~1e-6 to ~4e-6, showing the policy starts making larger updates late in training.
  • 20 checkpoints written (iter_0000001 … iter_0000200), one per 10 rollouts.

Held-out eval on the 64-prompt test subset, loading iter_0000200 (LoRA only) and scoring with --diffusion-eval-guidance-scale 3.0, per-head weights were added, and a rerun with --videoalign-ta-weight 3.0 (VQ/MQ at 1.0) was performed under the same protocol (400 optimizer steps, save every 10).

Held-out eval on the 64-prompt test subset, run on all 20 checkpoints:

reward_curve
  • ta stays inside -1.05…-1.57 for the whole run — no collapse (vs -2.40 at step 200 unweighted) — but it also does not improve, drifting slightly negative and staying there. That is the LTX-2.3 base model's text-alignment ceiling for this prompt set; weighting TA can stop the model from gaming TA, but cannot make the base model more prompt-faithful.
  • vq/mq rise to ~+1.4/+1.5 by step 120–140, then the model begins to overfit: they fall to 0.58/0.95 by step 190 before a partial recovery at step 200.
  • Best checkpoint: iter_0000140 (vq=1.44, mq=1.54, ta=-1.30) — the last point where vq/mq are at their peak before ta drifts more negative; the final checkpoint is not the best.

Files

  • miles/rollout/rm_hub/videoalign.py
  • miles/rollout/rm_hub/core.py
  • miles/rollout/rm_hub/__init__.py
  • miles/rollout/sglang_diffusion_rollout.py
  • miles/utils/arguments.py
  • scripts/run_diffusion_grpo_ltx23_videoalign_sglang.py
  • tests/fast/rollout/test_videoalign_reward.py
  • tests/fast-gpu/test_videoalign_alignment.py
  • tests/fixtures/videoalign_official_scores.py
  • docs/user-guide/rewards.md

Operational note

The standard example launcher invokes the existing machine-wide cleanup helper. The local validation instead captures its arguments and creates an isolated local Ray cluster, without broad process kills or external W&B uploads.

@charon-agi charon-agi changed the title feat(rollout): add the VideoAlign reward and an LTX-2.3 Flow-GRPO recipe feat(rm): add the VideoAlign reward and an LTX-2.3 Flow-GRPO recipe Nov 25, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant