Skip to main content

Overview

Rubrics manage the scoring logic for rollouts, combining multiple reward functions into a final reward signal. Each rubric holds reward functions, computes weighted combinations, and tracks metrics for observability.

Basic Reward Functions

Reward functions evaluate rollouts and return floats (typically 0.0 to 1.0). They request data by naming arguments:

Available Arguments

Reward functions can request these standard arguments: Type signatures:

Argument Injection Pattern

The rubric uses introspection to inject only requested arguments:

Multiple Reward Functions

Combine reward functions with custom weights:
Final reward computation:

Adding Functions Dynamically

Execution Order and State Sharing

Reward functions execute sequentially in the order they’re added. Since state is mutable, earlier functions can store computed values for later functions:
Execution flow:
  1. compute_similarity runs, stores state["similarity"]
  2. similarity_threshold runs, reads cached value
  3. Final reward = 0.0 * similarity + 1.0 * threshold

Group-Based Reward Functions

During evaluation and RL training, rollouts are organized into groups by example_id. Group reward functions operate on all rollouts for an example together:

Detection

Group functions are detected by:
  1. Plural argument names: completions, prompts, answers, states, tasks, infos
  2. Return type: list[float] instead of float

Available Group Arguments

Example: Relative Ranking

Shared Objects

Rubrics can provide shared objects accessible to all reward functions via class_objects:

Parsers

Parsers extract structured content from model responses:
Built-in parsers:
  • vf.Parser() - Pass-through (no parsing)
  • vf.XMLParser(fields=[...]) - Extract XML tags
  • vf.ThinkParser() - Extract content after </think>
  • vf.MaybeThinkParser() - Handle optional <think> tags

Judges (LLM-as-Judge)

JudgeRubric integrates LLM-based evaluation:
Built-in judge callable:
Exposed objects:
  • judge - Callable that formats prompt and calls judge model
  • judge_client - Raw AsyncOpenAI client
  • judge_model - Model name string
  • judge_prompt - Template string
  • judge_sampling_args - Sampling parameters dict

Custom Shared Objects

Add domain-specific helpers:

Rubric Groups

Combine multiple rubrics for heterogeneous scoring:
Behavior:
  • All rubrics execute in parallel
  • Final reward = sum of all rubric rewards
  • Metrics from all rubrics are collected together
Use cases:
  • Combining deterministic and LLM-based evaluation
  • Multi-faceted scoring (correctness + style + efficiency)
  • Environment-specific monitors + task-specific rewards

Metrics and Monitor Rubrics

Adding Metrics

Metrics are reward functions with weight=0.0 (tracked but don’t affect reward):

Monitor Rubrics

Environments automatically include monitor rubrics for tracking metrics: Example monitor rubric:

Custom Monitor Rubrics

Add environment-specific metrics:

Built-in Rubrics

MathRubric

Symbolic math verification using math-verify:
Usage:

JudgeRubric

LLM-as-judge evaluation:

Scoring Lifecycle

Individual Scoring

For rollouts scored independently:

Group Scoring

For rollouts scored together (default for evaluate() and training):
Advantage computation:

Disabling Scoring

For pure generation without scoring:

RolloutScore Type

Rubrics produce RolloutScore objects:

Complete Example

When combining multiple reward functions, ensure weights are tuned to avoid any single function dominating the reward signal. Common practice is to normalize weights or use coefficients < 1.0 for auxiliary rewards.