Skip to content

feat(rollout): support deterministic concurrent rollouts - #1611

Closed
Le8r0nJames wants to merge 1 commit into
mainfrom
zjw/determinism-concurrent-rollout
Closed

feat(rollout): support deterministic concurrent rollouts#1611
Le8r0nJames wants to merge 1 commit into
mainfrom
zjw/determinism-concurrent-rollout

Conversation

@Le8r0nJames

Copy link
Copy Markdown
Collaborator

Description

This PR makes OpenAI-proxy rollouts reproducible without serializing grouped
samples or limiting SGLang to one running request.

It:

  • derives stable per-request sampling seeds from the logical session identity
    and request index, while preserving explicitly supplied seeds;
  • carries sample_idx through grouped workflow contexts and merges concurrent
    samples in canonical order;
  • adds seed support to the Chat Completions and Responses APIs and forwards it
    to SGLang as sampling_seed;
  • exposes SGLang deterministic inference configuration and warns when the
    selected attention backend is not documented as supported;
  • orders completed rollout tasks by task ID without random shuffling in
    deterministic mode;
  • warns when deterministic sampling is combined with
    max_head_offpolicyness > 0, because end-to-end deterministic training
    requires synchronous rollout generation.

The feature remains opt-in. Existing rollout behavior is unchanged when
deterministic_sampling is disabled.

Related Issue

N/A — no public issue is currently linked.

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 💥 Breaking change
  • 📝 Documentation update
  • ♻️ Refactoring
  • ⚡ Performance improvement
  • ✅ Test coverage improvement

Checklist

  • I have read the
    Contributing Guide
  • Pre-commit hooks pass (pre-commit run --all-files)
  • Relevant tests pass; new tests added for new functionality
  • Documentation updated (if applicable; built with ./docs/build_all.sh)
  • Branch is up to date with main
  • Self-reviewed via /review-pr command
  • This PR was created by a coding agent via /create-pr
  • This PR is a breaking change

Breaking Change Details (if applicable):

N/A.

Additional Context

SGLang deterministic inference provides batch-invariant execution for the
documented flashinfer, fa3, and triton attention backends. AReaL still
needs stable request seeds and canonical host-side ordering so concurrent
grouped samples remain reproducible.

For end-to-end deterministic training, users should configure:

rollout:
  deterministic_sampling: true
  max_head_offpolicyness: 0

sglang:
  enable_deterministic_inference: true

max_head_offpolicyness=0 does not serialize requests within a rollout batch.
Grouped samples and prompt workflows remain concurrent; it only disables
cross-step rollout/training staleness.

Validation performed:

  • 20 focused deterministic-sampling tests passed in the development image;
  • Ruff, formatting, SPDX, generated CLI documentation, and diff checks passed;
  • a 10-step Qwen3-0.6B colocated A/A run with batch size 16 and 8 samples per
    prompt produced identical 1,280 rollout records and bitwise-identical
    non-timing training scalars;
  • a frontier-only ablation matched both A/A arms and the deterministic
    reference exactly, confirming that deterministic task ordering and disabling
    shuffle are sufficient for the validated synchronous, no-rejection path.

Automatic seed derivation currently applies to OpenAI-proxy sessions. Callers
that issue semantically concurrent sibling requests within one session should
provide explicit stable seeds if they require a fixed request-to-seed mapping.

Derive stable per-request sampling seeds for OpenAI proxy sessions and preserve canonical sample order while grouped rollouts run concurrently.

Forward request seeds and deterministic-inference configuration to SGLang. Sort completed rollout tasks deterministically without shuffling, and warn when backend or rollout-staleness settings cannot provide the documented end-to-end determinism contract.
@sitabulaixizawaluduo

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. A similar submission has already been made. Please go to another PR for review and submit your comments.

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