Looper Documentation
Looper Cookbook

Evaluation

An evaluation measures how well a model does on a set of tasks, without training it. The model makes one attempt at each task, a verifier scores each attempt, and the evaluation reports the average score. For example, on 100 math questions scored 1 for right and 0 for wrong, a score of 0.62 means the model got 62 of them right.

You can evaluate in two places:

This page covers:

Words used on this page:

Word Meaning
Task One question for the model, with the verifier that scores its answers. See Verifiers.
Held-out task A task the model never trains on, kept apart to measure it.
Attempt One try at a task, which gives one answer from the model and its reward. Also called an episode.
Baseline The score before training starts, to compare the trained model against.
Standard error How much an average score would move if you measured on a different set of tasks of the same kind.

Held-out tasks

A held-out task is a task like any other, as on Episode sessions, but your run never trains on it. It's kept apart so you measure how well the model answers questions it hasn't seen, not how well it remembers the ones it trained on.

These two arithmetic questions are the held-out tasks used throughout this page. Each has a FinalNumber verifier with its right answer:

from transformers import AutoTokenizer

from looper_cookbook.episode_sessions.agent_session import AgentSession
from looper_cookbook.message_formatters.models import message_formatter
from looper_cookbook.verifiers.final_number import FinalNumber
from looper_sdk import SamplingParams

tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen3.5-9B")
formatter = message_formatter("Qwen/Qwen3.5-9B", tokenizer, enable_thinking=False)


def task(question, answer):
    return AgentSession.Config(
        messages=[{"role": "user", "content": f"{question} End on '#### ' and the number."}],
        verifier=FinalNumber.Config(answer=answer),
        max_episode_tokens=1024,
    )


held_out = [task("What is 15 times 4?", "60"), task("What is 13 times 3?", "39")]

Any task can be held out, including one where the model uses tools in an environment, not just a one-turn question.

In a training loop

Give the RL loop your held-out tasks as eval_tasks, and it evaluates the model as it trains, on the run's own sampler. Here dataset holds the tasks the run trains on, as on that page:

from looper_cookbook import train_rl

config = train_rl.Config(params=SamplingParams(max_tokens=512), group_size=8, eval_every=10)
reports = await train_rl.train(
    training_client, sampling_client, dataset, config,
    formatter=formatter, steps=50, eval_tasks=held_out,
)
print(reports[0].metrics["eval/reward"], reports[-1].metrics["eval/reward"])

The last line prints the score before training and the score after the last step.

When and how the loop evaluates:

So one run's reports show the model before and after training, measured the same way. train_rl_async takes eval_tasks too.

Each report has these evaluation metrics:

Metric What it is
eval/reward The average reward of the attempts. With a verifier that gives 1 or 0, this is the share of tasks answered right.
eval/episodes How many tasks were attempted.
eval/<metric> The average of each attempt's metric, such as eval/truncated, the share of attempts cut off, or eval/answered.
eval/stop/<reason> The share of attempts that ended for each stop reason, such as eval/stop/max_turn_tokens.
eval/<metric>_stderr The standard error of each of these, including eval/reward_stderr.

On any sampler

Outside a training loop, evaluate does the same measurement in one call. It takes the tasks, a runtime and a sampling client. The runtime holds what each attempt needs, which is the formatter and the sampling parameters. Here they're set to temperature 0, as the loop does:

from looper_cookbook.episode_sessions.base import EpisodeSession, evaluate

greedy = SamplingParams(max_tokens=512, temperature=0.0)
runtime = EpisodeSession.Runtime(formatter=formatter, params=greedy)
metrics = await evaluate(held_out, runtime, sampling_client)
print(metrics["eval/reward"], metrics["eval/reward_stderr"], metrics["eval/episodes"])

To measure a checkpoint you saved, start a sampler for it, and evaluate on that sampler:

from looper_sdk import SamplerConfig

checkpoint_sampler = await service.create_sampling_client(
    SamplerConfig(
        checkpoint_name="rl-basic-1a2b3c4d", max_seq_len=1024, max_concurrent_sequences=16
    ),
    timeout_s=20 * 60,
)
print(await evaluate(held_out, runtime, checkpoint_sampler))
await checkpoint_sampler.stop()

To measure the base model instead, use base:Qwen/Qwen3.5-9B in place of the checkpoint's name. Either way, this is a second sampler, with GPUs of its own, so stop it when you're done, as the last line does.

The attempts themselves

The averages don't show what the model wrote. To read the answers themselves, run the attempts with rollout, which returns each task's episode:

from looper_cookbook.episode_sessions.base import rollout

episodes = await rollout(held_out, runtime, sampling_client)
for episode in episodes:
    print(episode.reward, episode.stop_reason.value, episode.messages[-1]["content"][-40:])

Each line shows an attempt's reward, why it ended, and the end of the model's last message.

For any other measurement, call the sampling client yourself, and do your own arithmetic. You can record it from a loop's on_step, or between two calls of train.

Reading the numbers

No recipe checks its own result yet. Compare the baseline with the last report it prints.

Next steps