Repository navigation
Emit vLLM engine stats from the RL rollout sampler - #2336
Open
wenxindongwork wants to merge 1 commit into
Open
wenxindongwork wants to merge 1 commit into
wenxindongwork wants to merge 1 commit into
Conversation
wenxindongwork
requested review from
abheesht17,
hgao327,
jiangyangmu,
lc5211,
s-noghabi,
sizhit2,
tianshub and
wang2yn84
as code owners
September 21, 2026 04:49
AsyncLLM records iteration stats but never emits them on its own: do_log_stats() has no internal caller, and vLLM drives it from the API server's lifespan task in entrypoints/launchers/utils/server_utils.py. The synchronous LLMEngine is different -- it ticks do_log_stats_with_interval() from its own step loop -- but AsyncLLM delegates that to the serving layer. RLVllmSampler binds AsyncLLMEngine directly with no server in front of it, so the throughput / running-requests / KV-cache-usage line never printed, not even once. Run the same loop the server would, on the same VLLM_LOG_STATS_INTERVAL, and tear it down with the sampler. VLLMInProcessDriver already does this with a thread (_log_loop in tunix/generate/vllm_async_driver.py); this is the asyncio equivalent for the v2 sampler. Signed-off-by: wenxindongwork <wenxindong@google.com>
wenxindongwork
force-pushed
the
wxd/rollout-log-stats-main
branch
from
September 21, 2026 04:55
fbf00b9 to
9084585
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Starts a periodic
do_log_stats()task inRLVllmSampler.start()and cancels it instop(), so the rollout logs vLLM's standard engine stats line:Why
That line never appears in rollout logs — not once. It isn't emitted by the engine on a timer; it's emitted by whoever calls
do_log_stats(), and in this configuration nobody does.LoggingStatLogger.log()is reachable from exactly one place inAsyncLLM:do_log_statshas no internal caller. The ticker lives in the API server's lifespan:AsyncLLMstarts only the input-stream and output handlers; neither logs stats. (The synchronousLLMEngineis different — it drivesdo_log_stats_with_interval()from its own step loop.)RLVllmSamplerbindsAsyncLLMEnginedirectly with no server, so the stats are recorded and never flushed.This is not a config problem:
disable_log_statsdefaults toFalse, solog_stats=Trueand theStatLoggerManageris already constructed and recording.There is already a precedent in this repo —
VLLMInProcessDriverspawns a thread for exactly this (_log_loop,tunix/generate/vllm_async_driver.py:271-282). The v2 sampler never got the equivalent. Since its engine is async, this uses anasynciotask mirroring the server's_force_lograther than a thread.Testing
Drove
_log_stats_loopagainst a stub engine withVLLM_LOG_STATS_INTERVAL=0.1:Confirms the cadence, and that
stop()cancels the task cleanly (noCancelledErrorescaping, no pending-task warning).Not yet exercised against a real engine on TPU, hence draft. Note
log()downgrades itself tologger.debugwhenengine_is_idle(vllm/v1/metrics/loggers.py:260), so expect gaps between rollout batches rather than a strict every-10s line.