DEV Community

YuhaoLin2005
YuhaoLin2005

Posted on

My Loss Went Down, But My Model Still Broke — So I Built a Drift Metric

I spent the last year building quality gates for AI agent outputs — deterministic verification, diff reviews, delivery checks. I even shipped one for the ECC project (200K+ stars). It worked.

Then I started fine-tuning models.

Training loss dropped from 9.2 to 8.8. Solid convergence. Everything looked great.

So I ran a test prompt:

19999999999999999999999999999999...
Enter fullscreen mode Exit fullscreen mode

Every prompt. Every time. Perplexity never flagged it.

That's when I realized: this quality-gate philosophy applies at the weight layer too. You just need a different metric.

The gap loss curves don't cover

Signal What it tells you What it missed
Training loss "Model is learning" Output is digit garbage
Perplexity Token-level quality Mode collapse
BLEU/ROUGE n-gram overlap Behavioral degradation

Behavioral Drift: three signals, one score

import evaluate
drift = evaluate.load("behavioral_drift")
r = drift.compute(predictions=ft_outputs, references=base_outputs)
print(r["drift_score"])  # 0.95 = healthy, 0.05 = collapse
Enter fullscreen mode Exit fullscreen mode

Three signals multiplied into one score:

  1. self-BLEU — output similarity (high = mode collapse)
  2. digit density delta — numeric characters vs baseline
  3. repetition ratio — unique token ratio (low = looping)

The bigger picture

Same quality-gate philosophy across layers — from agent reasoning to model training: don't trust the proxy metric; check the actual output.


Has this happened to you — loss down, model broken?

Top comments (0)