Skip to content

Train from inline multimodal rollouts - #3320

Open
eligotts wants to merge 16 commits into
mainfrom
feat/v1-inline-mm-vllm
Open

Train from inline multimodal rollouts#3320
eligotts wants to merge 16 commits into
mainfrom
feat/v1-inline-mm-vllm

Conversation

@eligotts

@eligotts eligotts commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • retain inline image URLs through rollout collection, truncation, packing, and transport instead of shipping preprocessed pixel tensors
  • return vLLM's expanded prompt IDs for exact logical/expanded token accounting
  • materialize multimodal inputs lazily in the trainer through a small Qwen-VL / Kimi K2.5 model-family adapter registry
  • split multimodal packing bins across trainer workers and leave the existing multimodal SFT path unchanged
  • pin Renderers PR length rewards #133 at bd7c91e and Verifiers PR fix(ring_attn): make FA3 causal/window_size kwargs version-agnostic #2417 at 6720736e1

vLLM 0.28 alignment

Prime now delegates content-parts parsing, raw-media resolution, multimodal engine-input construction, DP routing, max-token defaulting, and usage reporting to the vLLM 0.28 implementation on main. Its serving subclass retains only expanded prompt IDs pending vLLM #53187, compact routed-expert responses, and the KV-transfer bridge pending a release containing vLLM #42644.

Cache-salt forwarding through content-parts remains a small upstream vLLM follow-up; Prime no longer carries a copied endpoint implementation for it.

Stack

Validation

  • uv lock --check
  • uv run pytest -q tests/unit/orchestrator/test_algorithms.py tests/unit/orchestrator/test_batch.py tests/unit/orchestrator/test_qwen3_vl_e2e.py (50 passed)
  • targeted Ruff check passed

Note

Medium Risk
Changes the multimodal training data path (transport, packing, lazy image decode, and model-family forward policy) and inference response shape; misaligned placeholder lengths or refs would fail at materialize/forward time rather than in the old encoded-tensor path.

Overview
Multimodal RL no longer ships preprocessed pixel tensors over the batch transport. Samples carry mm_refs (base64 image URLs plus offset/length in the vLLM-expanded prompt) with mm_token_type_ids, built in the orchestrator from inline image_url parts and image-token runs. Truncation and packing keep whole placeholder blocks and remap refs when sequences are concatenated, without requiring matching mm_kwargs shapes to co-pack.

The trainer materializes vision inputs at forward time via a small prime_rl.multimodal registry (Qwen-VL / Kimi K2.5 adapters) and materialize_mm_refs, with ForwardPolicy driving position IDs and context-parallel deferral. forward() accepts mm_forward_policy while the existing SFT eager-processor path stays on kwargs-only behavior.

vLLM PrimeRlServingTokens now surfaces prompt_token_ids from the engine stream (expanded prompt after multimodal placeholders) alongside the existing routed-experts and KV-transfer bridges. Tests and the Qwen3-VL e2e check were updated for raw content_parts / expanded prompt IDs instead of a features payload round-trip.

Reviewed by Cursor Bugbot for commit 577123e. Bugbot is set up for automated code reviews on this repo. Configure here.

@eligotts
eligotts marked this pull request as ready for review August 28, 2026 22:50
Comment thread src/prime_rl/orchestrator/trajectories.py
Comment thread src/prime_rl/inference/vllm/serving_tokens.py Outdated
# Conflicts:
#	src/prime_rl/inference/vllm/serving_tokens.py
#	tests/unit/inference/test_serving_tokens.py

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ab4ca01. Configure here.

try:
return _BY_MODEL_TYPE[model_type]
except KeyError as exc:
raise NotImplementedError(f"Raw image training is not implemented for model type {model_type!r}") from exc

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing KL mismatch validation table for new models

Medium Severity

This PR introduces new custom multimodal adapters (QwenVLAdapter for qwen3_vl/qwen3_vl_moe/qwen3_5/qwen3_5_moe and KimiK25Adapter for kimi_k25) with distinct ForwardPolicy configurations that change how position_ids, mm_token_type_ids, and context parallelism behave during the model forward pass. Per project rules, any PR introducing a new custom model must include a table showing mean KL mismatch across 20 steps on a math environment with batch_size=64, with all entries below 0.015. No such table is present in the PR description.

Additional Locations (2)
Fix in Cursor Fix in Web

Triggered by project rule: BugBot Instructions

Reviewed by Cursor Bugbot for commit ab4ca01. Configure here.

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