Repository navigation
feat(client): pass through sampling-mask logprobs and by-handle payload segments - #170
faresobeid wants to merge 7 commits into
Conversation
ApprovabilityVerdict: Needs Human Approval Macroscope's review found this PR requires human approval — The PR is a small, backwards-compatible pass-through of optional server metadata and does not materially change existing request or response behavior. Human review is still warranted because two unresolved comments identify concrete reasoning-text correctness issues elsewhere in the PR branch. Notes:
You can add or adjust custom eligibility rules. Learn more. |
01c9cce to
1cd3446
Compare
e134d56 to
e161362
Compare
1cd3446 to
ea01237
Compare
e161362 to
19c558f
Compare
ea01237 to
ecfeef7
Compare
Dismissing prior approval to re-evaluate d3a1af0
Dismissing prior approval to re-evaluate 030b208
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 030b208. Configure here.
| close == -1, text[start : close if close != -1 else len(text)], by_tool | ||
| close == -1, | ||
| text[start : close if close != -1 else len(text)].replace(open_marker, ""), | ||
| by_tool, |
There was a problem hiding this comment.
Reasoning text drops think markers
Medium Severity
scan_reasoning already skips the leading <think> opener, then deletes every later open_id and every <think> substring before decoding what remains. Reasoning that mentions the tag, or a truncated </think>, loses those characters, and neighboring tokens can merge into different text.
Reviewed by Cursor Bugbot for commit 030b208. Configure here.
| (reasoning or "").rstrip() | ||
| if parsed.boundary.is_open | ||
| else (reasoning or "").rstrip() or None | ||
| ), |
There was a problem hiding this comment.
DeepSeek reasoning boundary whitespace stripped
Medium Severity
parse_deepseek_v4 always rstrips reasoning and turns whitespace-only content into "". The newline the model emits before </think>, and a content channel that is only that separator, disappear from the parsed message.
Reviewed by Cursor Bugbot for commit 030b208. Configure here.
# Conflicts: # renderers/client.py


renderers.client.generate()passes two more optional fields of prime-rl's/inference/v1/generateresponse through, next tosampling_mask. Pure pass-through: no request-side change, no parsing. Servers that do not send them (stock vLLM, current prime-rl main) giveNone.sampling_mask_logprobs: the sampler's logprob at each sampling-mask id, packed base64 float32, parallel to the packedsampling_maskids.payload: by-handle segments{field, file, offset, pos, rows, dtype, shape}of a shared file that the inference server writes instead of returningrouted_experts/sampling_maskinline.Validation
uv run pytest tests/test_client.py(104 passed, 6 skipped),ruff check,ruff format --check,ty check renderers(warnings only, as on main); CI green.Dependencies
payloadonto traces; lands with this PR.payloadwriter was feat: pass router-replay ids and sampling masks by handle on multi-node runs prime-rl#3902 and thesampling_mask_logprobswriter feat: exact score centering over the sampling mask (arXiv:2609.20807) prime-rl#3794 (both closed unmerged).Note
Expose
sampling_mask_logprobsandpayloadin clientgenerateresponsegeneratein renderers/client.py now readssampling_mask_logprobsfrom the inference response choice and returns it alongsidesampling_mask.payload, which holds by-handle side-array metadata for data stored by the inference server instead of inline.generatesee two new keys in the returned dictionary; existing fields are unchanged.Macroscope summarized 424ba10.
Note
Low Risk
Additive response pass-through only; no request, validation, or behavior changes when engines omit the new fields.
Overview
Extends
generate()so callers get two more optional fields from prime-rl’s/inference/v1/generateresponse, with no request or parsing changes.sampling_mask_logprobsis forwarded from the choice (packed float32 logprobs parallel tosampling_maskids when score centering is enabled).payloadis forwarded for by-handle segments pointing at a shared file when the server offloadsrouted_experts/sampling_maskinstead of returning them inline. Both appear in the returned dict and docstring; absent keys becomeNone, same as existing optional pass-throughs likesampling_mask.Reviewed by Cursor Bugbot for commit 424ba10. Bugbot is set up for automated code reviews on this repo. Configure here.