Skip to content

feat(orchestrator): add composable curricula - #3261

Open
hallerite wants to merge 5 commits into
mainfrom
chore/rename-rollout-source
Open

feat(orchestrator): add composable curricula#3261
hallerite wants to merge 5 commits into
mainfrom
chore/rename-rollout-source

Conversation

@hallerite

@hallerite hallerite commented Aug 13, 2026

Copy link
Copy Markdown
Member

Summary

Adds one checkpointed Curriculum per training source, composed from two user-space primitives:

  • one TaskSampler, which chooses tasks and observes every finalized result
  • zero or more named AdmissionGates, which all evaluate every result; a group trains only when every gate admits it

The orchestrator still owns environment mixing, rollout groups, batch backfill, and checkpoint timing. Admission runs after samples and algorithm credit are built. Rejected groups remain observable in the all trace stream but never occupy a training-batch slot, so the dispatcher naturally samples another task. The sampler observes rejected results before the gates run.

Discarded work is tracked independently in the active batch unit. A batch-equivalent with no admitted progress emits a no-progress window, and the existing ten-window guard fails loudly instead of allowing an all-rejected run to spin forever.

Sampler and gate state is namespaced in the curriculum checkpoint, and their metrics are exposed under curriculum/<env>/sampler/ and curriculum/<env>/gate/<name>/. The default sampler preserves epoch-shuffled finite iteration, sequential infinite iteration, and compatibility with existing source-position checkpoints.

The public surface lives in prime_rl.orchestrator.curriculum, organized like the existing algo package: interfaces and composition in base.py, with each concrete sampler or gate in its own module.

Two small implementations are included and can be used together:

  • DifficultyPools dispatches every finite task once, then samples scored tasks through named reward bands using each task's latest valid group-mean reward. Failed tasks cannot monopolize warm-up, and the final band is a catch-all.
  • AdvantageRangeGate rejects groups whose trainable-token advantages all fall inside an inclusive range; [0, 0] implements zero-advantage rejection.

This removes the separate rollout filter pipeline and its config slots. Task identity comes from Task.key in verifiers==0.3.1.dev33; synthetic error and cancellation traces retain the original key so finalized results remain attributable.

Validation

  • uv sync --all-extras
  • uv run ruff format ...
  • uv run ruff check src/prime_rl/orchestrator ...
  • uv run pytest tests/unit/orchestrator --ignore=tests/unit/orchestrator/test_qwen3_vl_e2e.py -q — 79 passed
  • migrated TOML configs parsed with tomllib
  • git diff --check

Note

Medium Risk
Training batch composition and task scheduling now depend on curriculum admission and sampler state; removing gibberish/repetition filtering changes degenerate-rollout handling unless users add custom gates.

Overview
Replaces the orchestrator pre/post-batch rollout filter pipeline with a per training-source Curriculum: one optional TaskSampler plus named AdmissionGates (AND-combined). Admission runs after tokenization and algorithm scoring; rejected groups stay in all traces but do not enter pending_batch, and the dispatcher keeps sampling until the batch fills.

TrainSource now hosts a Curriculum per env (weighted env mixing unchanged) instead of epoch/cursor task cycling; sampler/gate state checkpoints under each env’s curriculum. TrainSink calls on_result for admission, tracks is_admitted / no_progress, and can emit empty batches when enough work is discarded without progress (existing consecutive-empty guard updated). Built-ins: DifficultyPools and AdvantageRangeGate ([0,0] ≈ old zero-advantage filter).

Example configs migrate zero-advantage to curriculum.gates.zero_advantage with AdvantageRangeGate. Gibberish/repetition filters and their config types are removed (not reimplemented as gates). Metrics/docs shift from is_filtered / filter rates to is_admitted and curriculum/<env>/…. Bumps verifiers[harbor] to 0.3.1.dev33 for stable Task.key on curriculum results.

Reviewed by Cursor Bugbot for commit f6571a2. Bugbot is set up for automated code reviews on this repo. Configure here.

@hallerite
hallerite force-pushed the chore/rename-rollout-source branch from 5f687c4 to 40d35cc Compare August 13, 2026 13:32
@hallerite hallerite closed this Aug 13, 2026
@hallerite
hallerite deleted the chore/rename-rollout-source branch August 13, 2026 15:52
@hallerite
hallerite restored the chore/rename-rollout-source branch August 13, 2026 15:54
@hallerite hallerite reopened this Aug 13, 2026
@hallerite hallerite changed the title chore(orchestrator): rename Sampler to RolloutSource feat(orchestrator): task sampler skeleton Aug 13, 2026
@hallerite
hallerite force-pushed the chore/rename-rollout-source branch from c1053d5 to 7fa7dbe Compare August 13, 2026 23:28
@hallerite hallerite changed the title feat(orchestrator): task sampler skeleton feat(orchestrator): add user-authored curricula Aug 13, 2026
@hallerite hallerite changed the title feat(orchestrator): add user-authored curricula feat(orchestrator): add composable curricula Aug 13, 2026
@hallerite
hallerite marked this pull request as ready for review August 13, 2026 23:51
@hallerite
hallerite force-pushed the chore/rename-rollout-source branch from d3eb3cf to 127ff9a Compare August 13, 2026 23:52
@hallerite
hallerite marked this pull request as draft August 13, 2026 23:52
Comment thread src/prime_rl/orchestrator/curriculum/difficulty_pools.py
Comment thread src/prime_rl/orchestrator/train_sink.py
Comment thread src/prime_rl/orchestrator/curricula.py Outdated
@hallerite
hallerite marked this pull request as ready for review August 14, 2026 00:33

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f6571a2. Configure here.

Comment thread src/prime_rl/orchestrator/curriculum/difficulty_pools.py
@hallerite
hallerite marked this pull request as draft August 14, 2026 00:41
@hallerite
hallerite marked this pull request as ready for review August 14, 2026 11:43
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