Training can admit batches beyond trainer.total_epochs

オープン
#693 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 3 日以内に返信

@liuzhengyang699 がすでに取り組んでいます。

2026年11月6日 から。

  • #694 @liuzhengyang699 による — オープン

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
30/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
python

調査の方向性

Start with AgentLightningRayPPOTrainer.fit() and _next_train_batch_dict() in agentlightning/verl/trainer.py, then trace the asynchronous sized refill helper described in the issue. The body says CPU regressions are ready; run the focused tests for sync and async epoch limits, partial refills, carry-over groups, step limits, and final validation/checkpointing. Done means no new inputs are admitted past the epoch limit, admitted async groups drain, and the explicit step limit takes precedence.

索引モデルが issue の本文から書いたものです。

説明

With trainer.total_epochs=1 and a larger trainer.total_training_steps, synchronous training consumes the first batch of a second epoch before stopping. The outer fit() check runs before _next_train_batch_dict() discovers exhaustion; that helper increments the epoch and immediately opens the dataloader again.

Minimal CPU reproduction on bc3a9e8:

from types import SimpleNamespace
from agentlightning.verl.trainer import AgentLightningRayPPOTrainer

trainer = object.__new__(AgentLightningRayPPOTrainer)
trainer.config = SimpleNamespace(trainer=SimpleNamespace(total_epochs=1))
trainer.epoch = 1
trainer.train_dataloader = [{"item": [0, 1]}, {"item": [2, 3]}]
trainer._train_dataloader_iter = None
print([trainer._next_train_batch_dict()["item"] for _ in range(3)])
# [[0, 1], [2, 3], [0, 1]]

Only the first two batches belong to the requested epoch. A regression through fit() confirms the extra optimizer update when the step limit does not stop it first.

Asynchronous collection has the same unbounded iterator in its sized refill helper. A refill can cross the final epoch, while stopping immediately at the outer epoch check can leave previously admitted groups unfinished. The intended behavior is to stop admitting new inputs at the epoch limit and drain those groups, with the explicit step limit still taking precedence.

A focused fix and CPU regressions are ready. Nine of the initial 11 cases fail on unchanged main. Tests cover synchronous and asynchronous training, partial final refills, carry-over groups, independent step limits, and final validation/checkpointing. Checkpoint-resume epoch accounting is outside this change.

This was found during a follow-up audit with AI assistance. The reproduction and tests do not run GPU workers or end-to-end training.

主要言語
Python
スター
18.9k
フォーク
1.7k
平均マージ
5日 19時間
マージ済み PR(30日)
14

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/agent-lightning のほかの issue

microsoft/agent-lightning の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。