Skip to main content

Overview

All training classes in adaptive_harmony support logging metrics to external tracking services. Metrics include training loss, validation scores, grader evaluations, generation statistics, and any custom metrics from callbacks.

Available loggers

Adaptive Harmony supports four logging backends:

WandbLogger (Weights & Biases)

Integration with Weights & Biases for experiment tracking and visualization.
Installation:
Features:
  • Real-time metric visualization
  • Table logging for sample completions and evaluations
  • Hyperparameter tracking
  • Direct link to W&B dashboard via logger.training_monitoring_link
Setup:
  • Set your W&B API key: export WANDB_API_KEY=your_key_here
  • Or login via wandb login

MLFlowLogger

Integration with MLflow for experiment tracking.
Installation:
Features:
  • Metric and parameter logging
  • Table logging (exported as JSON artifacts)
  • Integration with MLflow UI
  • Support for custom tags and metadata
Setup:
  • Deploy an MLflow tracking server (can be deployed alongside Adaptive, check the Adaptive Helm Chart)
  • Set tracking_uri to your server URL

TBMetricsLogger (TensorBoard)

Integration with TensorBoard for visualization.
Installation:
Features:
  • Scalar metric tracking
  • Table logging (exported as HTML files with auto-generated index)
  • Text logging for string metrics
Setup:
  • Specify a directory for logs
  • View with: tensorboard --logdir=/path/to/tensorboard/logs

StdoutLogger

Simple console output logger. Prints metrics to stdout using rich formatting. No external dependencies required.
Features:
  • Pretty-printed output to console
  • No setup required
  • Useful for local development and debugging

Using globally configured logger

An external logging solution can be deployed globally for all runs in an Adaptive deployment to use. This is accomplished with environment variables defined in the Adaptive Helm Chart. The get_prod_logger() function automatically returns the appropriate logger based on your environment configuration, with an active run. Runs are automatically organized in a similar fashion as Adaptive runs, use-case first, then run name. This is the recommended approach for production recipes running on Adaptive.
How it works: The function checks for logger configuration in the following priority order:
  1. Weights & Biases - If WANDB_API_KEY environment variable is set
  2. MLflow - If MLFLOW_TRACKING_URI environment variable is set
  3. TensorBoard - If TENSORBOARD_LOGGING_DIR environment variable is set
  4. StdoutLogger - Fallback if none of the above are configured
Automatic configuration: When Adaptive runs your recipe, it automatically sets environment variables for:
  • HARMONY_JOB_ID - Unique identifier for this run
  • HARMONY_USE_CASE - Use case name
  • HARMONY_RECIPE_NAME - Recipe name
  • HARMONY_JOB_NAME - Job name
  • Plus any logger-specific variables you’ve configured in your deployment
Example:

What gets logged

Training classes automatically log: Scalar metrics:
  • loss/train - Training loss
  • loss/grad_norm - Gradient norm
  • rewards/* - Grader scores and statistics
  • kl_divergence - KL divergence from reference model (RL methods)
  • learning_rate - Current learning rate
From callbacks:
  • validation/rewards/* - Validation grader scores (GraderEvalCallback)
  • validation/loss - Validation loss (ValidationLossCallback)
  • generation/* - Sample generation metrics (GenerateSamplesCallback)
  • Any custom metrics from your callbacks
Tables:
  • Sample completions with prompts and responses
  • Grader evaluations with reasoning
  • Validation results
Hyperparameters:
  • All trainer parameters (learning rate, batch size, etc.)
  • Model configuration
  • Recipe config parameters
Training classes automatically link their logger’s monitoring dashboard to Adaptive’s progress reporting UI. When users view your run’s progress in Adaptive, they can click through to view detailed metrics in the external logging solution you have set up globally for your Adaptive deployment. See Progress reporting for more details.

Logging custom metrics

You can log custom metrics from your training code by calling the logger directly:
Or from custom callbacks by returning a dictionary from the callback method (see Training Callbacks).

Best practices

  1. Use get_prod_logger() for recipes - Let Adaptive handle logger selection and configuration automatically
  2. Use specific loggers for local development - When developing locally, you might want to use a specific logger:
  3. Configure one logger - Only set environment variables for one logger when deploying Adaptive to avoid confusion
  4. Check monitoring links - Access the dashboard URL via:
  5. Close loggers when done - Training classes handle this automatically, but if you’re using loggers manually: