Skip to content

Conversation

@corbt
Copy link
Contributor

@corbt corbt commented Jan 19, 2026

Summary

Implements RFC #511 - moves trajectory persistence and metrics reporting from the backend to the Model class, allowing backends to focus solely on training.

Key Changes

Model Class Additions

  • Model.log() now handles parquet writing, metrics calculation, history.jsonl, and wandb logging inline
  • New base_path attribute (default: ".art") - configurable output path
  • New report_metrics attribute - explicit control over wandb logging (None = auto-detect, ["wandb"] = enable, [] = disable)
  • New _get_wandb_run() method for lazy wandb initialization
  • get_step() method now available on base Model class (returns 0 for non-trainable)

TrainableModel Changes

  • train() now calls log() first, then delegates to backend
  • delete_checkpoints() reads history.jsonl locally to determine best checkpoint, then calls backend

Backend Simplification

  • Removed Backend._log() method entirely
  • Renamed _delete_checkpoints() to _delete_checkpoint_files(steps_to_keep)
  • Removed _log_metrics(), _get_wandb_run(), _get_reward_std_dev_learning_rate_multiplier() from LocalBackend
  • Backends now focus only on training and checkpoint file deletion

Breaking Changes

For Backend Interface (internal API, not user-facing)

  1. Backend._log() method removed
  2. Backend._delete_checkpoints(benchmark, smoothing) renamed to _delete_checkpoint_files(steps_to_keep)

For ServerlessBackend Users

  • Trajectories are now saved locally (via Model.log()) instead of being sent to the API
  • This is a functional change but the user API remains the same

Removed Feature

  • scale_learning_rate_by_reward_std_dev internal config option removed - users who need this can implement it themselves using the history.jsonl data

Migration Guide

No changes required for standard usage. The following APIs work exactly as before:

await model.log(trajectories, split="val")
await model.train(trajectory_groups, config=art.TrainConfig(learning_rate=5e-5))
await model.delete_checkpoints()

New optional configuration:

model = art.TrainableModel(
    ...,
    base_path="/custom/path",      # Custom output directory (default: ".art")
    report_metrics=["wandb"],      # Explicit wandb control (default: None = auto)
)

Tests

Added comprehensive test suite in tests/unit/test_frontend_logging.py covering:

  • Parquet compatibility with existing readers
  • history.jsonl format compatibility with polars
  • Path structure matching LocalBackend locations
  • Metric calculation and prefixing
  • Wandb integration logic
  • New model attributes

Closes #511

Implements RFC #511 - moves trajectory persistence and metrics reporting
from the backend to the Model class, allowing backends to focus solely on training.

Key changes:
- Model.log() now handles parquet writing, metrics calculation, history.jsonl
- Model gains base_path and report_metrics attributes for configuration
- TrainableModel.train() calls log() first, then backend._train_model()
- TrainableModel.delete_checkpoints() reads history.jsonl locally
- Backend._log() removed; _delete_checkpoints() renamed to _delete_checkpoint_files()
- Removed scale_learning_rate_by_reward_std_dev handling (users can implement if needed)

Breaking changes:
- Backend interface: _log() removed, _delete_checkpoints() renamed
- ServerlessBackend: trajectories now saved locally instead of sent to API

Closes #511
@corbt corbt merged commit 8636830 into main Jan 19, 2026
2 checks passed
@corbt corbt deleted the frontend-logging branch January 19, 2026 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RFC: move trajectory logging from the backend to the frontend

3 participants