[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-109707":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":12,"contributorsCount":12,"subscribersCount":12,"size":12,"stars1d":12,"stars7d":12,"stars30d":12,"stars90d":12,"forks30d":12,"starsTrendScore":12,"compositeScore":14,"rankGlobal":9,"rankLanguage":9,"license":9,"archived":15,"fork":15,"defaultBranch":16,"hasWiki":17,"hasPages":15,"topics":18,"createdAt":9,"pushedAt":19,"updatedAt":20,"readmeContent":21,"aiSummary":22,"trendingCount":12,"starSnapshotCount":12,"syncStatus":23,"lastSyncTime":24,"discoverSource":25},109707,"turn-wise-rl","XD111ds\u002Fturn-wise-rl","XD111ds","Code for \"Turns Matter: Advancing Streaming Video RL via Turn-Level Credit\".",null,"Python",67,0,66,37,false,"main",true,[],"2026-11-05 07:44:32","2026-11-07 07:53:32","# Turns Matter: Advancing Streaming Video RL via Turn-Level Credit\n\n[![arXiv](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FarXiv-2611.06728-b31b1b.svg)](https:\u002F\u002Farxiv.org\u002Fabs\u002F2611.06728)\n[![Model](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002F🤗%20Hugging%20Face-Model-yellow)](https:\u002F\u002Fhuggingface.co\u002Fshuai22\u002Fturns-matter-rl-ckpt)\n[![Dataset](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002F🤗%20Hugging%20Face-Dataset-yellow)](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fshuai22\u002Fmmduet2-training-data)\n\nOfficial RL training code for **TurnWise**, a framework for learning when to respond and when to wait in streaming video conversations.\n\n**Authors:** Shuai Dong, Kanghui Tian, Linghan Chen et al.\n\n**Affiliations:** Fudan University; Shanghai Innovation Institute; JD.com; Stanford University;\n\n---\n\n## 📖 Abstract\n\nStreaming video assistants must continually choose between answering and observing more frames. Assigning every decision the same trajectory-level GRPO advantage can reward repetition or suppress useful later answers. **TurnWise** instead compares the return remaining at each turn across sampled trajectories, using prefix scores obtained by replacing subsequent responses with silence. It also averages losses within each turn before averaging across turns, so long answers do not outweigh short waiting actions. Both mechanisms reuse existing rollout evaluations. Experiments on two Qwen backbones show stronger results across three streaming benchmarks. See the [paper](https:\u002F\u002Farxiv.org\u002Fabs\u002F2611.06728) for the full abstract and methodology.\n\n![TurnWise framework: streaming rollouts, silence-completed prefix scoring, turn-level credit, and turn-mean policy optimization](assets\u002Fframework.png)\n\n**Framework overview.** TurnWise combines turn-specific credit with equal weighting of response and waiting decisions. The implementation includes prefix reward computation, group-relative credit assignment, and turn-mean policy loss.\n\n\u003Cdetails>\n\u003Csummary>Why do turns matter?\u003C\u002Fsummary>\n\n![Illustrative dialogue and the difference between shared GRPO advantages and TurnWise turn-level advantages](assets\u002Fteaser.png)\n\nA successful trajectory may still contain redundant replies. TurnWise separates the learning signal for each decision from rewards earned earlier in the conversation. The dialogue above is illustrative; the plotted advantages are based on recorded training decisions.\n\n\u003C\u002Fdetails>\n\n---\n\n## 📢 News\n\n- **[2026-11-05]** 🚀 The RL training code is released. Model checkpoints are hosted at [shuai22\u002Fturns-matter-rl-ckpt](https:\u002F\u002Fhuggingface.co\u002Fshuai22\u002Fturns-matter-rl-ckpt), and prepared training data at [shuai22\u002Fmmduet2-training-data](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fshuai22\u002Fmmduet2-training-data).\n- **[2026-11-04]** 📄 The paper is available on [arXiv](https:\u002F\u002Farxiv.org\u002Fabs\u002F2611.06728).\n\n---\n\n## 🛠️ Installation\n\n### 1. Environment setup\n\nUse **Python 3.10** and a CUDA environment compatible with **PyTorch 2.6.0**.\n\n```bash\nconda create -n turnwise python=3.10\nconda activate turnwise\n\ngit clone https:\u002F\u002Fgithub.com\u002FXD111ds\u002Fturn-wise-rl.git\ncd turn-wise-rl\n\npython -m pip install -r requirements.txt\npython -m pip install flash-attn==2.7.4.post1 --no-build-isolation\n```\n\n### 2. Prepare verl and SGLang\n\nTurnWise provides source overrides for specific revisions of [verl](https:\u002F\u002Fgithub.com\u002Fverl-project\u002Fverl) and [SGLang](https:\u002F\u002Fgithub.com\u002Fsgl-project\u002Fsglang). Use dedicated checkouts, since the installer copies the overrides into them.\n\n```bash\nmkdir -p third_party\ngit clone https:\u002F\u002Fgithub.com\u002Fverl-project\u002Fverl.git third_party\u002Fverl\ngit -C third_party\u002Fverl checkout 83ebd007e01de29bbe353de112d04245b4820b47\n\ngit clone https:\u002F\u002Fgithub.com\u002Fsgl-project\u002Fsglang.git third_party\u002Fsglang\ngit -C third_party\u002Fsglang checkout dcae1fb2cd2def2a2eb4919c21f74e91d888d161\n\nexport VERL_PATH=\"$PWD\u002Fthird_party\u002Fverl\"\nexport SGLANG_PATH=\"$PWD\u002Fthird_party\u002Fsglang\"\npython install.py --verl \"$VERL_PATH\" --sglang \"$SGLANG_PATH\"\n```\n\nThe installer verifies the dependency revisions, applies the overrides, and installs both dependencies in editable mode. Training uses the Ray\u002FFSDP\u002FSGLang configuration in [`configs\u002Ftrain.yaml`](configs\u002Ftrain.yaml).\n\n---\n\n## 📚 Data Preparation\n\nWe use prepared MMDuet2 streaming training data. Download the **two-second-per-frame RL split** from [shuai22\u002Fmmduet2-training-data](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fshuai22\u002Fmmduet2-training-data):\n\n- `metadata\u002Frl\u002F`: training\u002Fvalidation parquet files and the user-turn annotation JSON.\n- `media\u002Frl\u002F`: tar shards containing the prepared frames.\n\nDownload these directories into `data\u002F` from the repository root:\n\n```bash\npython - \u003C\u003C'PY'\nfrom huggingface_hub import snapshot_download\n\nsnapshot_download(\n    repo_id=\"shuai22\u002Fmmduet2-training-data\",\n    repo_type=\"dataset\",\n    allow_patterns=[\"metadata\u002Frl\u002F*\", \"media\u002Frl\u002F*\"],\n    local_dir=\"data\",\n)\nPY\n\nmkdir -p data\u002Fdatasets\u002Fmmduet2-frame\u002Frl\nfor archive in data\u002Fmedia\u002Frl\u002F*.tar; do\n    tar -xf \"$archive\" -C data\u002Fdatasets\u002Fmmduet2-frame\u002Frl\ndone\n```\n\n**Expected directory structure:**\n\n```text\nturn-wise-rl\u002F\n├── assets\u002F\n├── configs\u002F\n├── data\u002F\n│   ├── metadata\u002Frl\u002F\n│   │   ├── ...-train.parquet\n│   │   ├── ...-val.parquet\n│   │   └── ...-user_turns.json\n│   ├── media\u002Frl\u002F                      # Downloaded tar shards\n│   └── datasets\u002Fmmduet2-frame\u002Frl\u002F     # Extracted frame directories\n├── overrides\u002F\n│   ├── verl\u002F\n│   └── sglang\u002F\n├── qwen_vl_utils\u002F\n├── recipe\u002Fproactive\u002F\n├── third_party\u002F\n├── install.py\n├── requirements.txt\n├── train.sh\n└── README.md\n```\n\n**Data format:** parquet examples contain `prompt` (initial conversation), `images` (frame references), `data_source`, `reward_model` (ground-truth answers and reply windows), and `extra_info` (including video-tool arguments). The user-turn JSON supplies subsequent observations for each `question_id`.\n\nSet `FRAME_ROOT` to the absolute path of `data\u002Fdatasets\u002Fmmduet2-frame\u002Frl`, which directly contains the extracted dataset directories. The parquet uses paths such as `.\u002Fdata\u002Fdatasets\u002FEgoExoLearn\u002Fframes\u002F...`; the training launcher links `FRAME_ROOT` to `.\u002Fdata\u002Fdatasets` in its runtime directory so these references resolve correctly. Follow the dataset card for upstream data licenses and terms.\n\n---\n\n## 🚀 Training\n\n### 1. Configure paths and the reward judge\n\nPrepare an **SFT checkpoint compatible with Qwen2.5-VL** for this training implementation. The trained TurnWise model is available on [Hugging Face](https:\u002F\u002Fhuggingface.co\u002Fshuai22\u002Fturns-matter-rl-ckpt). The paper also reports Qwen3-VL experiments; the supplied dependency overrides target Qwen2.5-VL.\n\nThe reward function requires an **OpenAI-compatible chat-completions endpoint**. The paper uses **gpt-oss-20b** as the training judge. Replace the model, output, and judge placeholders below; use absolute paths for filesystem locations.\n\n```bash\n# Run from the repository root, in the environment configured above.\nexport VERL_PATH=\"$PWD\u002Fthird_party\u002Fverl\"\nexport SGLANG_PATH=\"$PWD\u002Fthird_party\u002Fsglang\"\n\nDATA_PREFIX=\"$PWD\u002Fdata\u002Fmetadata\u002Frl\u002Flive_whisperx-egoexo4d-egoexolearn0913-half_multi_half_single_question-2_sec_per_frame-20s_seg_as_example-0714-max_90_frames\"\nexport MODEL_PATH=\"\u002Fabsolute\u002Fpath\u002Fto\u002Fyour\u002Fsft-checkpoint\"\nexport TRAIN_PARQUET=\"${DATA_PREFIX}-train.parquet\"\nexport RL_USER_TURNS_JSON=\"${DATA_PREFIX}-user_turns.json\"\nexport FRAME_ROOT=\"$PWD\u002Fdata\u002Fdatasets\u002Fmmduet2-frame\u002Frl\"\nexport OUTPUT_DIR=\"\u002Fabsolute\u002Fpath\u002Fto\u002Fturnwise-output\"\n\nexport LLM_EVALUATOR_URL=\"http:\u002F\u002FYOUR_JUDGE_HOST:PORT\u002Fv1\u002Fchat\u002Fcompletions\"\nexport LLM_EVALUATOR_MODEL=\"YOUR_JUDGE_MODEL_NAME\"\n# If authentication is required:\n# export LLM_EVALUATOR_API_KEY=\"YOUR_API_KEY\"\n```\n\nFor multiple judge endpoints, set `LLM_EVALUATOR_URLS` to a comma-separated list and keep `LLM_EVALUATOR_URL` set. Optional judge settings are defined in [`recipe\u002Fproactive\u002Freward_function.py`](recipe\u002Fproactive\u002Freward_function.py).\n\n### 2. Launch training\n\n```bash\nbash train.sh\n```\n\n**Default hyperparameters:**\n\n| Setting | Value |\n| --- | --- |\n| Compute | 1 node, 8 GPUs |\n| Training batch size | 8 |\n| Rollouts per input | 4 |\n| Video observations | Up to 90 frames, one every 2 seconds |\n| Learning rate \u002F epochs | `1e-6` \u002F 1 |\n| Sampling temperature \u002F top-k | 1.2 \u002F 10 |\n| Policy loss aggregation | `turn-mean` |\n| Credit correction strength | Linear warmup from 0 to 1 over the first 10% of scheduled optimizer updates, then fixed at 1 |\n| Turn advantage clipping | ±5 |\n| Vision tower | Frozen |\n| KL \u002F entropy regularization | Disabled |\n\nHydra overrides can be passed after `bash train.sh`. For example:\n\n```bash\nbash train.sh trainer.experiment_name=turnwise-run\n```\n\n---\n\n## 📊 Results\n\nAggregate scores from [Table 1 of the paper](https:\u002F\u002Farxiv.org\u002Fhtml\u002F2611.06728v1#S4.T1); higher is better for all columns.\n\n| Backbone | Method | ProactiveVQA PAUC | OVO-Timing F1 | StreamingBench Avg. |\n| --- | --- | ---: | ---: | ---: |\n| Qwen2.5-VL-3B | SFT | 28.74 | 0.57 | 48.74 |\n| Qwen2.5-VL-3B | MMDuet2 | 39.60 | 17.72 | 47.64 |\n| Qwen2.5-VL-3B | **TurnWise** | **43.56** | **21.59** | **49.43** |\n| Qwen3-VL-4B | SFT | 30.24 | 1.60 | 56.58 |\n| Qwen3-VL-4B | MMDuet2 | 30.18 | 9.23 | 53.84 |\n| Qwen3-VL-4B | **TurnWise** | **42.44** | **11.15** | **58.96** |\n\n\u003Cdetails>\n\u003Csummary>Training dynamics and credit allocation\u003C\u002Fsummary>\n\n![Training reward, repetition penalty, and response frequency over optimizer updates](assets\u002Ftraining_dynamics.png)\n\nTurn-mean aggregation produces higher late-stage reward and less repetition than credit-only optimization in the analyzed training run.\n\n![Comparison of global and turn-level advantages, including repetitive replies](assets\u002Fcredit_allocation.png)\n\nAmong repetitive replies with positive global advantages in the analyzed cohort, 59.83% receive negative turn-level advantages. See the paper for the cohort definition and full analysis.\n\n\u003C\u002Fdetails>\n\n---\n\n## 📝 Citation\n\nIf you find TurnWise useful, please cite our paper:\n\n```bibtex\n@article{dong2026turns,\n  title={Turns Matter: Advancing Streaming Video RL via Turn-Level Credit},\n  author={Dong, Shuai and Tian, Kanghui and Chen, Linghan and Shao, Wenqi and Wu, Hongrui and Hou, Haowen and Zhu, Yongfu and Wang, Xuehui and Wang, Ziyue and Liu, Wenpu and Xie, Weichu and Xu, Yuqi and Wang, Congcong and Tuo, Kaiwen and Ma, Caoyuan and Wu, Taiqiang and Zhao, Ji and Chang, Wenzheng and Wang, Dianyi and Wang, Siyuan and Wei, Zhongyu and Qiao, Yu and Wang, Jiaqi},\n  journal={arXiv preprint arXiv:2611.06728},\n  year={2026},\n  url={https:\u002F\u002Farxiv.org\u002Fabs\u002F2611.06728}\n}\n```\n\n## 🙏 Acknowledgements\n\nThis codebase builds on [verl](https:\u002F\u002Fgithub.com\u002Fverl-project\u002Fverl), [SGLang](https:\u002F\u002Fgithub.com\u002Fsgl-project\u002Fsglang), [Qwen2.5-VL](https:\u002F\u002Fgithub.com\u002FQwenLM\u002FQwen2.5-VL), [Transformers](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Ftransformers), and the [MMDuet2](https:\u002F\u002Fgithub.com\u002Fyellow-binary-tree\u002FMMDuet2) streaming training setup. We thank the authors for their open-source contributions.\n\n## 📄 Third-party Licenses\n\nThe verl and SGLang overrides derive from projects licensed under **Apache-2.0**. Their original licenses and notices remain in the corresponding dependency checkouts and must be retained when redistributing derived code. Dataset licenses and terms are described in the linked dataset repository.\n","TurnWise 是一个面向流式视频对话场景的强化学习框架，旨在优化智能体在连续视频帧输入中动态决策“何时回答、何时等待”的能力。其核心创新包括：基于静音补全前缀的逐轮（turn-level）信用分配机制，避免传统轨迹级优势函数对冗余回复的误奖励；以及按轮次平均策略损失，确保等待与响应动作在训练中获得公平梯度权重。项目复用现有 rollout 评估，兼容 Qwen 等多模态大模型，适用于实时视频问答、低延迟人机协作等对响应时机敏感的交互式AI系统。",2,"2026-11-24 04:37:12","CREATED_QUERY"]