# While > Agents improve while they work. A scientific RL and SFT post-training library for the harness and the model, every gain proven on a held-out set; whileai is an open-source Python package for post-training tool-using agents (simulate, grade, measure, select, train; every default cites its paper). While is the mid-training and post-training platform for agents. It optimizes the harness (prompt, tools) and the model (weights), and says which one moved the score. Open models, the latest SFT and RL algorithms, and an open-source SDK that builds and optimizes datasets from production traces. Every gain measured on a held-out set. whileai is an open-source RL and SFT post-training library for agents (`pip install whileai`, Apache 2.0), built for AI researchers, ML engineers and applied-AI developers. It trains open models with SFT, DPO and GRPO on your own compute (Modal and Prime Intellect are first-class) with your own keys, and proves every gain on a held-out set with a 95% interval. Its proof point is replicated research: one recipe per recent post-training paper, flat results reported as flat. It learns from production traces, simulates the weak spots, and generates datasets built for high-signal training. Hosted training and serving are a separate, optional platform. Curb a behavior, build character, make tool use more efficient, harden the model against adversarial attacks. It runs next to an existing agent as a loop: watch where the agent fails in live traffic, simulate those situations as rollouts, train the next version of an open-weight model on the rollouts that passed, and measure the improvement on a held-out set with a 95% confidence interval, per task category. You rent a model that never learns your business, or you own one that does. You own the model, the data and the weights: the datasets are built from your production traces, the model is an open model post-trained with SFT and RL, and the trained weights are yours to download and serve anywhere. A training run writes a LoRA adapter directory that stays on your disk; wai.hub.push sends it to a Hugging Face model repo on your own account with your own token, and wai.platform.serve puts the same weights behind an OpenAI-compatible endpoint. Bring your own keys. Your model keys never leave your machine. A While key adds hosting: we store your datasets, run the hosted judge, train and serve. ## Start here - [While](https://while.ai): the home page. Agents improve while they work. A scientific RL and SFT post-training library: tune the harness, train the model, prove both. The five steps (simulate, grade, measure, select, train), one prompt that sets a repository up for a coding agent, the replicated-paper chart, and what the hosted platform adds. - [Own your AI model and its weights](https://while.ai/own): who owns the weights after fine-tuning, answered with where they land. A training run writes a LoRA adapter directory on your disk; wai.hub.push sends it to a Hugging Face model repo in your own namespace with your own token; wai.platform.serve puts the same weights behind an OpenAI-compatible endpoint and returns its base URL; wai.export writes the graded rows that trained it. Rent versus own, BYOK post-training, and an open model instead of a frontier API, each scored on the same held-out set with a 95% interval. FAQ with five questions. ## Papers, reproduced - [recipes/papers](https://github.com/whilehq/whileai-sdk/tree/main/recipes/papers): one recent post-training paper per recipe, two arms on the same held-out tasks, paired delta with a 95% interval, base re-run for the noise floor; flat results are reported as flat. On the home page as a chart. ## Evals - [Build better evals for your agent](https://while.ai/build-evals): one prompt for a coding agent (Claude Code, Cursor, Codex): install whileai and follow the strengthen-your-evals skill. Wrap the agent, write the judge as a program, simulate situations offline, count the prompts that can fail, report pass@1 with an interval and the holdout size a gain needs. No GPU, no key; training is the step after. - [wai init](https://docs.while.ai/get-started/install): one command sets a repository up for a coding agent: a block under twenty lines in AGENTS.md (Codex, Cursor, Copilot), an @AGENTS.md include in CLAUDE.md (Claude Code), the tested skills under .claude/skills/, and the evals skill's check.py run so the verdict line shows first. After it, "use whileai to build me better evals for my agent" needs no URL. - [Are my evals any good](https://while.ai/build-evals): the page's FAQ answers it against the literature. Every behavior needs a frozen named test, n >= 50 and the resolvable difference (Miller 2024, arXiv 2411.00640), judge agreement >= 0.8 on >= 50 human labels (Zheng 2023, arXiv 2306.05685), length bias |r| <= 0.3 (Dubois 2024, arXiv 2404.04475), a measured noise floor, contamination 0, reward not the judge (Gao 2022, arXiv 2210.10760), and a base under 95 so it can still fail (DAPO, arXiv 2503.14476). The Evals table on an agent's Runs page checks all eight; each cell says the rule, its source and the SDK call that fixes it. - [Agent evals on frontier models](https://while.ai/blog/agent-evals-on-frontier-models): keep the model you run; the SDK writes situations from the agent's tools, reports pass@1 with a 95% interval, counts failure-capable prompts (the ceiling on any gain), steers the writer when the eval saturates, and delta_report exits 1 in CI when a guarded behavior regresses. Refund agent on Claude Haiku 4.5: 2 of 40 failure-capable on the default mix, 16 of 40 after steering. ## Docs - [Overview](https://docs.while.ai): the loop (trace, simulate, train, evaluate), what goes in, what comes out. - [How it works](https://docs.while.ai/concepts/how-it-works): one rollout cut into prompt, reply, reward and held-out copy; the five steps from picking a prompt to cutting training data. - [The engine](https://docs.while.ai/concepts/engine): how the simulation engine makes evals and training data in eight steps (axes, pairwise covering array, novelty-weighted arm search, seeded sandbox world with failure modes, rollout with logprobs, judge scored against gold labels, cuts into SFT/DPO/GRPO/RM, paired delta with bootstrap interval); why it is not importance sampling; eleven references; one-page PDF at https://while.ai/while-simulation-engine.pdf. - [SDK](https://docs.while.ai/get-started/install): the open Python package (`pip install whileai`; full docs, guides and a generated API reference at https://docs.while.ai, with its own llms.txt at https://docs.while.ai/llms.txt): give it an agent's tools and system prompt, get rewarded rollouts back; offline first run with no key; `export_environment` turns a simulation into an installable `verifiers` RL environment (the asks, the world, the score) for on-policy trainers such as GRPO, RLOO and PPO; five recipe steps from simulate to export. - [The harness](https://docs.while.ai/reference/harness): the program around the model as one object (`wai.Harness`): a prompted loop or Claude Code, Codex and pi through their JSON streams, a fingerprint over the disclosure fields of Zhang et al. 2026 (model, instructions, tools, context files, turn cap, compaction, retries, subagents), rows stamped with the harness, and `wai.harness.attribute` saying whether the harness or the model moved the score with a bootstrap interval over tasks. - [FAQ](https://docs.while.ai/concepts/faq): no agent changes needed, cold start from one sentence, held-out scoring, open-weight models. ## Blog - [Blog](https://while.ai/blog): every post, newest first. Results, methods and the numbers behind them; each post links the recipe in the whileai SDK that produced it. - [Deep Agents SFT from traces](https://while.ai/blog/deepagents-sft-from-traces): a stock LangChain Deep Agents reviewer on Qwen3.8-27B fine-tuned twice on its own LangSmith traces with smithtune's renderer, split and schedule, only the pick differing: smithtune's judge council kept 258 correct traces, wai.optimize kept 173 correct traces within 8 model calls. SWE-bench Verified patch review, 250 reviews: 46.0% vs 56.8%, +10.8 points (4.8 to 16.8) and 5.3 fewer calls per review, above a 7.8-point noise floor from three base runs, on 65% fewer training tokens. On 84 held-out repositories accuracy ties, -2.4 (-7.3 to +2.4), with 3.1 fewer calls. One training seed per arm. Recipe recipes/community/deepagents-review-four-arms. - [Sharpening the spear](https://while.ai/blog/sharpening-the-spear): post-training raises first-try accuracy and can shrink what a model solves in many tries (the Sharpening Tax, Oh et al. 2026, arXiv:2610.01509). Posterior-tempered group sampling (PTGS) against GRPO and Reinforce-Ada on 320 MATH-500 problems at levels 3 to 5, Qwen2.5-1.5B, two seeds per arm: PTGS pass@1 +0.4 points (-1.7 to +2.5) over GRPO, not proven; Reinforce-Ada +3.1 (+0.7 to +5.4) with both seeds above both GRPO seeds, at 3.7 times the training time; no arm paid a tax at 8 tries. Recipe recipes/papers/ptgs. - [Swarm the prompts GRPO throws away](https://while.ai/blog/swarm-the-prompts-grpo-throws-away): GRPO learns from the spread inside a group, so a prompt where every rollout fails teaches it nothing and is dropped, and those are the hardest prompts. 223 code_contests tasks where hosted Qwen3-4B failed all 8 base rollouts, each given the same 24 extra samples four ways: plain resampling rescued 7.2% (4.1 to 10.3), solo refinement 6.7% (3.3 to 10.1), a ring swarm sharing two neighbours' best program 9.9% (6.1 to 13.7), a star swarm 9.9% (6.1 to 13.7). The noise band from three seeds of the same arm is 10.9 points, so the result is flat and reported as flat: spending the samples mattered, structuring them did not. Recipe recipes/01-simulate/swarm-rescue. - [The swarm learned the test](https://while.ai/blog/the-swarm-learned-the-test): why particle swarm optimization over LLM rollouts failed. Calibration curves show verifier partial credit predicts a hidden pass zero times below three quarters of the tests on code_contests and text-to-SQL, and a 27B judge ranks passes at chance. A pre-registered positive control on bundles of MBPP functions shows the swarm doubling shown-test passes while hidden passes stay flat. Caveat: one small model family. Recipe recipes/01-simulate/swarm-rescue. - [Reminding models to communicate through post-training](https://while.ai/blog/reminding-models-to-communicate): two copies of Qwen2.5-1.5B-Instruct each see half the facts of a GSM8K problem and chat A, B, A, B, and every message is paid the team's outcome with reinforcement learning. On 300 held-out problems the trained pair solves 40 in 100 (36 to 45) against 11 untrained, and the same training with messages blocked stays at 2 to 4: +36.5 points (32.1 to 40.9) over three seeds. Trained copies send 96% of the numbers only they have and their answers use 79% of their partner's. Reinforce-Ada was the most reliable of four training methods (every seed 36 to 40, GRPO 15 to 40). Recipes recipes/papers/talk-to-solve and recipes/papers/talk-methods. - [Harness vs model](https://while.ai/blog/harness-vs-model): an agent is a model plus a harness, and on a closed model the harness is the only lever; whileai runs, versions and compares harnesses (`wai.Harness`, Claude Code, Codex, pi presets) and `wai.harness.attribute` splits a harness x model grid into harness, model and interaction shares with a 95% band over tasks. Worked example: a 20-point harness effect is proven on 200 tasks and could be chance on 40. Cites Zhang et al. 2026 (arXiv:2605.23950), Meta-Harness (arXiv:2603.28052), Kim et al. 2026 (arXiv:2606.25447). - [Benchmaxxing ParseBench](https://while.ai/blog/benchmaxxing-parsebench): an open-weight document parsing agent on LlamaIndex ParseBench (arXiv:2604.08538). Qwen3.8-27B plus PP-DocLayoutV3 with table and full-page chart specialists, crop-based style transfer, detector boxes and cell-level voting scores 78.9 (77.8 to 79.9) on the full set, first among open-weight systems (best open entry 77.2, the same model alone 70.8, Opus 5.5 high 79.9). Tuned on one in five source reports, 78.5 (77.3 to 79.6) on the held-out four fifths. Two chart RL runs (CISPO on ChartNet crops and composed pages) did not beat the base on ParseBench charts. Recipe recipes/04-train/parsebench. - [MiMo or Claude for support agents?](https://while.ai/blog/mimo-v2-6-on-wai): Xiaomi's MiMo-V2.6 (released 2026-09-21, open weights, MIT) measured the same day with the whileai SDK. Frozen refund-agent test t-5f57ed8d, 64 asks x 4, four prompts, program judge: best prompt MiMo-V2.6-Flash 93.4 (88.9 to 97.9), MiMo-V2.6-Pro 91.8 (86.1 to 97.5), Claude Sonnet 5 89.5 (83.1 to 95.9), Claude Haiku 4.5 88.7 (81.5 to 95.9); bare prompt all four at 72; writing the policy down is worth 20 points on every model, the model choice none proven. Also the report's Groupwise Reward Synthesis (test reward times rubric quality) with GRPO on Qwen3-4B for text-to-SQL: no change vs the plain reward, -1.7 (-5.2 to +1.7) on 120 held-out tasks, because the grader scored nearly every pass 0.93. - [Distill without a reward](https://while.ai/blog/distill-without-a-reward): reinforcement learning needs a reward, distillation does not. One small model trained three ways for twenty steps on the reverse-text taskset, scored on 128 prompts it never trained on: GRPO with the task's reward +72.4 (67.8 to 76.7), on-policy distillation from a frozen stronger teacher and no reward +72.5 (67.3 to 77.2), self-distillation with the answer pasted in +18.2 (11.0 to 25.4); a change under 12 points is noise. The logged per-token teacher gap says why self-distillation stalls. wai.OPD, wai.OPSD and wai.prime_rl_config on prime-rl, on your own GPUs; recipe recipes/04-train/prime-rl. - [Build a reasoning model with wai](https://while.ai/blog/build-a-reasoning-model): Qwen3.5-4B-Base, GRPO with a verifiable reward on MATH levels 3 to 5, vLLM rollouts on one H100, 46 minutes; the whileai recipe recipes/papers/zero-rl-format-reward replicates SimpleRL-Zoo (arXiv 2503.18892): a strict boxed-format reward reaches pass@1 0.63 (0.57 to 0.68) and a correctness-only reward 0.72 (0.66 to 0.77) on 160 MATH-500 problems, +0.094 (+0.052 to +0.139) paired, above the 0.067 noise band from three base re-runs; base 0.51. One training seed per arm. - [Jev ties Claude at grading agents](https://while.ai/blog/which-judge-can-you-trust): a judge benchmark for agent training data. Jev (TypeSafe), the hosted Phi-4 judge, Claude Haiku 4.5, Claude Sonnet 5 and the policy model judging itself, on 300 real tool-agent rollouts against a rule-computed answer key: Sonnet 66% (61 to 72), Jev 62% (56 to 67) at four to nine times the speed, Haiku 61%, Phi-4 57%, self-judging 53%; none reaches the 80% trust floor; the one failure class every judge misses (an invented id the sandbox answers); the whileai recipe recipes/02-measure/compare-judges reruns it offline. - [Jev as the training-data judge](https://while.ai/blog/jev-typesafe-decision-model-as-agent-judge): what Jev is (TypeSafe's System One model, released 2026-09-15: noul, choice and score questions answered with calibrated probabilities, no output tokens, vendor-reported 70 to 500 ms and $0.042 per million input tokens), why a probability beats a parsed sentence as an LLM judge, and how the whileai SDK uses it: data.grade(spec="typesafe:jev-latest"), confidence per row, an unsure band at 0.4 to 0.6, the failure class as a second question, judge_trust against human labels. Measured 2026-09-19: 62% agreement with a rule-computed answer key on 300 rows, inside the interval of Claude Sonnet 5 and Haiku 4.5. - [Evals that get harder](https://while.ai/blog/getting-started-with-evals): tasks saturate as the model learns, so the eval has to be re-steered every round; a guide from the strengthen-your-evals skill. Wrap the agent, write the judge as a program, probe 40 simulated situations with k=4, read pass@1 per arm and stance cell, count failure-capable prompts (the ceiling on any gain), steer the writer with arm_weights, dimensions and seeds, size the held-out set with holdout_size, and the four ways an eval silently lies. Refund agent on Claude Haiku 4.5: 2 of 40 failure-capable prompts on the default mix, 16 of 40 after seeding, pass@1 0.95 (0.88 to 1.00) to 0.70 (0.56 to 0.82). - [Open-source alternative to Raindrop Simulations](https://while.ai/blog/raindrop-simulations-alternative): Raindrop announced Simulations on 2026-09-17 behind a waitlist (replay production traffic against a proposed agent change). The whileai SDK runs the same replay offline: main and candidate on the same asks, k=4, judge as a program, pass@1 with 95% CI, paired delta_report with must_not_regress markers as the CI exit code, then training on the failed runs. Comparison table. - [RL for text to SQL](https://while.ai/blog/rl-for-text-to-sql): a recipe, six steps: seed a database, author tasks with reference queries, a verifier that runs the SQL, benchmark with pass@1 and pass@4, GRPO with LoRA, score on 140 held-out tasks with paired intervals. Nemotron-Nano-8B 26% to 35% in one 44-minute round, replicated three times. Qwen3-4B +3 points in four rounds, not proven; round five (512 answers per update, difficulty band only, cut-off replies ignored) 53% to 74% on 459 held-out tasks, +21.8 (+19.2 to +24.5), pass^4 25% to 65%. - [Simulated data for support agents](https://while.ai/blog/simulated-data-pipeline-for-fine-tuning): a 15-dollar simulated training set took Llama-3.1-8B from 5.0% to 30.0% on tau2-bench telecom, ahead of 1,057 expert-written rows (17.5%); how situations are chosen, how rows are graded, the full recipe and the p-value, in plain language first. - [Agents improve while they work](https://while.ai/blog/agents-improve-while-they-work): why agents need a learning loop instead of a dashboard. ## Hosting and pricing - [Host your model](https://while.ai/pricing#hosting): put a model you trained behind an OpenAI-compatible endpoint at https://models.while.ai/v1, with a subdomain of your own. Hand While a LoRA adapter to import, import it into Bedrock yourself in your AWS account and register the ARN, or register any OpenAI-compatible server you run by URL. - [Pricing](https://while.ai/pricing): the library is free and open source and the platform account is free. You pay only when While hosts your model: an 8B model is $0.24 a minute while it answers, $10 a month to keep it and $10 to import it; a 4B model costs half. Your own server or your own AWS account is free. - [Price book](https://while.ai/pricing-book): the public list of prices behind every cost on the platform's experiment chart, input and output USD per million tokens for API models and USD per GPU hour for served models, each with its source and the date it was read, plus the two formulas. No login; anyone can check a number. ## Contact - [Contact](https://while.ai/contact): jacob@while.ai