DEV Community

Igor Ganapolsky
Igor Ganapolsky

Posted on

Your AI Agent's Mistakes Are a Free Preference Dataset. Stop Deleting Them.

You correct your AI coding agent dozens of times a day. "No, not that file." "Don't force-push to main." "That function doesn't exist — you hallucinated it." Each of those corrections is a perfectly labeled training example. And almost everyone deletes them the moment the session ends.

That is the waste hiding in plain sight on teams running coding agents: the single richest signal about what your codebase and your standards actually want — human corrections, in context — gets treated as ephemeral chat and thrown away. You regenerate the same 4,000-token plan next session, the agent re-attempts the same blocked command, and the meter resets every Monday.

A thumbs-down is a labeled data point, not a vibe

Structurally, a thumbs-down on an agent action is a preference pair: the action you rejected versus the action you wanted, for the same task context. That is precisely the shape that DPO (Direct Preference Optimization) fine-tuning consumes — a chosen example, a rejected example, and the prompt they share.

In other words: you are generating DPO data all day long and leaving it on the floor. The corrections are the dataset. You're just not keeping them.

One correction, two layers of defense

If you capture that signal instead of discarding it, a single thumbs-down buys you two different kinds of protection:

1. A deterministic check — stops the mistake from landing, today.
The correction becomes an enforced rule at the tool-call boundary. The next time any agent tries the same thing, a PreToolUse check blocks it before it executes — no model round-trip, no tokens, no retry loop. This is the immediate win: the mistake stops happening this session, not after the next PR review.

👎  "don't force-push to main"
     → check:  git push --force on protected branch  → BLOCK
     → cost of the repeat next time:  0 tokens
Enter fullscreen mode Exit fullscreen mode

2. A DPO pair — stops the mistake from being attempted, eventually.
The same thumbs-down, accumulated with the rest, exports as a preference dataset you can fine-tune on (LoRA adapter, KTO, RLAIF — whatever your pipeline). Now the model learns, at the weight level, to stop proposing the action in the first place.

{ "prompt": "<task context>",
  "chosen": "<the action you wanted>",
  "rejected": "<the action you thumbed down>" }
Enter fullscreen mode Exit fullscreen mode

Checks block at inference time. Fine-tuning prevents at the weight level. They are not competing strategies — they're belt and suspenders, and they come from the same correction. The check protects you now, while the fine-tune slowly makes the check unnecessary.

The honest caveats

Two, stated plainly. First, fine-tuning on your own preference data only helps if the data is clean — a thumbs-down captured without the surrounding task context is noise, not signal, so the capture has to record why, not just that. Second, a fine-tuned model that avoids a mistake is still a model; it shifts probabilities, it does not guarantee. That is exactly why the deterministic check stays underneath as the hard floor — the fine-tune is the assist, the gate is the guarantee.

The shift

It's a small reframe with a large payoff: stop treating your corrections as disposable chat, and start treating them as the labeled dataset they already are. Every time you tell the agent it got something wrong, you are doing unpaid data-labeling work. The only question is whether you keep the label.


ThumbGate is an open-source, local-first control layer for AI coding agents: a thumbs-down becomes an enforced PreToolUse check, and your accumulated feedback exports as DPO pairs ready to fine-tune. MIT-licensed. thumbgate.ai · github.com/IgorGanapolsky/ThumbGate

Top comments (0)