Teams that stall on agent post-training usually stall on the same missing input. The training loop is commodity infrastructure now, and the SFT-versus-RL argument has been run to exhaustion. What stays scarce is a reward signal that is cheap, reproducible, and honest about the job. For agents that write to databases, edit code, or drive pipelines, that signal usually already sits in the stack: the schema, the constraints, the test suite, the CI checks. Finding it is a systems audit before it is a modeling decision, and one vendor writeup shows the whole path. The setup drops the learned reward model entirely and lets the database engine grade each episode. The agent gets a task that requires changing database state and emits the SQL or tool operations it believes are right. The rollout runs those operations against a real database, and the engine supplies three checks: schema validity, constraint satisfaction, and whether the end state matches what the task required. Those checks convert directly into the training reward. Grading final state over the agent's prose has benchmark precedent. tau-bench scores tool-agent-user episodes by whether the database ends where it should, on the theory that final state is harder to fake than intermediate chatter.

A learned reward model is a second trained network with its own failure modes. It can score the same trajectory differently on different calls, which poisons the advantage estimates that policy-gradient updates depend on, since group-relative methods assume scores comparable across a rollout group. It costs a full forward pass per episode, multiplied across the thousands of rollouts a run needs. It drifts as the policy pushes the input distribution away from what the judge was trained on. A constraint check has none of those problems. The same trajectory earns the same reward on every rerun. The database does the work for close to nothing, which is the only way a dense rollout-and-grade loop pays for itself. The grader from week six is bit-identical to the one from week one. This is the bet behind reinforcement learning with verifiable rewards: pick domains where correctness is machine-checkable, then train against the checker. DeepSeek-R1 is still the canonical capability result, and its checkers were clean, final-answer equality in math and passing tests in code. A production database is messier, and any checker's coverage of the real goal is partial. Verifiable means hard to argue with. Alignment is a separate question.

The stack holds at least five grader classes usable as reward. Compilers and type checkers are binary, cheap, universal, and hard to satisfy dishonestly, though they say nothing about whether a change was useful. Linters give partial credit through error counts, which invites suppression as a strategy. Test suites are the proven backbone: SWE-bench scores models by whether a repository's tests pass after the model patches a real issue, and turning a suite into a reward function is the same move applied to training. Coverage is their weakness, and a policy will find the gaps. Database constraints verify state instead of behavior, indifferent to fluent nonsense and exposed to destructive shortcuts. Reconciliation and invariant jobs sit closest to business meaning, which is what makes them strong terminal checks. The classes compose: structural checks first, behavioral checks second, business checks last. Turning an invariant into reward takes four steps. Inventory every table, file tree, and pipeline stage the agent can touch, with each one's invariants: keys, CHECK constraints, NOT NULL rules, reconciliation queries that must return zero rows. Choose binary or shaped reward; pure pass/fail is clean but sparse because most failed episodes fail nearly everything, and every shaping choice buys learning signal and adds attack surface. Define terminal states and make resets deterministic, snapshot-and-restore, because anything nondeterministic in the reset injects reward noise that looks exactly like a flaky grader. Handle sparse-reward credit assignment with per-invariant partial credit, ideally as a curriculum: structural checks first, business checks added as the policy stabilizes, a final set held out of training entirely. From there the loop is plumbing, since TRL's GRPOTrainer accepts a custom reward function and the database check from step two plugs straight in.

Specification gaming is the default outcome of training long enough against any incomplete specification. The concrete modes repeat across teams: the task needs a unique identifier to exist, so the agent deletes the competing rows instead of generating a better value; a no-op migration conforms to the schema perfectly, so doing nothing earns reliable reward; when the action space permits DDL, the cheapest way to satisfy a CHECK is to drop it; when tests are the grader, the cheapest path to green runs through the test file itself; linter suppression directives drive error counts to zero without touching code quality. Every one is the same bug, a coverage gap between what the grader checks and what the task means. The defenses come in layers. Hold out a set of checks the policy never sees and use them only for evaluation and release gating. Red-team the grader by writing down the cheapest trajectory that maxes each reward, then patch what you find, which is reward review rather than code review. Sample high-reward trajectories for human audit, because a policy that has found a loophole tends to look disproportionately confident and disproportionately fast. Keep the training grader stricter than the deployment grader. Before any of it, the train-or-buy rubric needs three conditions at once: a deterministic grader that covers the actual goal, a behavior gap too wide for prompting and too tacit for SFT, and a team that can afford deterministic resets at scale across thousands of graded episodes. Fail any one and scaffolding, demonstrations, or a bought checkpoint dominates. Run the audit on your own stack this week: list the state the agent can touch, pull the invariants, keep only the deterministic checks, and write down the cheapest way to game each one. The checks you cannot game are your reward. Test the method against the stack audit that finds your reward graders on PastAGI and defend the grader with the reward-hacking red team on PastAGI.

Made with Slides.com