Skip to content

Train from inline multimodal rollouts - #3320

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

Train from inline multimodal rollouts#3320
eligotts wants to merge 20 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 and authoritative multimodal placeholder ranges for exact logical/expanded attribution
  • 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 d1bb692 and Verifiers PR fix(ring_attn): make FA3 causal/window_size kwargs version-agnostic #2417 at 0c5a08b41

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 expanded prompt IDs and authoritative multimodal placeholder ranges 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
Touches the full multimodal RL data path (transport, packing, inference response shape, and train-time image decode/processor alignment); misaligned placeholder lengths fail hard at materialize time.

Overview
Multimodal RL no longer ships preprocessed pixel tensors from orchestrator to trainer. Training samples and micro-batches carry MMRefs (base64 image URLs plus offset/length for vLLM-expanded placeholder runs) and mm_token_type_ids, with pixels built only on the trainer via a new prime_rl.multimodal adapter registry (Qwen-VL / Kimi K2.5) and materialize_mm_refs.

The orchestrator trace_to_samples path scrapes inline image_url parts from branch messages and pairs them with image-token runs instead of concatenating renderer mm_kwargs. Batch truncation, validation, and packing are updated for refs (whole-image cuts, relaxed MM packing, ref offset shifting when bins merge); EncodedTensor is removed from transport types.

vLLM PrimeRlServingTokens adds prompt_token_ids and mm_placeholders on generate responses (plus prompt-id capture) so rollouts can align logical vs expanded prompts. forward() gains optional mm_forward_policy for per-family behavior (e.g. Qwen MRoPE / context-parallel deferral). Tests and the Qwen3-VL e2e check now expect raw content_parts and expanded prompt metadata instead of a features payload.

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

Authoritative multimodal ranges

  • Capture vLLM's finalized mm_placeholders from the engine input and return them beside prompt_token_ids.
  • Renderers forwards that metadata; Verifiers uses it as the source of truth for effective message spans and content attribution instead of inferring contiguous image-token runs.
  • Updated the stacked Renderers and Verifiers pins.
  • Validation: uv lock --check; 52 focused Prime tests passed against vLLM 0.28.0; Ruff and pre-push hooks passed.

@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