Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:AMAP ML SkillClaw PRMScorer

From Leeroopedia
Knowledge Sources
Domains Quality_Evaluation, LLM_Judging
Last Updated 2026-10-22 00:00 GMT

Overview

Concrete tool for scoring assistant responses using a Process Reward Model (PRM) via majority voting over multiple LLM judgments, provided by the SkillClaw client package.

Description

The PRMScorer class evaluates the quality of an LLM assistant's response against the user instruction. It sends `prm_m` parallel judge queries to an OpenAI-compatible API, each returning a score of -1, 0, or 1. The final score is determined by majority vote. A representative evaluation text is returned alongside the score. The scorer supports a custom LLM client (e.g., AWS Bedrock) or the standard OpenAI client.

Usage

Import and use when you need to:

  • Score individual assistant turns for quality during proxy sessions
  • Evaluate candidate skills during distributed validation replay
  • Collect PRM scores for session recording and evolution evidence

Code Reference

Source Location

  • Repository: SkillClaw
  • File: `skillclaw/prm_scorer.py:L144-222`

Signature

class PRMScorer:
    """Score assistant responses via majority-voted LLM judgments."""

    def __init__(
        self,
        prm_url: str,
        prm_model: str = "gpt-5.2",
        api_key: str = "",
        prm_m: int = 3,
        temperature: float = 0.6,
        max_new_tokens: int = 1024,
        llm_client=None,
    ) -> None:

    async def evaluate(
        self,
        response: str,
        instruction: str,
        session_id: str = "",
        turn_num: int = 0,
    ) -> dict:
        """Score one assistant response against the instruction.

        Returns:
            {"score": float, "votes": list, "eval_text": str}
            score is in {-1.0, 0.0, 1.0} from majority vote.
        """

Import

from skillclaw.prm_scorer import PRMScorer

I/O Contract

Inputs

Name Type Required Description
prm_url str Yes Base URL of OpenAI-compatible API
prm_model str No Model name for judge (default "gpt-5.2")
api_key str No API key for the judge endpoint
prm_m int No Number of parallel votes (default 3)
temperature float No Sampling temperature (default 0.6)
max_new_tokens int No Max tokens per vote (default 1024)
llm_client Any No Custom LLM client (e.g., BedrockChatClient)
response str Yes (evaluate) Assistant response text
instruction str Yes (evaluate) User instruction text

Outputs

Name Type Description
evaluate() returns dict {"score": float in {-1,0,1}, "votes": list, "eval_text": str}

Usage Examples

Basic PRM Scoring

import asyncio
from skillclaw.prm_scorer import PRMScorer

scorer = PRMScorer(
    prm_url="https://api.openai.com/v1",
    prm_model="gpt-4o",
    api_key="sk-...",
    prm_m=3,  # 3 parallel votes for majority
    temperature=0.6,
)

result = asyncio.run(scorer.evaluate(
    response="To deploy a Python app, use gunicorn...",
    instruction="How do I deploy a Python web app?",
))
print(f"Score: {result['score']}")  # -1.0, 0.0, or 1.0
print(f"Votes: {result['votes']}")  # e.g., [1, 1, 0]

With AWS Bedrock

from skillclaw.prm_scorer import PRMScorer
from skillclaw.bedrock_client import BedrockChatClient

bedrock_client = BedrockChatClient(
    model_id="anthropic.claude-3-sonnet",
    region="us-east-1",
)
scorer = PRMScorer(
    prm_url="https://api.openai.com/v1",
    prm_model="anthropic.claude-3-sonnet",
    api_key="",
    prm_m=5,
    llm_client=bedrock_client,
)

Related Pages

Implements Principle

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment