Repository navigation
perf(client): read prime-rl's packed completion_logprobs - #174
faresobeid wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8a9619d. Configure here.
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a localized, backward-compatible performance path for decoding packed completion logprobs; existing response handling remains unchanged and NumPy was already a required dependency. The new behavior is covered by focused tests for valid and invalid payloads. Notes:
No code changes detected at You can add or adjust custom eligibility rules. Learn more. |
e134d56 to
e161362
Compare
e161362 to
19c558f
Compare

Lets
generate()read prime-rl's packed per-token logprobs.prime-rl's
/inference/v1/generateserver now returns the sampled-token logprobs as one base64 float32 array,choice.completion_logprobs = {data, shape, dtype}, instead ofchoice.logprobs.content(one JSON object per token). The per-token objects were a large part of the vLLM API server's GC load under RL traffic (see the prime-rl PR)._parse_completion_logprobsreadscompletion_logprobswhen present and applies the same checks as the per-token path: count matchescompletion_ids, values finite, no-9999.0sentinel. Returns the samelist[float].sampling_maskis passed through as before. On prime-rl's server it is now a packed{ids, counts}dict; verifiers decodes it.Companions: prime-rl PrimeIntellect-ai/prime-rl#3900 / verifiers PrimeIntellect-ai/verifiers#2778. Land renderers -> verifiers -> prime-rl; the prime-rl submodule pins must move to the merged commits.
Validation
tests/test_client.py: 32 passed (one new test for the packed path, incl. the sentinel check).ruff check/ruff format --check(0.15.12) on the changed files: clean.Note
Low Risk
Localized response parsing with fallback to stock vLLM; same validation semantics and output shape for downstream RL/verifier consumers.
Overview
Adds support for prime-rl’s compact per-token logprob payload on
/inference/v1/generateresponses.When
choice.completion_logprobsis present ({data, shape, dtype}with base64 float32),generate()decodes it via new_parse_packed_completion_logprobsand still returns the samelist[float]as before. Validation mirrors the legacy path: length must matchcompletion_ids, values must be finite, and vLLM’s-9999missing-logprob sentinel is rejected. If the packed field is absent, behavior is unchanged andchoice.logprobs.contentis parsed as today.A comment on
sampling_masknotes that prime-rl may return a packed CSR{ids, counts}form (still passed through unchanged). Tests cover the happy path plus sentinel and non-finite failures.Reviewed by Cursor Bugbot for commit e161362. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add packed
completion_logprobsdecoding to client renderer_parse_packed_completion_logprobsin renderers/client.py, which decodes base64 packed logprob payloads into a NumPy array using the supplied dtype and returns per-token floatsgeneratenow preferschoice.completion_logprobswhen present, falling back to the existingchoice.logprobs.contentparsingMalformedGenerateResponseErrorrenderers.clientnow requires NumPy as a dependencyMacroscope summarized 19c558f.