Skip to main content
34 runnable recipes, one directory each. Every recipe says what you learn, what it needs and how long it takes, and its first command runs the whole thing. Anything marked offline needs no key and no network. Read them in order the first time. After that, jump to the step you are on.
The scripts live in the repository, not in the installed package. Clone it first: git clone https://github.com/whilehq/whileai-sdk.git, then cd to the recipe directory named at the top of its page.

Simulate

Make rollouts: an agent, situations, a reward that is a program.

bring-your-own-agent

the agent(message) -> {steps, final_text} contract, what a run says when the agent raises, why an evaluate() score must not become the reward

verifiers

rewards that are programs: MathEqual, All (answer and format), CodeExec against hidden tests, JSONSchema, each honoring the judge contract

Measure

Say what the numbers mean: pass@k, headroom, reward hacking, safety.

compare-judges

six judges on the same 300 labeled rollouts, one ranked table: agreement with its interval, kappa, leak rate, unsure and unjudged counts, seconds per row; Jev, the hosted judge, Claude, and the policy judging itself

eval-your-agent

evals for the agent you already have: wrap it, write the policy as a judge, pass@1 with an interval per policy branch, the coverage warnings that catch a hollow run, a CI gate

is-your-eval-any-good

whether a number your eval produced means anything: ceiling, headroom, criteria that cannot fail, self-noise, the judge, contamination, and the three checks that void a base-vs-tuned comparison outright

pass-at-k

pass@1 with its interval, pass^k, pass@k, the per-ask histogram the mean hides, and headroom = what a grouped update can learn

reward-hacking

reward hacking caught before, during and after training: the within-ask scan, the judge probes, the trajectory flags, the proxy-vs-target verdict

safety-evals

a safety suite for a tool-using agent: prompt injection, exfiltration, secret leakage, unauthorized writes, benign controls; four trajectory markers as the judge, pass^k per attack class, a before/after that fails the fix which got safe by refusing

safety-evals-marketplace

the same eval where the untrusted text is user-generated content and the private data is per tenant; live.py runs it on a local model through Ollama

Select

Turn graded rows into training data: SFT rows, pairs, RL groups.

character

a constitution to traits, graded replies per trait, a judge checked against the spec’s own labels, length-matched pairs and masked SFT rows, before/after on an adversarial holdout

prime-intellect-rl

simulate(mode="rl") for uniform groups, the gradient gate (diagnose.py) that catches a reward the policy can game before you train, prompts in the verifiers shape

schema

one row file projected into eval, SFT, preference, GRPO prompts, OPSD and OPD targets; the Task/Rollout/Judgment/Marker split that makes that possible

Train

Train it, hosted or on your own GPU, and watch the run page.

dpo

on-policy pairs from build_preference_pairs, TRL DPOTrainer, the reward margin on the run page, iterated rounds with --from-run, constructed negatives

grpo

TRL GRPOTrainer with LoRA on a verifiable rule, HackMonitor and reward/KL on the run page, paired pass@1 before/after with per-category deltas, loss variants and --balance as flags

hosted-loop

push graded rows, wai.train SFT on Qwen3-4B, wai.serve the adapter, one chat completion from the endpoint

identity

a leak-free SFT set that teaches a name and maker, with Modal scripts for the LoRA and for the identity/leak eval

prime-rl

GRPO, OPSD and OPD on one taskset on prime-rl from wai.prime_rl_config, a launcher over Prime Intellect’s published image, per-prompt held-out deltas with intervals from wai.compare; run e2e1: OPD matched GRPO with no reward, OPSD moved a fifth as far

report-run

the typed objects the platform tracks (a tracked agent with its harness, behaviors, runs, live traffic), why a harness is versioned by its fingerprint, and why a version is scored on every behavior

resist-planted-instruction

a behaviour rubric decided by code, the criterion promoted into the reward on probe evidence, rejection sampling from the base itself, a pre-registered random-selection control, three arms from one vLLM process with attack and clean halves apart

text-to-sql

hill-climb a model on a schema with a verifier as the reward: a seeded Postgres, 741 execution-checked tasks, SQLExec, benchmarks through simulate(tasks=), self-distillation, GRPO rounds on Modal with vLLM generation and Postgres in the container, every round measured on the same holdout

Export

Ship the data and the adapter.

hugging-face

rows to a Hub dataset repo (one split per purpose, commit tagged by dataset id), any Hub split onto the account with a profile, a run’s adapter to a model repo

Papers

One directory per paper.

adaptive-clip

Paper: Group Adaptive Clipping Policy Optimization, Sheng Jia et al., arXiv:2609.00444, August 2026.

endpoint-sft

Paper: Revisiting Complete Reasoning Traces for Post-Training, Jaehui Hwang et al., arXiv:2609.07103, September 2026.

filter-metric

Paper: The Filter Metric is Safety-Critical: Phantom Advantages in Group-Relative RL under Shaped Rewards, Juntao Yu, arXiv:2609.13866, September 2026.

gmts-token-select

Paper: GMTS: Gradient Magnitude-based Token Selection Improves RLVR Training, Outongyi Lv et al., arXiv:2608.30632, August 2026.

zero-rl-format-reward

Paper: SimpleRL-Zoo: Investigating and Taming Zero Reinforcement Learning for Open Base Models in the Wild, Weihao Zeng et al., arXiv:2503.18892, March 2025.

Community

Recipes contributed by people trying the SDK on their own problems, published so the next person starts from someone’s real run instead of from zero.

can-the-judge-be-trusted

Grade the same rollouts two ways — with rubric_judge() and with a deterministic verifier — and measure where the LLM judge disagrees with the rule.

force-the-branch

Seat: a post-training engineer at a startup that ships one production agent, trying to find out whether a small open model can take over the boring half of it.

hosted-grpo-vs-sft

Seat: an open-model fine-tuner who lives in TRL and Hugging Face, here for clean exports, a LoRA run, a hosted result and a cost line.

how-much-contamination-survives

Measure what fraction of real held-out contamination wai.decontaminate() actually removes, using human-labelled paraphrase pairs as ground truth instead of a planted copy.

same-entrypoint-before-after

Seat: a post-training engineer at a startup that ships one production agent, trying to find out whether a small open model can take over the boring half of it.

the-step-the-course-skips

The eight-lesson course for people who have never trained a model stops one line short of the training: # 2.

what-trl-does-with-the-loss-mask

wai.export(…, format=“trl”) writes a loss_mask on every row and reports mask_mode: “assistant”.

who-protects-the-holdout

decontaminate() applies four rules in order.

Write one

Copy recipes/_template into the step it belongs to, replace the parts in angle brackets, and open a pull request. The contract is in CONTRIBUTING.md.
Last modified on September 20, 2026