Skip to content

Fix parsing is_truncated for multi-turn envs - #856

Merged
mikasenghaas merged 1 commit into
mainfrom
mika/fix/multi-turn-parse-truncation
Aug 29, 2025
Merged

mikasenghaas merged 1 commit into
mainfrom
mika/fix/multi-turn-parse-truncation

Conversation

@mikasenghaas

@mikasenghaas mikasenghaas commented Aug 29, 2025 •

Copy link
Copy Markdown
Member

Based on #854, do not merge before.

Previously, the parse_truncated_completions, wrongly, appends truncation information for each response within a multi-turn interaction (e.g. many chat interactions, tool calls, etc.). This leads to a shape mismatch because the len(is_truncated) > batch_size which is unexpected.

This PR proposes the following logic for computing is_truncated for a multi-turn interaction: If any response within the multi-turn completion is truncated, the entire rollout is truncated. Note, that non-LLM responses like user messages or tool call responses, are not counted here (they do not have the response.finish_reason field and as such are always not truncated).

I verified that the multi-turn alphabet-sort environment is functional again (it is broken on current main)

Screenshot 2025-08-29 at 10 57 04 AM Screenshot 2025-08-29 at 10 57 13 AM

GitHub Issue: #855
Linear Issue: Resolves PRIMERL-81

@mikasenghaas
mikasenghaas changed the base branch from main to mika/chore/bump-envs August 29, 2025 08:56
@mikasenghaas
mikasenghaas force-pushed the mika/fix/multi-turn-parse-truncation branch from 30995bf to 4ed1ae0 Compare August 29, 2025 09:21
Comment thread src/prime_rl/orchestrator/utils.py Resolved
@mikasenghaas
mikasenghaas force-pushed the mika/fix/multi-turn-parse-truncation branch from 4ed1ae0 to c9caeaf Compare August 29, 2025 09:52
@mikasenghaas
mikasenghaas changed the base branch from mika/chore/bump-envs to main August 29, 2025 09:52
@mikasenghaas
mikasenghaas marked this pull request as ready for review August 29, 2025 09:53
@mikasenghaas
mikasenghaas merged commit d1f5859 into main Aug 29, 2025
@mikasenghaas
mikasenghaas deleted the mika/fix/multi-turn-parse-truncation branch August 5, 2026 04:27
hallerite added a commit that referenced this pull request Oct 2, 2026
Bumps prime-envs from 565e8a7 to e82de8b: PI-ProgramBench (#866), ProgramBench
on native Harbor (#856), the swebench-pro captured-patch artifact fix (#874),
and the HLE-Diamond (#853, #867) and Recursive Task Synthesis (#807)
environments. uv.lock picks up the new and removed workspace members.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.

2 participants