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:Adding Functions Dynamically
Execution Order and State Sharing
Reward functions execute sequentially in the order they’re added. Sincestate is mutable, earlier functions can store computed values for later functions:
compute_similarityruns, storesstate["similarity"]similarity_thresholdruns, reads cached value- Final reward =
0.0 * similarity + 1.0 * threshold
Group-Based Reward Functions
During evaluation and RL training, rollouts are organized into groups byexample_id. Group reward functions operate on all rollouts for an example together:
Detection
Group functions are detected by:- Plural argument names:
completions,prompts,answers,states,tasks,infos - Return type:
list[float]instead offloat
Available Group Arguments
Example: Relative Ranking
Shared Objects
Rubrics can provide shared objects accessible to all reward functions viaclass_objects:
Parsers
Parsers extract structured content from model responses:vf.Parser()- Pass-through (no parsing)vf.XMLParser(fields=[...])- Extract XML tagsvf.ThinkParser()- Extract content after</think>vf.MaybeThinkParser()- Handle optional<think>tags
Judges (LLM-as-Judge)
JudgeRubric integrates LLM-based evaluation:
judge- Callable that formats prompt and calls judge modeljudge_client- RawAsyncOpenAIclientjudge_model- Model name stringjudge_prompt- Template stringjudge_sampling_args- Sampling parameters dict
Custom Shared Objects
Add domain-specific helpers:Rubric Groups
Combine multiple rubrics for heterogeneous scoring:- All rubrics execute in parallel
- Final reward = sum of all rubric rewards
- Metrics from all rubrics are collected together
- 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 withweight=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 usingmath-verify:
JudgeRubric
LLM-as-judge evaluation:Scoring Lifecycle
Individual Scoring
For rollouts scored independently:Group Scoring
For rollouts scored together (default forevaluate() and training):
Disabling Scoring
For pure generation without scoring:RolloutScore Type
Rubrics produceRolloutScore 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.