Skip to content

Add reward breakdowns, level curves, W&B metric organization (AMC-76)#23

Merged
amcheste merged 1 commit into
mainfrom
feature/amc-76-enhanced-wandb-logging
Apr 25, 2026
Merged

Add reward breakdowns, level curves, W&B metric organization (AMC-76)#23
amcheste merged 1 commit into
mainfrom
feature/amc-76-enhanced-wandb-logging

Conversation

@amcheste

Copy link
Copy Markdown
Owner

Summary

  • Enhances MonitoringCallback with three capabilities the observability stack was missing:
    • Reward component breakdowns: Accumulates reward_components on every env step (not just episode end) and logs reward/exploration_mean, reward/badge_mean, reward/time_mean, etc. as W&B scalars. Researchers can now see which reward signals the agent is exploiting over training.
    • Game-state level/money/party curves: Records player_level, pokemon_count, and money at episode boundaries. Logs game/player_level_mean, game/player_level_max, game/player_level_latest, plus pokemon count and money curves.
    • W&B define_metric() organization: Groups panels under episode/*, game/*, and reward/* with global_step as the x-axis so the W&B dashboard auto-creates structured panel groups.
  • Extends the episode table with 3 new columns: player_level, pokemon_count, money
  • Extends dashboard_state.json with level_history, money_history, pokemon_count_history, and reward_component_summary
  • Adds pokemon_count and money to MONITORED_INFO_KEYS
  • Multi-env safe: reward accumulators are keyed by env index and reset per-episode

W&B Dashboard After This PR

When you run training, the W&B dashboard will auto-organize into:

  • episode/ — reward_mean, reward_max, length_mean, best_reward
  • game/ — maps_visited, badges, event_flags, player_level, pokemon_count, money, screen captures
  • reward/ — per-component breakdown (exploration, badge, time, death, event_flags, etc.)

Test plan

  • 16 new tests added (30 total in test_monitoring_callback.py)
  • All 696 project tests pass
  • Verified reward accumulation across steps, accumulator reset between episodes, multi-env isolation
  • Verified graceful handling of missing fields and old wandb versions

🤖 Generated with Claude Code

…-76)

Enhances MonitoringCallback with three capabilities that were missing
from the observability stack:

1. Per-episode reward component breakdowns: accumulates reward_components
   on every env step and logs reward/exploration_mean, reward/badge_mean,
   etc. as W&B scalars so researchers can see which reward signals the
   agent exploits over training.

2. Game-state tracking: records player_level, pokemon_count, and money
   at episode boundaries and logs game/player_level_mean, _max, _latest
   plus pokemon and money curves to W&B.

3. W&B define_metric() calls: organizes panels under episode/*,
   game/*, and reward/* sections with global_step as the x-axis so
   the dashboard auto-creates useful panel groups.

Also extends the episode table and dashboard JSON snapshot with the
new fields, and adds pokemon_count and money to MONITORED_INFO_KEYS.

16 new tests (30 total), all 696 project tests pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@amcheste amcheste self-assigned this Apr 24, 2026
@amcheste amcheste merged commit afb7267 into main Apr 25, 2026
2 checks passed
amcheste added a commit that referenced this pull request Apr 30, 2026
…#23)

## Summary
- Enhances `MonitoringCallback` with three capabilities the observability stack was missing:
  - **Reward component breakdowns**: Accumulates `reward_components` on every env step (not just episode end) and logs `reward/exploration_mean`, `reward/badge_mean`, `reward/time_mean`, etc. as W&B scalars. Researchers can now see which reward signals the agent is exploiting over training.
  - **Game-state level/money/party curves**: Records `player_level`, `pokemon_count`, and `money` at episode boundaries. Logs `game/player_level_mean`, `game/player_level_max`, `game/player_level_latest`, plus pokemon count and money curves.
  - **W&B `define_metric()` organization**: Groups panels under `episode/*`, `game/*`, and `reward/*` with `global_step` as the x-axis so the W&B dashboard auto-creates structured panel groups.
- Extends the episode table with 3 new columns: `player_level`, `pokemon_count`, `money`
- Extends `dashboard_state.json` with `level_history`, `money_history`, `pokemon_count_history`, and `reward_component_summary`
- Adds `pokemon_count` and `money` to `MONITORED_INFO_KEYS`
- Multi-env safe: reward accumulators are keyed by env index and reset per-episode

## W&B Dashboard After This PR
When you run training, the W&B dashboard will auto-organize into:
- **episode/** — reward_mean, reward_max, length_mean, best_reward
- **game/** — maps_visited, badges, event_flags, player_level, pokemon_count, money, screen captures
- **reward/** — per-component breakdown (exploration, badge, time, death, event_flags, etc.)

## Test plan
- [x] 16 new tests added (30 total in `test_monitoring_callback.py`)
- [x] All 696 project tests pass
- [x] Verified reward accumulation across steps, accumulator reset between episodes, multi-env isolation
- [x] Verified graceful handling of missing fields and old wandb versions

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@amcheste amcheste deleted the feature/amc-76-enhanced-wandb-logging branch April 30, 2026 23:55
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.

1 participant