Skip to content

feat(orchestrator): add curriculum examples - #3266

Merged
hallerite merged 1 commit into
chore/rename-rollout-sourcefrom
feat/sampler-weights
Aug 13, 2026
Merged

feat(orchestrator): add curriculum examples#3266
hallerite merged 1 commit into
chore/rename-rollout-sourcefrom
feat/sampler-weights

Conversation

@hallerite

@hallerite hallerite commented Aug 13, 2026

Copy link
Copy Markdown
Member

Stacked on #3261. This PR adds only two small policies on the user-space curriculum surface:

  • DifficultyPools: for finite tasksets, sample every task once, track each task's latest group-mean reward by stable Task.key, choose a nonempty named pool by its configured weight, then sample uniformly within the pool. RNG and pool state round-trip through checkpoints.
  • AdvantageRangeGate: reject a group when all trainable-token advantages fall inside [reject_min, reject_max]. The default [0, 0] implements zero-advantage rejection; algorithms without an advantage stream pass through.

The existing dynamic-sampling wiki-search and Intellect configs now select AdvantageRangeGate per source. No weighting framework, posterior estimator, built-in component registry, rejection sampler, exploration floor, or custom mini-protocol is introduced—the examples are ordinary Curriculum subclasses intended to be copied or extended in user code.

Validation

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

Note

Medium Risk
AdvantageRangeGate changes which groups train and increases resampling under oversampling; mis-tuned reject ranges could starve batches. DifficultyPools only affects task selection on finite tasksets.

Overview
Adds built-in curriculum policies in prime_rl.orchestrator.curricula and wires the advantage gate into example training configs.

DifficultyPools changes finite-task sampling after each task has been seen once: it keeps the latest mean group reward per task, buckets tasks into named pools via thresholds, then picks a pool by weights and a task uniformly inside it. Unseen tasks are still drawn first. Pool occupancy and checkpoint state (task_rewards) are exposed through metrics and state_dict.

AdvantageRangeGate changes which rollout groups enter the training batch: on_result rejects a group when every trainable-token advantage lies in [reject_min, reject_max] (default [0, 0] drops all-zero-advantage groups). Groups with no advantage stream are still admitted.

docs/algorithms.md documents both with TOML examples. Wiki-search and intellect-3.1 example sources (plus CI nightly wiki-search) now set curriculum = { import_path = "prime_rl.orchestrator.curricula.AdvantageRangeGate" }. Unit tests cover pool metrics/checkpoint resume and gate behavior (tolerance band, trainable mask).

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

@hallerite
hallerite marked this pull request as ready for review August 13, 2026 16:11
@hallerite hallerite changed the title feat(orchestrator): sampler weights (monitoring) feat(orchestrator): sampler weights, difficulty pools, weighted task sampling Aug 13, 2026
Comment thread src/prime_rl/orchestrator/task_sampler.py Outdated
Comment thread src/prime_rl/orchestrator/task_stats.py Outdated
@hallerite
hallerite force-pushed the chore/rename-rollout-source branch from c1053d5 to 7fa7dbe Compare August 13, 2026 23:28
@hallerite
hallerite force-pushed the feat/sampler-weights branch from b6ccbc3 to 825f622 Compare August 13, 2026 23:28
@hallerite hallerite changed the title feat(orchestrator): sampler weights, difficulty pools, weighted task sampling feat(orchestrator): add curriculum examples Aug 13, 2026
@hallerite
hallerite marked this pull request as draft August 13, 2026 23:31

@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 2 potential issues.

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 825f622. Configure here.

[[orchestrator.train.source]]
name = "swe"
ratio = 0.3
curriculum = { import_path = "prime_rl.orchestrator.curricula.AdvantageRangeGate" }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Advantage gate hangs group_size=1

High Severity

Enabling default AdvantageRangeGate on intellect-3.1 with unset group_size (defaults to 1) makes every GRPO group have zero advantages, so every group is rejected. Rejected groups never enter pending_batch, so the train sink never fills a batch and training hangs without hitting the empty-batch abort.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 825f622. Configure here.

if not rewards:
return True
self.task_rewards[result.task_key] = sum(rewards) / len(rewards)
return True

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Failed tasks starve pool sampling

Medium Severity

DifficultyPools only records a task after a successful reward, so permanently failing tasks stay in the unseen set. Once every healthy task has been seen, sample only returns those failing tasks. Their groups never enter pending_batch, so training can hang.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 825f622. Configure here.

@hallerite
hallerite merged commit 825f622 into chore/rename-rollout-source Aug 13, 2026
14 checks passed
@hallerite
hallerite deleted the feat/sampler-weights branch August 13, 2026 23:50
@hallerite

Copy link
Copy Markdown
Member Author

Superseded by #3261, which now contains the example implementations and the sampler-plus-admission-gates composition model.

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