Skip to content

fix(rollout): guard agentic sync and deterministic diffusion eval - #294

Merged
CjhHa1 merged 6 commits into
mainfrom
fix/engine-owned-weight-sync
Aug 4, 2026
Merged

fix(rollout): guard agentic sync and deterministic diffusion eval#294
CjhHa1 merged 6 commits into
mainfrom
fix/engine-owned-weight-sync

Conversation

@haonan3

@haonan3 haonan3 commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • make AsyncAgenticRolloutEngine.sync_weights() the single Agentic push/version transaction, reject sync while a drive is live, and log each successful sync on the driver
  • route async and partial Agentic resume/boundary sync sites through that guarded transaction
  • make deterministic diffusion eval (eval_eta <= 0) a pure-ODE request by clearing the SDE gate and scheduler

The earlier batch-engine version-ledger and resident-policy eval changes have been removed. Batch AR/diffusion policy-version semantics are handled by #310; eval there keeps the current-policy contract (P=U at the hard boundary).

Related Issue

Follow-up to #287. Complementary to #310; this PR now contains only the independent Agentic guard/logging and diffusion eval fix.

Test Plan

  • ruff check and ruff format --check on all changed Python files
  • python3 -m py_compile on all changed Python files
  • CPU smoke: Agentic sync is rejected during a live drive without pushing, then succeeds and advances the ledger when idle
  • Pre-push hooks: YAML/TOML/AST/conflict/secret/Ruff/recipe-target/boundary checks

Compatibility / Risk

  • Agentic out-of-tree callers of bump_weight_version() must use sync_weights(weight_sync) so push and version advancement cannot diverge.
  • Deterministic diffusion eval changes only contradictory eta=0 + SDE-gate requests; stochastic eval is unchanged.
  • No async batch eval or deployment-cadence behavior changes remain in this PR.

@github-actions github-actions Bot added the wip Draft / work in progress label Aug 2, 2026
@haonan3
haonan3 force-pushed the fix/engine-owned-weight-sync branch from 4439031 to c077c35 Compare August 2, 2026 11:55
haonan3 added 2 commits August 2, 2026 21:09
…dger

Closes the weight_version accounting gap documented as a follow-up in #287:
ARTrainer.evaluate() pushed weights via _prepare_rollout without advancing
the driver-side counter, leaving the engine on unnumbered weights until the
next interval boundary. The async trainer families also disagreed on eval
policy: AR synced-without-bump, diffusion explicitly passed
sync_weights=False, agentic has no eval.

Structure: both driver-side engines replace bump_weight_version() with
sync_weights(weight_sync) - one call that pushes and advances the ledger,
so the pairing stops being call-site discipline. The batch engine also
enforces the quiesce invariant (raises before pushing if any generation is
in flight). All async sync sites (boundary, resume, agentic drive) route
through it; bump_weight_version drops to zero callers and is removed.

Policy: async eval becomes read-only. ARTrainer.evaluate() gains
sync_weights: bool = True (mirroring DiffusionTrainer.evaluate); the async
trainers override evaluate() with async-correct defaults (no push; diffusion
also defaults sleep_after=False), so bare evaluate() calls are safe outside
train() too. A pre-train explicit push raises a lifecycle RuntimeError
instead of an incidental AttributeError.

Deliberate behavior changes: (1) async-AR eval no longer pushes weights, so
BOTH the eval series and the training rollouts launched between an eval and
the next interval boundary change - they previously ran under eval-synced
fresher weights; deployment cadence is now governed solely by
weight_sync_interval. At interval=1, or when eval_interval is a multiple of
the sync interval, training is point-identical to main. (2) The scored eval
policy is 1..interval optimizer steps old (exactly 1 at interval=1). (3)
The resume-time push advances the ledger 0->1 (metric offset only -
eviction math is relative; the launch ceiling is computed from rollout_id).
@haonan3
haonan3 force-pushed the fix/engine-owned-weight-sync branch from c077c35 to 97329c3 Compare August 2, 2026 13:13
@haonan3
haonan3 marked this pull request as ready for review August 2, 2026 17:40
@github-actions github-actions Bot added need review Ready and waiting for review and removed wip Draft / work in progress labels Aug 2, 2026
haonan3 and others added 4 commits August 3, 2026 14:30
eval_eta=0 previously rode along with the training-resolved sde_indices —
a contradictory request the central kernel silently degrades to ODE but
BAGEL's worker-resident scheduler refuses (RuntimeError at the first gated
step). Clearing the gate at eval_eta<=0 makes the request say what eval
means; SD3-family trajectories are unchanged (they already ran ODE).
The actor-side [LoRA-SYNC] lines never reach the driver log, leaving
weight deployments invisible in stdout. sync_weights is now the single
push path, so one driver-side INFO line covers every async push.
Resolve the async conflicts by retaining only the Agentic drive guard and sync logging, plus the deterministic pure-ODE eval fix.
@CjhHa1 CjhHa1 changed the title fix(rollout): route async weight pushes through the engine version ledger fix(rollout): guard agentic sync and deterministic diffusion eval Aug 4, 2026

@CjhHa1 CjhHa1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed after the main rebase and scope reduction. The remaining diff is limited to the Agentic live-drive sync guard/logging and the deterministic diffusion pure-ODE fix; the batch ledger and resident-policy eval changes were removed for #310.

@github-actions github-actions Bot added approved Approved by reviewer and removed need review Ready and waiting for review labels Aug 4, 2026
@CjhHa1
CjhHa1 merged commit 49308c9 into main Aug 4, 2026
10 checks passed
@github-actions github-actions Bot removed the approved Approved by reviewer label Aug 4, 2026
@CjhHa1
CjhHa1 deleted the fix/engine-owned-weight-sync branch August 4, 2026 03:40
CjhHa1 added a commit to CjhHa1/UniRL that referenced this pull request Aug 4, 2026
Preserve the optimizer-update batch control while carrying forward Tencent-Hunyuan#294's independent Agentic sync guard/logging and pure-ODE eval fix.
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.

3 participants