Skip to content

feat(client): keep compact sampler-draw rows with their repeats - #202

Draft
faresobeid wants to merge 1 commit into
mainfrom
feat/compact-sampler-draws
Draft

faresobeid wants to merge 1 commit into
mainfrom
feat/compact-sampler-draws

Conversation

@faresobeid

@faresobeid faresobeid commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

_parse_compact_logprobs gets a second row mode. With "samples": true in the compact payload, each row is the sampled token followed by K i.i.d. draws from the sampler distribution q. The client returns the draws as completion_top_ids / completion_top_logprobs in draw order, repeats kept. Without the flag, parsing is unchanged: the head is ranked, deduplicated and tie-trimmed.

prime-rl uses these rows for Monte Carlo score centering without sampling replay: E_q[w s] ≈ mean_k w(v_k) s(v_k). Each draw has weight 1/K, so repeats must survive parsing.

Row checks: the first entry must be the sampled token, and there must be at least one draw. The existing value and offset validation still applies. Sampling-mask parsing is skipped for these rows (they carry no replay support).

Validation

uv run pytest tests/test_client.py (105 passed, 6 skipped), ruff check, ruff format --check; CI green (incl. Ty).

Dependencies

PrimeIntellect-ai/prime-rl#4232 emits these rows and pins deps/renderers to this branch (a727c5e). Re-pin to the merged commit when this lands.

Note

Support sampler-draw repeats in compact logprob parsing in client.py

  • Adds a samples flag to _parse_compact_logprobs in renderers/client.py. When true, the parser skips sampling-mask parsing and keeps every packed draw after the sampled-token entry, including duplicate token IDs, in original order.
  • Sampler rows are rejected when the first packed ID is not the sampled token or when no additional draw exists. The candidate-selection path is unchanged when samples is false or absent.
  • Adds a regression test in tests/test_client.py with repeated token IDs to verify repeats are preserved.

Macroscope summarized a727c5e.

faresobeid added a commit to PrimeIntellect-ai/prime-rl that referenced this pull request Oct 25, 2026
… the GPU

Untruncated score-centered requests no longer use vLLM's logprob return. The patched sampler writes the sampled token plus the top ids (vLLM's logprob layout) or K i.i.d. draws from the processed distribution (extra_args.prl_sampler_draws) into the packed sampling-mask transport. The server returns them as compact logprobs. Removes compact_logprobs.py and the logprobs_mode/max_logprobs setup; score centering enables enable_return_sampling_mask instead. Bumps renderers for sampler-draw rows (PrimeIntellect-ai/renderers#202).

This branch has not been deployed

No deployments
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