Skip to content

Compute aggregate metrics - #866

Closed
gwarmstrong wants to merge 5 commits into
mainfrom
georgea/aggregate-metrics
Closed

gwarmstrong wants to merge 5 commits into
mainfrom
georgea/aggregate-metrics

Conversation

@gwarmstrong

@gwarmstrong gwarmstrong commented Mar 11, 2026 •

Copy link
Copy Markdown
Contributor

Add /aggregate_metrics route to resources and agent servers

Adds an /aggregate_metrics HTTP route to both SimpleResourcesServer and SimpleResponsesAPIAgent, enabling server-side computation of evaluation metrics after rollout collection.

What it does

After rollouts complete, the rollout collection pipeline POSTs all verify responses to /aggregate_metrics on each agent server. The agent either computes metrics itself (base agent default) or proxies to the resources server (simple_agent). The response contains three levels of metrics:

  • group_level_metrics: Per-task stats (mean/max/min/median/std per numeric field)
  • agent_metrics: Overall stats across all rollouts, plus any custom metrics from compute_metrics()
  • key_metrics: Headline numbers selected by get_key_metrics()

Override points

Resources servers and agent servers have two hooks for custom metrics via AggregateMetricsMixin (in reward_profile.py):

Hook Signature Purpose
compute_metrics(tasks) List[List[Dict]] → Dict[str, Any] Full access to all raw verify responses grouped by task. Merged into agent_metrics.
get_key_metrics(agent_metrics) Dict[str, Any] → Dict[str, Any] Select headline numbers from the final agent_metrics.

Why compute_metrics instead of describe_dataframe

The original spec proposed describe_dataframe(df: DataFrame) -> Series as the override point, where RewardProfiler passes a pandas DataFrame of numeric fields per group. This works for simple numeric aggregations but cannot express several categories of metrics that benchmarks need:

  1. Metrics on non-numeric fields. RewardProfiler filters to numeric columns only before building the DataFrame. majority@k requires extracted_answer (a string) for majority voting. ArenaMetrics requires judgement-gen-base (a string) for win-rate parsing. These fields are dropped before describe_dataframe ever sees them.

  2. Two-level aggregations. describe_dataframe is called independently per task group AND once overall. At the overall (agent) level, all rollouts are flattened into one DataFrame with task boundaries removed (TASK_INDEX_KEY_NAME is dropped). This makes it impossible to compute "average of per-task pass@k" (= mean(max(reward) per task)) because you can't recover which rollouts belong to which task. df["reward"].max() gives the global max, not the average of per-task maxes.

  3. Cross-run statistics. std_dev_across_runs requires the full N tasks × k rollouts matrix to compute per-run averages then take their standard deviation. The flat agent-level DataFrame has lost this structure.

  4. Full-population metrics. ArenaMetrics computes bootstrap confidence intervals over the entire set of pairwise comparison scores. This fundamentally cannot be decomposed into per-group-then-aggregate — it needs all scores at once in their original structure.

compute_metrics(tasks: List[List[Dict]]) receives all raw verify responses (numeric and non-numeric) grouped by task, which is a strict superset of what describe_dataframe could express. RewardProfiler still runs with its defaults to provide the baseline numeric stats.

Example output (default, no overrides)

5 tasks × 2 rollouts, all correct:

[
  {
    "agent_ref": {"name": "example_single_tool_call_simple_agent"},
    "agent_metrics": {
      "mean/reward": 1.0,
      "mean/input_tokens": 442.8,
      "mean/output_tokens": 719.8,
      "mean/total_tokens": 1162.6,
      "max/reward": 1.0,
      "max/input_tokens": 531.0,
      "max/output_tokens": 1841.0,
      "max/total_tokens": 2366.0,
      "min/reward": 1.0,
      "min/input_tokens": 316.0,
      "min/output_tokens": 202.0,
      "min/total_tokens": 518.0,
      "median/reward": 1.0,
      "median/input_tokens": 516.0,
      "median/output_tokens": 498.0,
      "median/total_tokens": 1021.5,
      "std/reward": 0.0,
      "std/input_tokens": 105.0,
      "std/output_tokens": 544.6,
      "std/total_tokens": 598.0
    },
    "key_metrics": {
      "mean/reward": 1.0,
      "mean/input_tokens": 442.8,
      "mean/output_tokens": 719.8,
      "mean/total_tokens": 1162.6
    },
    "group_level_metrics": [
      {"mean/reward": 1.0, "mean/input_tokens": 531.0, "...": "..."},
      {"mean/reward": 1.0, "mean/input_tokens": 525.0, "...": "..."},
      {"mean/reward": 1.0, "mean/input_tokens": 516.0, "...": "..."},
      {"mean/reward": 1.0, "mean/input_tokens": 316.0, "...": "..."},
      {"mean/reward": 1.0, "mean/input_tokens": 326.0, "...": "..."}
    ]
  }
]

Example output (with compute_metrics override)

Same structure, but agent_metrics includes custom fields from compute_metrics() (e.g. pass@k, pass@1, majority@k) and key_metrics is selected by get_key_metrics():

[
  {
    "agent_ref": {"name": "math_simple_agent"},
    "agent_metrics": {
      "mean/reward": 0.5,
      "max/reward": 1.0,
      "min/reward": 0.0,
      "std/reward": 0.522,
      "pass@k": 0.667,
      "pass@1": 0.5
    },
    "key_metrics": {
      "pass@k": 0.667,
      "pass@1": 0.5
    },
    "group_level_metrics": [
      {"mean/reward": 1.0, "std/reward": 0.0},
      {"mean/reward": 0.0, "std/reward": 0.0},
      {"mean/reward": 0.5, "std/reward": 0.577}
    ]
  }
]

@copy-pr-bot

copy-pr-bot Bot commented Mar 11, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

del result_strs

# Sort to ensure consistent ordering
rows.sort(key=lambda r: (r[TASK_INDEX_KEY_NAME], r[ROLLOUT_INDEX_KEY_NAME]))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should be replacing the logic here with the new flow right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Removed the local RewardProfiler.profile_from_data + write_to_disk block entirely. _aggregate_metrics.json now replaces both _reward_profiling.jsonl and _agent_metrics.json.

Comment thread nemo_gym/rollout_collection.py Outdated
# Strip heavyweight fields before sending
stripped = [{k: v for k, v in r.items() if k not in ("response", "responses_create_params")} for r in results]

try:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we omit this try/except pls? our metrics should always work

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, removed.

server_client = self.setup_server_client()
agg_request = AggregateMetricsRequest(verify_responses=stripped)
agg_response = await server_client.post(
server_name=agent_name,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we need to for loop over all the agent names in the dataset we're running collection on

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. _call_aggregate_metrics now groups results by agent_ref.name and calls /aggregate_metrics once per agent. All examples are updated accordingly.

Comment thread nemo_gym/base_resources_server.py Outdated
async def verify(self, body: BaseVerifyRequest) -> BaseVerifyResponse:
pass

def compute_metrics(self, tasks: List[List[Dict[str, Any]]]) -> Dict[str, Any]:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to apply these functions to the agent server too right? maybe we can make a AggregateMetricsMixin class in reward_profile.py that contains the majority of this logic and can be inherited from by the base resources and agent servers?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Created AggregateMetricsMixin in reward_profile.py with compute_metrics() and get_key_metrics() hooks. Both SimpleResourcesServer and SimpleResponsesAPIAgent inherit from it.

- Remove try/except around aggregate_metrics call
- Loop over all agent names instead of just first
- Extract AggregateMetricsMixin to reward_profile.py, inherited by both
  SimpleResourcesServer and SimpleResponsesAPIAgent
- Replace local RewardProfiler flow with server-side /aggregate_metrics
- Write single _aggregate_metrics.json with nested agent_metrics structure
- Preserve response.usage through stripping for usage-based metrics
@gwarmstrong

Copy link
Copy Markdown
Contributor Author

Made a couple more changes that improve ergonomics outside of the scope of the review.

Preserve response.usage through stripping

When sending verify responses to /aggregate_metrics, we strip heavyweight fields (response, responses_create_params) to reduce payload size. However, response.usage contains token/usage stats that are useful for aggregation. We now selectively preserve response.usage while still stripping the rest of response.

Docs

Added a reference page at docs/data/aggregate-metrics.md covering how the pipeline works, the output format, and how to write custom compute_metrics/get_key_metrics overrides with a working example.

@gwarmstrong

Copy link
Copy Markdown
Contributor Author

Moved to #890 — new branch to fix DCO sign-off (branch protection prevented force-push on this branch).

bxyu-nvidia pushed a commit that referenced this pull request Mar 12, 2026
> **Note:** Continuation of #866, moved to a new branch to fix DCO
sign-off (branch protection prevented force-push).

## Add `/aggregate_metrics` route to resources and agent servers

Adds an `/aggregate_metrics` HTTP route to both `SimpleResourcesServer`
and `SimpleResponsesAPIAgent`, enabling server-side computation of
evaluation metrics after rollout collection.

### What it does

After rollouts complete, the rollout collection pipeline POSTs all
verify responses to `/aggregate_metrics` on each agent server. The agent
either computes metrics itself (base agent default) or proxies to the
resources server (simple_agent). The response contains three levels of
metrics:

- **`group_level_metrics`**: Per-task stats (mean/max/min/median/std per
numeric field)
- **`agent_metrics`**: Overall stats across all rollouts, plus any
custom metrics from `compute_metrics()`
- **`key_metrics`**: Headline numbers selected by `get_key_metrics()`

### Override points

Resources servers and agent servers have two hooks for custom metrics
via `AggregateMetricsMixin` (in `reward_profile.py`):

| Hook | Signature | Purpose |
|---|---|---|
| `compute_metrics(tasks)` | `List[List[Dict]] → Dict[str, Any]` | Full
access to all raw verify responses grouped by task. Merged into
`agent_metrics`. |
| `get_key_metrics(agent_metrics)` | `Dict[str, Any] → Dict[str, Any]` |
Select headline numbers from the final agent_metrics. |

### Why `compute_metrics` instead of `describe_dataframe`

The original spec proposed `describe_dataframe(df: DataFrame) -> Series`
as the override point, where RewardProfiler passes a pandas DataFrame of
numeric fields per group. This works for simple numeric aggregations but
cannot express several categories of metrics that benchmarks need:

1. **Metrics on non-numeric fields.** RewardProfiler filters to numeric
columns only before building the DataFrame. `majority@k` requires
`extracted_answer` (a string) for majority voting. `ArenaMetrics`
requires `judgement-gen-base` (a string) for win-rate parsing. These
fields are dropped before `describe_dataframe` ever sees them.

2. **Two-level aggregations.** `describe_dataframe` is called
independently per task group AND once overall. At the overall (agent)
level, all rollouts are flattened into one DataFrame with task
boundaries removed (`TASK_INDEX_KEY_NAME` is dropped). This makes it
impossible to compute "average of per-task pass@k" (= `mean(max(reward)
per task)`) because you can't recover which rollouts belong to which
task. `df["reward"].max()` gives the global max, not the average of
per-task maxes.

3. **Cross-run statistics.** `std_dev_across_runs` requires the full N
tasks × k rollouts matrix to compute per-run averages then take their
standard deviation. The flat agent-level DataFrame has lost this
structure.

4. **Full-population metrics.** `ArenaMetrics` computes bootstrap
confidence intervals over the entire set of pairwise comparison scores.
This fundamentally cannot be decomposed into per-group-then-aggregate —
it needs all scores at once in their original structure.

`compute_metrics(tasks: List[List[Dict]])` receives all raw verify
responses (numeric and non-numeric) grouped by task, which is a strict
superset of what `describe_dataframe` could express. RewardProfiler
still runs with its defaults to provide the baseline numeric stats.

### Example output (default, no overrides)

5 tasks × 2 rollouts, all correct:

```json
[
  {
    "agent_ref": {"name": "example_single_tool_call_simple_agent"},
    "agent_metrics": {
      "mean/reward": 1.0,
      "mean/input_tokens": 442.8,
      "mean/output_tokens": 719.8,
      "mean/total_tokens": 1162.6,
      "max/reward": 1.0,
      "max/input_tokens": 531.0,
      "max/output_tokens": 1841.0,
      "max/total_tokens": 2366.0,
      "min/reward": 1.0,
      "min/input_tokens": 316.0,
      "min/output_tokens": 202.0,
      "min/total_tokens": 518.0,
      "median/reward": 1.0,
      "median/input_tokens": 516.0,
      "median/output_tokens": 498.0,
      "median/total_tokens": 1021.5,
      "std/reward": 0.0,
      "std/input_tokens": 105.0,
      "std/output_tokens": 544.6,
      "std/total_tokens": 598.0
    },
    "key_metrics": {
      "mean/reward": 1.0,
      "mean/input_tokens": 442.8,
      "mean/output_tokens": 719.8,
      "mean/total_tokens": 1162.6
    },
    "group_level_metrics": [
      {"mean/reward": 1.0, "mean/input_tokens": 531.0, "...": "..."},
      {"mean/reward": 1.0, "mean/input_tokens": 525.0, "...": "..."},
      {"mean/reward": 1.0, "mean/input_tokens": 516.0, "...": "..."},
      {"mean/reward": 1.0, "mean/input_tokens": 316.0, "...": "..."},
      {"mean/reward": 1.0, "mean/input_tokens": 326.0, "...": "..."}
    ]
  }
]
```

### Example output (with `compute_metrics` override)

Same structure, but `agent_metrics` includes custom fields from
`compute_metrics()` (e.g. `pass@k`, `pass@1`, `majority@k`) and
`key_metrics` is selected by `get_key_metrics()`:

```json
[
  {
    "agent_ref": {"name": "math_simple_agent"},
    "agent_metrics": {
      "mean/reward": 0.5,
      "max/reward": 1.0,
      "min/reward": 0.0,
      "std/reward": 0.522,
      "pass@k": 0.667,
      "pass@1": 0.5
    },
    "key_metrics": {
      "pass@k": 0.667,
      "pass@1": 0.5
    },
    "group_level_metrics": [
      {"mean/reward": 1.0, "std/reward": 0.0},
      {"mean/reward": 0.0, "std/reward": 0.0},
      {"mean/reward": 0.5, "std/reward": 0.577}
    ]
  }
]
```

---------

Signed-off-by: George Armstrong <[email protected]>
mahanfathi pushed a commit that referenced this pull request Mar 24, 2026
> **Note:** Continuation of #866, moved to a new branch to fix DCO
sign-off (branch protection prevented force-push).

## Add `/aggregate_metrics` route to resources and agent servers

Adds an `/aggregate_metrics` HTTP route to both `SimpleResourcesServer`
and `SimpleResponsesAPIAgent`, enabling server-side computation of
evaluation metrics after rollout collection.

### What it does

After rollouts complete, the rollout collection pipeline POSTs all
verify responses to `/aggregate_metrics` on each agent server. The agent
either computes metrics itself (base agent default) or proxies to the
resources server (simple_agent). The response contains three levels of
metrics:

- **`group_level_metrics`**: Per-task stats (mean/max/min/median/std per
numeric field)
- **`agent_metrics`**: Overall stats across all rollouts, plus any
custom metrics from `compute_metrics()`
- **`key_metrics`**: Headline numbers selected by `get_key_metrics()`

### Override points

Resources servers and agent servers have two hooks for custom metrics
via `AggregateMetricsMixin` (in `reward_profile.py`):

| Hook | Signature | Purpose |
|---|---|---|
| `compute_metrics(tasks)` | `List[List[Dict]] → Dict[str, Any]` | Full
access to all raw verify responses grouped by task. Merged into
`agent_metrics`. |
| `get_key_metrics(agent_metrics)` | `Dict[str, Any] → Dict[str, Any]` |
Select headline numbers from the final agent_metrics. |

### Why `compute_metrics` instead of `describe_dataframe`

The original spec proposed `describe_dataframe(df: DataFrame) -> Series`
as the override point, where RewardProfiler passes a pandas DataFrame of
numeric fields per group. This works for simple numeric aggregations but
cannot express several categories of metrics that benchmarks need:

1. **Metrics on non-numeric fields.** RewardProfiler filters to numeric
columns only before building the DataFrame. `majority@k` requires
`extracted_answer` (a string) for majority voting. `ArenaMetrics`
requires `judgement-gen-base` (a string) for win-rate parsing. These
fields are dropped before `describe_dataframe` ever sees them.

2. **Two-level aggregations.** `describe_dataframe` is called
independently per task group AND once overall. At the overall (agent)
level, all rollouts are flattened into one DataFrame with task
boundaries removed (`TASK_INDEX_KEY_NAME` is dropped). This makes it
impossible to compute "average of per-task pass@k" (= `mean(max(reward)
per task)`) because you can't recover which rollouts belong to which
task. `df["reward"].max()` gives the global max, not the average of
per-task maxes.

3. **Cross-run statistics.** `std_dev_across_runs` requires the full N
tasks × k rollouts matrix to compute per-run averages then take their
standard deviation. The flat agent-level DataFrame has lost this
structure.

4. **Full-population metrics.** `ArenaMetrics` computes bootstrap
confidence intervals over the entire set of pairwise comparison scores.
This fundamentally cannot be decomposed into per-group-then-aggregate —
it needs all scores at once in their original structure.

`compute_metrics(tasks: List[List[Dict]])` receives all raw verify
responses (numeric and non-numeric) grouped by task, which is a strict
superset of what `describe_dataframe` could express. RewardProfiler
still runs with its defaults to provide the baseline numeric stats.

### Example output (default, no overrides)

5 tasks × 2 rollouts, all correct:

```json
[
  {
    "agent_ref": {"name": "example_single_tool_call_simple_agent"},
    "agent_metrics": {
      "mean/reward": 1.0,
      "mean/input_tokens": 442.8,
      "mean/output_tokens": 719.8,
      "mean/total_tokens": 1162.6,
      "max/reward": 1.0,
      "max/input_tokens": 531.0,
      "max/output_tokens": 1841.0,
      "max/total_tokens": 2366.0,
      "min/reward": 1.0,
      "min/input_tokens": 316.0,
      "min/output_tokens": 202.0,
      "min/total_tokens": 518.0,
      "median/reward": 1.0,
      "median/input_tokens": 516.0,
      "median/output_tokens": 498.0,
      "median/total_tokens": 1021.5,
      "std/reward": 0.0,
      "std/input_tokens": 105.0,
      "std/output_tokens": 544.6,
      "std/total_tokens": 598.0
    },
    "key_metrics": {
      "mean/reward": 1.0,
      "mean/input_tokens": 442.8,
      "mean/output_tokens": 719.8,
      "mean/total_tokens": 1162.6
    },
    "group_level_metrics": [
      {"mean/reward": 1.0, "mean/input_tokens": 531.0, "...": "..."},
      {"mean/reward": 1.0, "mean/input_tokens": 525.0, "...": "..."},
      {"mean/reward": 1.0, "mean/input_tokens": 516.0, "...": "..."},
      {"mean/reward": 1.0, "mean/input_tokens": 316.0, "...": "..."},
      {"mean/reward": 1.0, "mean/input_tokens": 326.0, "...": "..."}
    ]
  }
]
```

### Example output (with `compute_metrics` override)

Same structure, but `agent_metrics` includes custom fields from
`compute_metrics()` (e.g. `pass@k`, `pass@1`, `majority@k`) and
`key_metrics` is selected by `get_key_metrics()`:

```json
[
  {
    "agent_ref": {"name": "math_simple_agent"},
    "agent_metrics": {
      "mean/reward": 0.5,
      "max/reward": 1.0,
      "min/reward": 0.0,
      "std/reward": 0.522,
      "pass@k": 0.667,
      "pass@1": 0.5
    },
    "key_metrics": {
      "pass@k": 0.667,
      "pass@1": 0.5
    },
    "group_level_metrics": [
      {"mean/reward": 1.0, "std/reward": 0.0},
      {"mean/reward": 0.0, "std/reward": 0.0},
      {"mean/reward": 0.5, "std/reward": 0.577}
    ]
  }
]
```

---------

Signed-off-by: George Armstrong <[email protected]>
@bxyu-nvidia
bxyu-nvidia deleted the georgea/aggregate-metrics branch March 26, 2026 22:43
jsw-zorro pushed a commit to niletron/Gym that referenced this pull request Apr 7, 2026
> **Note:** Continuation of NVIDIA-NeMo#866, moved to a new branch to fix DCO
sign-off (branch protection prevented force-push).

## Add `/aggregate_metrics` route to resources and agent servers

Adds an `/aggregate_metrics` HTTP route to both `SimpleResourcesServer`
and `SimpleResponsesAPIAgent`, enabling server-side computation of
evaluation metrics after rollout collection.

### What it does

After rollouts complete, the rollout collection pipeline POSTs all
verify responses to `/aggregate_metrics` on each agent server. The agent
either computes metrics itself (base agent default) or proxies to the
resources server (simple_agent). The response contains three levels of
metrics:

- **`group_level_metrics`**: Per-task stats (mean/max/min/median/std per
numeric field)
- **`agent_metrics`**: Overall stats across all rollouts, plus any
custom metrics from `compute_metrics()`
- **`key_metrics`**: Headline numbers selected by `get_key_metrics()`

### Override points

Resources servers and agent servers have two hooks for custom metrics
via `AggregateMetricsMixin` (in `reward_profile.py`):

| Hook | Signature | Purpose |
|---|---|---|
| `compute_metrics(tasks)` | `List[List[Dict]] → Dict[str, Any]` | Full
access to all raw verify responses grouped by task. Merged into
`agent_metrics`. |
| `get_key_metrics(agent_metrics)` | `Dict[str, Any] → Dict[str, Any]` |
Select headline numbers from the final agent_metrics. |

### Why `compute_metrics` instead of `describe_dataframe`

The original spec proposed `describe_dataframe(df: DataFrame) -> Series`
as the override point, where RewardProfiler passes a pandas DataFrame of
numeric fields per group. This works for simple numeric aggregations but
cannot express several categories of metrics that benchmarks need:

1. **Metrics on non-numeric fields.** RewardProfiler filters to numeric
columns only before building the DataFrame. `majority@k` requires
`extracted_answer` (a string) for majority voting. `ArenaMetrics`
requires `judgement-gen-base` (a string) for win-rate parsing. These
fields are dropped before `describe_dataframe` ever sees them.

2. **Two-level aggregations.** `describe_dataframe` is called
independently per task group AND once overall. At the overall (agent)
level, all rollouts are flattened into one DataFrame with task
boundaries removed (`TASK_INDEX_KEY_NAME` is dropped). This makes it
impossible to compute "average of per-task pass@k" (= `mean(max(reward)
per task)`) because you can't recover which rollouts belong to which
task. `df["reward"].max()` gives the global max, not the average of
per-task maxes.

3. **Cross-run statistics.** `std_dev_across_runs` requires the full N
tasks × k rollouts matrix to compute per-run averages then take their
standard deviation. The flat agent-level DataFrame has lost this
structure.

4. **Full-population metrics.** `ArenaMetrics` computes bootstrap
confidence intervals over the entire set of pairwise comparison scores.
This fundamentally cannot be decomposed into per-group-then-aggregate —
it needs all scores at once in their original structure.

`compute_metrics(tasks: List[List[Dict]])` receives all raw verify
responses (numeric and non-numeric) grouped by task, which is a strict
superset of what `describe_dataframe` could express. RewardProfiler
still runs with its defaults to provide the baseline numeric stats.

### Example output (default, no overrides)

5 tasks × 2 rollouts, all correct:

```json
[
  {
    "agent_ref": {"name": "example_single_tool_call_simple_agent"},
    "agent_metrics": {
      "mean/reward": 1.0,
      "mean/input_tokens": 442.8,
      "mean/output_tokens": 719.8,
      "mean/total_tokens": 1162.6,
      "max/reward": 1.0,
      "max/input_tokens": 531.0,
      "max/output_tokens": 1841.0,
      "max/total_tokens": 2366.0,
      "min/reward": 1.0,
      "min/input_tokens": 316.0,
      "min/output_tokens": 202.0,
      "min/total_tokens": 518.0,
      "median/reward": 1.0,
      "median/input_tokens": 516.0,
      "median/output_tokens": 498.0,
      "median/total_tokens": 1021.5,
      "std/reward": 0.0,
      "std/input_tokens": 105.0,
      "std/output_tokens": 544.6,
      "std/total_tokens": 598.0
    },
    "key_metrics": {
      "mean/reward": 1.0,
      "mean/input_tokens": 442.8,
      "mean/output_tokens": 719.8,
      "mean/total_tokens": 1162.6
    },
    "group_level_metrics": [
      {"mean/reward": 1.0, "mean/input_tokens": 531.0, "...": "..."},
      {"mean/reward": 1.0, "mean/input_tokens": 525.0, "...": "..."},
      {"mean/reward": 1.0, "mean/input_tokens": 516.0, "...": "..."},
      {"mean/reward": 1.0, "mean/input_tokens": 316.0, "...": "..."},
      {"mean/reward": 1.0, "mean/input_tokens": 326.0, "...": "..."}
    ]
  }
]
```

### Example output (with `compute_metrics` override)

Same structure, but `agent_metrics` includes custom fields from
`compute_metrics()` (e.g. `pass@k`, `pass@1`, `majority@k`) and
`key_metrics` is selected by `get_key_metrics()`:

```json
[
  {
    "agent_ref": {"name": "math_simple_agent"},
    "agent_metrics": {
      "mean/reward": 0.5,
      "max/reward": 1.0,
      "min/reward": 0.0,
      "std/reward": 0.522,
      "pass@k": 0.667,
      "pass@1": 0.5
    },
    "key_metrics": {
      "pass@k": 0.667,
      "pass@1": 0.5
    },
    "group_level_metrics": [
      {"mean/reward": 1.0, "std/reward": 0.0},
      {"mean/reward": 0.0, "std/reward": 0.0},
      {"mean/reward": 0.5, "std/reward": 0.577}
    ]
  }
]
```

---------

Signed-off-by: George Armstrong <[email protected]>
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.

2 participants