Repository navigation
feat(v1): carry media placeholder positions on message nodes - #3013
Draft
faresobeid wants to merge 1 commit into
Draft
faresobeid wants to merge 1 commit into
faresobeid wants to merge 1 commit into
Conversation
MessageNode.mm_placeholders records, per node, where the renderer placed each media item in the (vLLM-expanded) token stream. Branch.mm_placeholders and Branch.mm_token_type_ids derive from them, so a placeholder token id the policy sampled, or one in tool/user text, stays text. Prompt attribution is projected with the renderer's logical placeholder ranges instead of token ids, and bridges pass the prefix's placeholder positions to the renderer. The renderer token map (Trace.mm_token_type_id_map) is removed.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Branch.mm_token_type_idsmarks image tokens by token id (Trace.mm_token_type_id_map)._project_prompt_attributionaligns renderer and vLLM tokens the same way. A sampled<|image_pad|>, or one in tool text, becomes an extra image run. prime-rl then fails withimages=2, runs=3, or #3949 drops the branch.Design
MessageNode.mm_placeholders: {modality: [(offset, length)]}stores node-relative ranges over the node's (vLLM-expanded)token_ids. It is filled at commit from vLLM's returned ranges, or from the renderer's ranges when nothing was expanded. These are errors:Branch.mm_placeholdersconcatenates the node ranges.Branch.mm_token_type_idsis derived from it (1 = image, 2 = video)._project_prompt_attributionuses the renderer's logical placeholder ranges (TurnTokens.renderer_mm_placeholders) instead ofnp.isin(ids, map).PendingTurn.previous_mm_placeholders) to the renderer asprevious_multi_modal_data.Trace.mm_token_type_id_map,TurnTokens.mm_token_type_id_mapand the delta scalar field are removed.Validation
tests/unit/test_graph.py: new test where a sampled pad in the completion and a literal pad in tool text before the tool's image leave only the placed image as a placeholder. The existing expansion test was updated.pytest tests/unit: all pass excepttest_api::test_config_tree_imports_without_the_runtime, which also fails on the base commit in the prime-rl venv (it picks upsitecustomize/nvidia_cutlass_dslfrom that environment).Notes
60290d4), because verifiers main now requires prime-runs 0.1.5, which prime-rl's lock does not admit yet. It merges cleanly into main: none of the touched files changed since the pin.Merge order: renderers PrimeIntellect-ai/renderers#211, then this PR, then prime-rl PrimeIntellect-ai/prime-rl#4343.