Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/algorithms.md
Original file line number Diff line number Diff line change
Expand Up @@ -443,9 +443,9 @@ demo_key = "demonstration"

Scoring runs before curriculum admission, so a rollout that is later rejected still costs its reference compute.

The orchestrator filters samples with no training signal. This includes samples with zero advantage on all RL tokens. Samples that still carry CE or reference-KL components are retained. Filtering an RL token also removes its trainer/inference mismatch-KL contribution.
By default, the orchestrator filters samples with no training signal. This includes samples with zero advantage on all RL tokens. Samples that still carry CE or reference-KL components are retained. Filtering an RL token also removes its trainer/inference mismatch-KL contribution. Set `orchestrator.train.filter_zero_advantages = false` to retain zero-advantage RL tokens and their mismatch-KL contribution.

`orchestrator.constant_trainer_batch_size` defaults to `true`. The orchestrator filters samples before they count toward the batch target. It collects replacements, so rollout-based batches contain `orchestrator.batch_size` training traces. Set the option to `false` to filter after collection without replacement. This setting can improve orchestrator throughput, but it produces smaller trainer batches.
`orchestrator.constant_trainer_batch_size` defaults to `true`. When zero-advantage filtering is enabled, the orchestrator filters samples before they count toward the batch target. It collects replacements, so rollout-based batches contain `orchestrator.batch_size` training traces. Set the option to `false` to filter after collection without replacement. This setting can improve orchestrator throughput, but it produces smaller trainer batches.

## Curricula

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,9 @@ class TrainConfig(BaseConfig):
sampling: TrainSamplingConfig = TrainSamplingConfig()
"""Shared training sampling configuration."""

filter_zero_advantages: bool = True
"""Remove zero-advantage RL tokens before shipping samples to the trainer."""

@model_validator(mode="after")
def resolve_env_defaults(self):
"""Resolve per-env overrides: inherit group-level sampling (the worker ``pool``
Expand Down
4 changes: 2 additions & 2 deletions src/prime_rl/orchestrator/train_sink.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ async def process_group(self, group_id: str) -> None:
"it requires vLLM's native sampling-mask capture (>= 0.28)."
)
stamp_loss_routing(sample, env.algorithm.action_loss_type)
if self.config.constant_trainer_batch_size:
if self.config.train.filter_zero_advantages and self.config.constant_trainer_batch_size:
samples = [sample for sample in samples if _prune_zero_advantages(sample)]
if samples:
samples_by_trace[trace.id] = samples
Expand Down Expand Up @@ -383,7 +383,7 @@ def process_batch(self) -> TrainBatch:
for trace_id in selected_ids:
del self.pending_batch[trace_id]

if not self.config.constant_trainer_batch_size:
if self.config.train.filter_zero_advantages and not self.config.constant_trainer_batch_size:
selected_by_trace = {
trace_id: [sample for sample in samples if _prune_zero_advantages(sample)]
for trace_id, samples in selected
Expand Down