Grader description
ARangeJudgeGrader evaluates completions on a numeric scale instead of binary pass/fail. This is useful when quality exists on a spectrum and you want fine-grained feedback about model behavior.
Unlike a BinaryJudgeGrader (which scores 0.0 or 1.0), a RangeJudgeGrader returns scores across a range (e.g., 1-5). The grader:
- Accepts criteria describing what each score level means
- Uses evaluation steps to guide the judge’s reasoning
- Takes few-shot examples showing different score levels
- Returns a normalized score (0-1 by default) based on logprob-weighted scoring
- Optionally uses subrange expectations to help the judge understand the rubric
Pseudocode
This is the pseudocode for a range-based judge grader:- Define explicit criteria describing what each score level means
- Provide numbered evaluation steps the judge should follow
- Describe what each score range means using
SubrangeExpectations(textual descriptions, not numeric mappings) - Include 2-3 few-shot examples showing what different score levels look like
- Pass all components to
RangeJudgeGraderwith an InferenceModel - The LLM judge scores the completion on the numeric range (e.g., 1-5)
- Return a normalized grade (0-1 by default)
Implementation
Defining the criteria and evaluation steps
Start by writing clear criteria that describe what each score level means. The rubric should make the boundaries explicit—what distinguishes a 1 from a 2, or a 3 from a 4. Then list numbered evaluation steps that guide the judge’s reasoning. These steps should be concrete and actionable.SubrangeExpectations: textual descriptions of score ranges
SubrangeExpectations is a NamedTuple with subrange (a tuple of min and max score) and expectation (a text description of what that score range means). These help the judge understand the rubric by describing the expected quality level for each score range.
This is different from reward mapping—these are purely textual descriptions to guide the LLM judge.
Few-shot examples for the judge
Few-shot examples teach the judge what each score looks like by showing real examples. Each shot is aRangeJudgeShot with:
thread: A StringThread with the prompt and completionreasoning: The judge’s reasoning for that scorescore: The gold-standard score for that example
Validation
We can validate all the setup objects and demonstrate score normalization without a live judge model.Creating the RangeJudgeGrader
TheRangeJudgeGrader constructor requires:
grader_key: Unique identifier for this gradermodel: An InferenceModel (required)criteria: Description of the scoring rubricscore_range: Tuple of (min, max) for the numeric scale (default: (1, 5))evaluation_steps: List of strings describing evaluation steps (optional; auto-generated if None)subrange_expectations: List of SubrangeExpectations describing what each score range means (optional)shots: List of RangeJudgeShot few-shot examples (optional)normalize_score: If True (default), scores are normalized to 0-1 range
How scoring works
TheRangeJudgeGrader uses logprob-weighted scoring internally:
- The LLM judge produces a score (1-5) with reasoning
- The grader computes logprobs for each possible score (1, 2, 3, 4, 5)
- These logprobs are converted to probabilities
- A weighted average is computed:
sum(score_i * prob_i for each score) - If
normalize_score=True, the weighted score is mapped to [0, 1]:- Raw score 1 → 0.0
- Raw score 5 → 1.0
- Linear interpolation in between
RangeJudgeGrader vs BinaryJudgeGrader
Use BinaryJudgeGrader when you have a clear PASS/FAIL threshold (e.g., “Does the output contain valid JSON?”).
Use RangeJudgeGrader when quality exists on a spectrum (e.g., “How well does this summary capture the key points?”).
Key takeaways
- RangeJudgeGrader for spectrum-based quality - When binary PASS/FAIL is too coarse, numeric ranges capture degrees of quality
- Write explicit criteria - Define what each score level means so the judge has clear guidance
- Include numbered evaluation steps - Structured steps guide the judge’s reasoning process
- Few-shot examples are essential - Show examples at low, medium, and high scores so the judge understands the full scale
- Normalization is on by default - Scores are mapped to [0, 1] by default for consistency with other graders

