feat: version rollout weight updates

Track a monotonic policy version across optimizer steps, scheduler updates, and rollout results. Serialize synchronous generation with weight acknowledgements and invalidate reusable prefix KV entries so cached samples remain attributable to the behavior policy that generated them.
This commit is contained in:
0z5a
2026-09-02 19:01:41 +08:00
parent 1fad50d847
commit e58a728b80
13 changed files with 232 additions and 7 deletions
+5
View File
@@ -318,6 +318,11 @@ class TrainContextBuilder:
tokenizer=tokenizer,
max_batch_size=group_size * max(1, cfg.batch_per_device),
max_seq_len=getattr(context.model.config, "max_position_embeddings", None),
policy_version=(
context.checkpoint.meta.get("policy_version", context.optimizer_step)
if context.checkpoint is not None
else context.optimizer_step
),
)
generator = RolloutGenerator(
scheduler=scheduler,