Skip to content

LMRewardsOperationalMetric metric

Bases: LMOperationalMetric

Base for LM metrics scoped to the reward-computation phase.

Reads from each bound LM's reward_cumulated_* counters, which the LM populates while Trainer.compute_reward is running.

Example:

program.compile(
    metrics=[
        synalinks.metrics.LMRewardsOperationalMetric(),
    ],
)
Source code in synalinks/src/metrics/lm_metrics.py
@synalinks_export(
    [
        "synalinks.metrics.LMRewardsOperationalMetric",
        "synalinks.LMRewardsOperationalMetric",
    ]
)
class LMRewardsOperationalMetric(LMOperationalMetric):
    """Base for LM metrics scoped to the reward-computation phase.

    Reads from each bound LM's `reward_cumulated_*` counters, which the
    LM populates while `Trainer.compute_reward` is running.

    Example:

    ```python
    program.compile(
        metrics=[
            synalinks.metrics.LMRewardsOperationalMetric(),
        ],
    )
    ```
    """

    _phase = "reward"