Part IV / One Machine
Build the learning loop
Turn a reasoning evaluation harness into a training system one justified capability at a time. The order matters: trustworthy environments and gates come before a more powerful optimizer.
Seeded incident scenarios and versioned investigation traces.
Evaluate -> select -> imitate -> prefer -> reinforce.
Untouched holdout and independent release gates.
Add gears only when the previous gear slips
A bicycle uses one gear until terrain demands another. A learning program should do the same. If prompt and tool-interface changes solve the problem, use them. If the base policy occasionally produces excellent traces, selection and SFT may harvest that capability. Preference optimization helps when relative judgments are reliable. Online RL earns its complexity when fresh exploration and environment consequences matter.
Each stage is an experiment with a stronger intervention. Keep the previous stage as a baseline and promote only when the new stage wins under equal quality, inference, and labeling budgets.
The case and its evidence contract
A scenario generator creates redundant-path incidents with topology, time-series telemetry, logs, changes, distractors, a hidden causal record, and a rubric. The policy must investigate through legal tools and return a supported, calibrated diagnosis.
Start with a split policy. Development scenarios and seeds are visible to prompt, tool, and rubric iteration. Validation scenarios support frequent model comparison. A release holdout is tightly budgeted and never supplies training examples, prompt clues, or reward tuning. Generator templates themselves can leak structure, so hold out scenario families or parameter regions in addition to random seeds.
Every trajectory records policy and runtime version, prompt and environment snapshot, observations, tool calls and results, token log-probabilities when required, timing, cost, final answer, termination, grader versions, and component scores. A leak filter checks that hidden causal fields do not enter observations. An oracle validates facts directly from environment state. A process rubric grades observable investigation behavior.
Stage 0: evaluation before training
Run a fixed policy several times per scenario because sampling and tool paths vary. Report outcome, behavior gates, cost, latency, tool calls, and uncertainty. Compare simple arms: generic prompt, topology context, checklist, memory, and different tool policies. Use confidence intervals across independent scenarios rather than treating repeated samples from one scenario as independent evidence.
Failure analysis produces the training hypothesis. Examples: the model never checks the redundant path; it checks but ignores contrary telemetry; it knows the cause but fabricates a remediation; it succeeds only with a checklist; or it times out because context grows. These failures point to different interventions.
Stage 1: rejection sampling and SFT
Generate several trajectories from the existing policy, reject invalid or low-quality attempts, and keep diverse strong traces. Train with SFT to imitate their tokens and tool calls. Balance scenarios and strategies so the model does not memorize one canonical investigation. Preserve failed traces for evaluation and later preference data.
Use reproduction of training traces as a memorization check, and use sample-one pass rate on held-out tasks to judge generalization. Watch entropy, tool-call diversity, overlong answers, and regressions on ordinary instruction following. Rejection sampling can create a style monoculture if the grader prefers one format.
Stage 2: offline preference optimization
Construct chosen/rejected pairs within the same scenario and comparable evidence state. A strong pair differs in one meaningful behavior: checks the alternate path, cites aligned evidence, calibrates uncertainty, or avoids wasted calls. DPO increases chosen likelihood relative to rejected likelihood and a reference policy.[source]
Do not pair an easy successful scenario against a difficult failed one and call the difference preference. Prompt matching matters. Audit preference consistency and position bias. Keep the reference model and dataset snapshot immutable for a run.
Stage 3: GRPO for RLVR in replayable environments
When exploration matters, sample groups from the current policy against seeded scenarios. Deterministic cause checks provide verifiable outcome reward; observable process rubrics and costs can supplement it. Group-relative advantage compares attempts for the same incident. Hard gates exclude fabricated or leaked trajectories.
Start with a small update, short run, and frequent incumbent evaluation. Track reward components, KL, entropy, clip fraction, response length, tool counts, invalid actions, timeouts, policy staleness, and holdout quality. A rising aggregate reward with collapsing non-fabrication or growing cost is not progress.
Sample difficulty intentionally. If every scenario is trivial, group rewards saturate. If every scenario is impossible, the group provides noise. A curriculum can mix current competence, boundary cases, and a stable anchor distribution. Freeze a diagnostic suite so the curriculum itself does not erase comparability.
Stage 4: process rewards where observability is strong
Add process feedback for actions that can be checked: whether a claim cites an observed fact, whether both relevant paths were inspected, whether hypothesis probability changes after evidence, whether the engine respects an approval boundary, and whether it stops for a valid reason. Avoid rewarding hidden prose merely because it resembles an evaluator's preferred reasoning style.
Train a process reward model only with clear annotation guidance, disagreement analysis, and adversarial examples. Keep outcome and process scores separate in evaluation. Process reward can teach disciplined failure even when final success is impossible, but it can also produce performative checklists.
Stage 5: governed continual improvement
Production traces can reveal new distributions, tool errors, and user needs. They require consent, privacy controls, redaction, provenance, and sampling policy. Route candidate examples into offline review or replay rather than updating directly from uncontrolled live reward. Delayed operational outcomes can validate whether sandbox rewards predict reality.
A continual loop needs drift detection, dataset lineage, model cards, rollback, and limits on how often the holdout is consulted. Separate data collection from automatic promotion. Human review should focus on novel failures and disagreement, not rubber-stamping every trace.
Reward-hacking and holdout defenses
| Attack or failure | Detection | Defense |
|---|---|---|
| Hidden cause leaks in metadata | Canary fields and observation diff | Separate oracle channel; schema allowlist |
| Judge keyword stuffing | Adversarial verbose failures | Independent checks; style-invariant grading |
| Tool-call inflation | Cost and redundancy metrics | Information-value tests; soft cost |
| Holdout memorization | Family-level split and provenance audit | Budgeted access; regenerate private holdout |
| Scenario-generator fingerprint | Cross-generator evaluation | Multiple templates and real-trace replay |
Changing a rubric invalidates direct score comparisons unless old policies are rescored under the new version. Record both raw trace and evaluator output so retrospective regrading is possible. Never silently mix reward definitions within one learning curve.
Optimize for better governed behavior. A stable SFT or DPO system may be the right endpoint. Escalating machinery without a measured gap increases cost and attack surface.
References
- InstructGPT, DPO, DeepSeekMath/GRPO, and process supervision support the named stages.
- The offline RL tutorial supports fixed-data distribution-shift cautions.
- Reward overoptimization supports independent evaluation and proxy caution.