[misc,trainer,rollout] feat: add Prometheus metrics logging to experiment tracking #5291
+218
−1
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 does this PR do?
Adds the ability to query Prometheus metrics and log them to experiment tracking backends (WandB, TensorBoard, MLflow, etc.) during training. This allows users to correlate infrastructure metrics (GPU cache usage, throughput) with training metrics in a unified view.
Checklist Before Starting
[{modules}] {type}: {description}Test
Testing was performed locally/internally during development. The feature has been validated to work correctly with:
Due to the complexity of mocking Ray and Prometheus infrastructure, comprehensive unit tests are not included in this PR. The feature can be validated end-to-end by configuring
metrics_to_logand verifying metrics appear in experiment tracking backends.Test
Tested with the example config below. Metric was successfully logged to
rollout/vllm_generation_tokens_totalin tensorboard over a 20 iteration run on 2 nodes.API and Usage Example
Design & Code Changes
verl/workers/config/rollout.py: Addmetrics_to_logfield toPrometheusConfigverl/experimental/agent_loop/prometheus_utils.py: AddPrometheusClientclass (~180 lines)verl/trainer/ppo/ray_trainer.py: Initialize client and query metrics before loggingChecklist Before Submitting
Important
Please check all the following items before requesting a review, otherwise the reviewer might deprioritize this PR for review.