Skip to content

feat(orchestrator): make target_lag a configurable field#2845

Open
EazyReal wants to merge 1 commit into
PrimeIntellect-ai:mainfrom
EazyReal:feat/orchestrator-target-lag-config
Open

feat(orchestrator): make target_lag a configurable field#2845
EazyReal wants to merge 1 commit into
PrimeIntellect-ai:mainfrom
EazyReal:feat/orchestrator-target-lag-config

Conversation

@EazyReal

@EazyReal EazyReal commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

What

TARGET_LAG — the maximum number of batches the orchestrator may run ahead of the trainer — was a hardcoded module constant (= 1) in orchestrator.py. As noted in #2812, this is a meaningful async/off-policy knob that operators can't tune (and it interacts with max_off_policy_steps) without editing source.

Fix

Promote it to OrchestratorConfig.target_lag (Field(1, ge=1), documented next to max_off_policy_steps), delete the constant, and read self.config.target_lag at the dispatch gate.

Default 1 preserves the current one-step-ahead pipelining behavior exactly. Larger values allow deeper look-ahead at the cost of staleness; 0 is rejected because it would keep the dispatcher paused in steady state.

Focused config tests cover the default and the lower bound.

Closes #2812

@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 50c05de. Configure here.

Comment thread src/prime_rl/orchestrator/orchestrator.py
@EazyReal

Copy link
Copy Markdown
Contributor Author

Good catch — you're right that target_lag=0 deadlocks (in steady state lead = (step+1) - version is always ≥ 1, so lead > 0 never reopens the gate). Since 0 isn't a usable value, I bounded the field ge=1 (default unchanged at 1) and dropped the "0 = synchronous" claim from the docs/tests.

@EazyReal EazyReal force-pushed the feat/orchestrator-target-lag-config branch from 50c05de to 10d0f46 Compare June 20, 2026 19:31
The maximum number of batches the orchestrator may run ahead of the trainer was
a hardcoded module constant (TARGET_LAG = 1), so operators could not tune the
async pipelining depth without editing source.

Promote it to OrchestratorConfig.target_lag (Field(1, ge=1)) and read it at the
dispatch-gate call site. Default 1 preserves existing behavior exactly; larger
values allow deeper look-ahead at the cost of staleness. Bounded ge=1 because 0
would keep the dispatcher paused permanently (the lead is always >= 1 in steady
state), deadlocking generation.

Closes PrimeIntellect-ai#2812

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@EazyReal EazyReal force-pushed the feat/orchestrator-target-lag-config branch from 10d0f46 to d64798c Compare June 30, 2026 09:00
@EazyReal

Copy link
Copy Markdown
Contributor Author

@mikasenghaas Could I get a quick review on this config PR? It surfaces target_lag with default 1 and keeps 0 rejected to avoid dispatcher deadlock.

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.

TARGET_LAG = 1 is a silent, hardcoded config choice that I think should be surfaced?

1 participant