Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
819993faac | ||
|
|
d57c59f16a |
Vendored
+1
-1
Submodule deps/renderers updated: f91c3e7061...6b8da3f7b1
+1
-1
@@ -112,7 +112,7 @@ patterns = ["WARNING"]
|
||||
def drop_warnings(rollout, *, patterns: list[str]) -> list[list[bool]]: ...
|
||||
```
|
||||
|
||||
Component compatibility is validated at config time: frozen-model sampling can only feed the `ce` loss component — the `rl` and `ref_kl` components need the live policy's own sampling logprobs for importance ratios — `opd` pointed at `"policy"` is rejected as degenerate (zero KL), `sft` without a frozen source is rejected (CE on the policy's own tokens is not a distillation target). A group-relative algorithm with `group_size = 1` produces all-zero advantages; the resulting empty batch is caught at runtime (the orchestrator warns and aborts after repeated zero-trainable batches), not at config time.
|
||||
Component compatibility is validated at config time: frozen-model sampling can only feed the `ce` loss component — the `rl` and `ref_kl` components need the live policy's own sampling logprobs for importance ratios — `opd` pointed at `"policy"` is rejected as degenerate (zero KL), `sft` without a frozen source is rejected (CE on the policy's own tokens is not a distillation target). A group-relative algorithm with `group_size = 1` produces all-zero advantages; the resulting empty batch is caught at runtime (the orchestrator warns and skips it), not at config time.
|
||||
|
||||
### Per-Env Algorithms
|
||||
|
||||
|
||||
@@ -89,9 +89,6 @@ monkey_patch_chat_completion_logprobs()
|
||||
# shutdown wedges (env-server ZMQ recv, vLLM admin aclose, etc)
|
||||
SHUTDOWN_TIMEOUT_S = 300
|
||||
|
||||
# Abort after this many consecutive train batches contain no samples.
|
||||
MAX_CONSECUTIVE_EMPTY_BATCHES = 10
|
||||
|
||||
# Maximum batches the orchestrator may run ahead of the trainer. The
|
||||
# dispatcher is paused via ``update_dispatch_gate`` once this is exceeded;
|
||||
# resumed when the watcher advances ``policy.version``.
|
||||
@@ -111,7 +108,6 @@ class Orchestrator:
|
||||
stopped: asyncio.Event
|
||||
draining: bool
|
||||
last_batch_at: float | None
|
||||
consecutive_empty_batches: int
|
||||
eval_triggered_at: dict[tuple[str, int], float]
|
||||
ckpt_manager: CheckpointManager
|
||||
component_tasks: list[asyncio.Task]
|
||||
@@ -161,7 +157,6 @@ class Orchestrator:
|
||||
self.last_batch_at = None
|
||||
# Trigger timestamps so eval success logs can report epoch duration
|
||||
self.eval_triggered_at = {}
|
||||
self.consecutive_empty_batches = 0
|
||||
self.gate_closed_at = None
|
||||
# Pulsed after inference applies a policy so held work can re-check it.
|
||||
self.version_advanced = asyncio.Event()
|
||||
@@ -597,19 +592,10 @@ class Orchestrator:
|
||||
return
|
||||
|
||||
if not batch.samples:
|
||||
self.consecutive_empty_batches += 1
|
||||
get_logger().warning(
|
||||
f"Step {step}: empty train batch after {len(batch.episodes)} finalized episodes "
|
||||
f"(consecutive empty batches: "
|
||||
f"{self.consecutive_empty_batches}/{MAX_CONSECUTIVE_EMPTY_BATCHES})"
|
||||
f"Step {step}: skipping empty train batch after {len(batch.episodes)} finalized episodes"
|
||||
)
|
||||
if self.consecutive_empty_batches >= MAX_CONSECUTIVE_EMPTY_BATCHES:
|
||||
raise RuntimeError(
|
||||
f"{self.consecutive_empty_batches} consecutive empty train batches — "
|
||||
"check algorithm credit and task difficulty."
|
||||
)
|
||||
return
|
||||
self.consecutive_empty_batches = 0
|
||||
effective = batch.cohort.effective
|
||||
n_trainable = sum(is_trainable(record.trace) for record in effective.records)
|
||||
if effective.num_traces and n_trainable / effective.num_traces <= 0.1:
|
||||
|
||||
@@ -25,8 +25,6 @@ from prime_rl.orchestrator.utils import episode_env_name, episode_group_id, min_
|
||||
from prime_rl.transports.batch import TrainingSample
|
||||
from prime_rl.utils.logger import get_logger
|
||||
|
||||
MAX_CONSECUTIVE_ZERO_OUTPUT_BATCH_EQUIVALENTS = 10
|
||||
|
||||
|
||||
def payload_tokens(samples: list[TrainingSample], trace: vf.Trace | None = None) -> int:
|
||||
"""Token cost of one trainer-bound trace."""
|
||||
@@ -315,9 +313,9 @@ class TrainSink:
|
||||
self._drop_stale(samples_by_trace)
|
||||
# A group's traces share one dispatch version, so the insertion sweep
|
||||
# voids all or none of them. A fully-voided group shipped nothing —
|
||||
# advance the zero-output budget instead of resetting it, or a stalled
|
||||
# advance the zero-output tally instead of resetting it, or a stalled
|
||||
# trainer plus a tight bound could void groups forever without ever
|
||||
# tripping the abort.
|
||||
# surfacing the warning.
|
||||
if not any(trace_id in self.pending_batch for trace_id in samples_by_trace):
|
||||
self._record_zero_output(group, [], n_owed)
|
||||
return
|
||||
@@ -333,7 +331,7 @@ class TrainSink:
|
||||
|
||||
def _record_zero_output(self, group: list[vf.Episode], survivors: list[vf.Trace], n_owed: int) -> None:
|
||||
"""``n_owed`` counts the group's full episode budget (arrived +
|
||||
cancelled), so dropped groups advance the zero-output budget at the
|
||||
cancelled), so dropped groups advance the zero-output tally at the
|
||||
same rate as fully-delivered ones."""
|
||||
if self.batch_size is not None:
|
||||
returned_traces = sum(len(episode.traces) for episode in group)
|
||||
@@ -342,9 +340,12 @@ class TrainSink:
|
||||
survivor_tokens = sum(trace.num_total_tokens for trace in survivors)
|
||||
episode_tokens = sum(episode.num_total_tokens for episode in group)
|
||||
self.zero_output_units += survivor_tokens or episode_tokens or self.config.seq_len * n_owed
|
||||
self._check_zero_output_budget()
|
||||
self._warn_zero_output()
|
||||
|
||||
def _check_zero_output_budget(self) -> None:
|
||||
def _warn_zero_output(self) -> None:
|
||||
"""Warn once per batch-equivalent of finalized units that shipped no
|
||||
payload, so a run that produces no training signal stays visible in the
|
||||
logs without aborting."""
|
||||
target = self.batch_size if self.batch_size is not None else self.token_batch_size
|
||||
assert target is not None
|
||||
windows = self.zero_output_units // target
|
||||
@@ -353,14 +354,8 @@ class TrainSink:
|
||||
self.reported_zero_output_windows = windows
|
||||
get_logger().warning(
|
||||
f"No admitted train payload after {self.zero_output_units} finalized units "
|
||||
f"(consecutive zero-output batch equivalents: "
|
||||
f"{windows}/{MAX_CONSECUTIVE_ZERO_OUTPUT_BATCH_EQUIVALENTS})"
|
||||
f"({windows} zero-output batch equivalents)"
|
||||
)
|
||||
if windows >= MAX_CONSECUTIVE_ZERO_OUTPUT_BATCH_EQUIVALENTS:
|
||||
raise RuntimeError(
|
||||
f"{windows} consecutive zero-output batch equivalents — "
|
||||
"check the curriculum admission policy, task difficulty, and staleness drops."
|
||||
)
|
||||
|
||||
def process_batch(self) -> TrainBatch:
|
||||
items = list(self.pending_batch.items())
|
||||
|
||||
Reference in New Issue
Block a user