
14 September 2026
Evaluating Generated Text
These are my notes on how to evaluate generated text: from n-gram overlap metrics like BLEU and ROUGE, through semantic metrics like BERTScore and BLEURT, to open-ended generation and real work tasks. The post merges three sets of notes: BLEU from when I studied Seq2Seq in July, a class summary of NLG evaluation, and notes on real-world task evaluation from reading the GDPval paper in September.
Before picking a metric, ask one question: how many correct outputs does this task allow? The more closed the output, the more it means to measure overlap with a reference. The more open it is, the more you need rubrics, grounding in sources, real task outcomes and human preference.
Open-endedness decides what to evaluate
Machine translation, summarization and task-driven dialogue usually have fairly clear targets. Chit-chat and story generation allow many equally reasonable answers. As tasks move from closed to open, the question evaluation asks changes with them:
- Does it match the reference?
- Does it keep the meaning and the key information?
- Does it satisfy the rubric and the factual constraints?
- Does it actually get the user's task done?
BLEU, ROUGE, BERTScore and BLEURT can still be used on open-ended tasks. Their limit is that they all depend on a reference: the more open the task and the less complete the reference, the less the score says about overall quality.
BLEU: counting n-gram overlap
BLEU (Bilingual Evaluation Understudy) is mainly used for machine translation, for example to score the output of a Seq2Seq model. It measures how much the n-grams of a candidate translation overlap with one or more reference translations. The general form is:
- : clipped n-gram precision
- : the weight for each n-gram order, often uniform
- : the brevity penalty, which stops a model from earning high precision with a very short output
Clipped precision
is the number of candidate n-grams that match the reference, divided by the total number of candidate n-grams. An n-gram can't count as a match more times than it appears in the reference, and that cap is the clipping. Say the reference is A B C D E F and the candidate is A B B C D:
The candidate has two Bs but the reference has only one, so unigram precision is , not . Of the four bigrams AB, BB, BC and CD, three match; among the trigrams only BCD matches; no 4-gram matches.
Each n-gram order looks at something different, so BLEU checks local word order as well as whether the words show up:
- unigrams: are the words roughly right?
- bigrams: do adjacent pairs match?
- trigrams / 4-grams: do longer phrases match?
The brevity penalty
Precision alone makes it too easy for short outputs to score well. With candidate length and effective reference length :
Keep the reference A B C D E F and take a candidate of just A B. Then , but the length penalty is:
So a model can't game the score by outputting a few words it's sure about. When the candidate is identical to the reference, BLEU is 1.
Another way to write it
When I studied Seq2Seq, the formula I saw looked different:
Here and are the token counts of the reference and the predicted sequence, and is the longest n-gram used for matching. With a single reference it's the same formula as the general one: the term expands to the piecewise BP, and the product equals with the weights fixed at .
Where BLEU falls short
BLEU measures surface n-gram overlap. It doesn't directly judge whether the meaning is right.
- A reasonable synonym or paraphrase can score low when the wording and word order change a lot.
- Output that overlaps heavily on the surface but gets the meaning wrong can still score decently.
- Sentence-level BLEU swings wildly when a higher-order n-gram precision hits zero. In the example above , so with the whole product is 0. That's why sentence-level BLEU usually needs smoothing, while corpus-level BLEU is more stable.
- Scores computed with different tokenizers, casing rules or reference setups can't be compared directly.
BLEU works for relative comparisons between systems on a fixed test set. It shouldn't be the final word on translation quality by itself.
ROUGE: coverage, from the other side
ROUGE also relies on references, but it looks from the opposite direction: how much of the reference does the candidate cover?
- ROUGE-1: unigram overlap
- ROUGE-2: bigram overlap
- ROUGE-L: longest common subsequence
It's common for summarization, where what matters is whether the key information got covered.
The difference fits in one line: BLEU asks "how much of what I generated is supported by the reference?", and ROUGE asks "how much of the reference did I cover?"
Model-based semantic metrics
Different words on the surface don't always mean a different meaning. These metrics map text into an embedding space and compare it there.
| Metric | Core mechanism | Strengths | Main blind spot |
|---|---|---|---|
| Sentence / vector similarity | cosine similarity of whole-sentence embeddings | fast, catches overall paraphrases | squeezing a whole sentence can hide local factual errors |
| Word / Sentence Mover's Distance | lowest cost of moving the candidate's embedding "mass" onto the reference | handles synonyms and word-order changes | slower to compute; close meaning isn't the same facts |
| BERTScore | soft matching of contextual token embeddings, giving precision / recall / F1 | finer-grained grasp of paraphrase than n-grams | swapped entities or negations can still look highly similar |
| BLEURT | a model trained to predict human quality ratings | combines meaning, fluency and some error types | a black box; depends on its training domain, language and human labels |
Vector similarity
Compress the reference and the candidate into vectors :
Swap only "cat" for "dog" and the sentence's topic stays close, so the cosine may stay high. Similar overall meaning doesn't mean the local facts are right.
Mover's distance
Word Mover's Distance represents each word as an embedding and finds the cheapest global transport plan:
is how much is moved from word to word , and is the distance between their embeddings. Sentence Mover's Distance moves sentences or text spans instead of single words, which suits long text better.
BERTScore
BERT gives every token a contextual embedding. Each candidate token looks for its most similar token in the reference; doing this in both directions gives precision and recall, which combine into F1.
It handles polysemy and paraphrase better than static word overlap, but similar embeddings guarantee neither entailment nor factual accuracy.
BLEURT
BLEURT feeds (reference, candidate) into a scoring model:
- Start from correct text and create perturbations such as deletions, substitutions and shuffling.
- Pretrain the model to recognize differences in meaning, fluency and content.
- Fine-tune it on human ratings so its scores move closer to human judgment.
So there's no fixed similarity formula. It's a learned evaluator, and domain shift and training bias still affect its results.
Open-ended generation
Open-ended tasks have no single reference, so evaluation shifts to quality along several dimensions and to real utility.
| Method | What it checks | Strengths | Weaknesses |
|---|---|---|---|
| Human evaluation | people score by rubric or give pairwise preferences | closest to the target users | slow, expensive, subjective |
| LLM-as-a-Judge | a strong model scores by rubric or compares A/B | cheap, scales | position bias, self-preference, a taste for verbosity, hallucination |
| Grounded evaluation | whether each claim is supported by, contradicts or leaves out the source | checks the evidence directly | depends on the source and on claim extraction |
| Task-based evaluation | whether the final task got done | closest to real utility | each task needs its own harness |
| MAUVE | how far a set of model text is from human text as a distribution | fits distribution-level comparison of open-ended generation | can't reliably judge a single answer |
Human evaluation
Pairwise comparison is usually more stable than absolute 1–10 scores:
Split the rubric into relevance, correctness, coherence, instruction following, helpfulness, style and safety, so one vague overall score doesn't swallow the reason something failed.
LLM-as-a-Judge
A judge needs a clear rubric, hidden model identities, randomly swapped A/B order, and calibration against human ratings. Hiding identities guards against self-preference, and swapping the order cancels out position bias. When a judge says "90%", that's usually its confidence or its score, not the probability that the answer is correct.
Grounded evaluation
For each claim, check:
- Does the source support it?
- Does it contradict the source?
- Is a key fact missing?
This suits RAG, summaries, research answers and anything with citations.
Task-based evaluation
Look at the outcome, not the wording:
- Code: do the tests pass?
- Agents: is the task done?
- SQL: is the query result correct?
- Customer support: is the problem solved?
- Teaching: can the user answer correctly or finish the exercise on their own afterward?
MAUVE
MAUVE doesn't line up one answer against one reference. It compares the distributions of a large set of human text and model text in a representation space, aiming to catch two problems at once:
- the model's distribution is too narrow: safe, repetitive, low on diversity
- the model's distribution drifts away from human text: unnatural or low-quality patterns
It suits population-level comparisons. It can't judge the quality of a single text, or tell who wrote it.
Real-world tasks: would a practitioner accept this?
Push task-based evaluation one step further and the thing being evaluated becomes a complete professional artifact. Real-world task evaluation tests whether a model can produce a usable professional work product under realistic inputs and constraints. The target moves from "does the answer resemble a reference?" to "would a practitioner accept this work product?"
Academic questions isolate one capability at a time, but products fail through missing context, broken files, poor formatting, incomplete instructions, or outputs that need expensive human repair. A useful evaluation has to keep enough of the real workflow to expose those failures.
Four layers
A defensible professional-task benchmark needs four linked layers:
- Task sampling: pick work that matters economically or operationally, rather than whatever is easiest to score.
- Authentic packages: include the request, the source files, the constraints and the expected deliverable format.
- Expert references and review: practitioners write and compare the artifacts, and inter-rater agreement gets recorded.
- Operational utility: count review time, retry policy, failure severity, speed and cost, on top of raw output quality.
GDPval is a concrete example: experienced practitioners wrote computer-based work tasks, then blindly compared human and model deliverables. Its strongest design choice is evaluating complete artifacts. Its main weakness is still sampling: however broad the list of occupations, the small public subset isn't guaranteed to be representative. Expert-written tasks aren't automatically representative either. Occupation coverage, task selection, hidden exclusions and how the public subset was built all need an audit trail.
A 50% win-plus-tie rate does not mean 50% of jobs can be safely automated. One catastrophic error, repeated retries or heavy review can dominate the real cost.
An evaluation score is not a training loss
While reading GDPval I wanted to pin down one thing: can this kind of preference score be used directly as a training loss?
Suppose one expert comparison is recorded as:
for human win, tie and model win. Averaging these labels or counting wins gives a benchmark statistic. It doesn't update any model parameters.
To train from pairwise preferences, I need a differentiable objective. A common choice for reward models is:
This is the Bradley–Terry cross-entropy in the table below. Benchmark labels can supply supervision for this loss, but the metric and the loss stay different objects:
| Object | Purpose | Used when |
|---|---|---|
| Human preference label | records a judgment | data collection |
| Win / win-plus-tie rate | compares systems | evaluation |
| Bradley–Terry cross-entropy | fits a preference model | training |
| DPO / RL objective | changes the policy | post-training |
The last row, using a reward model's score to change the policy, is what my PPO post covers.
Detecting AI-generated text
Text that sits too close to a model's high-probability patterns gives a weak statistical signal. It can't reliably convict anyone.
| Method | Signal | Limits |
|---|---|---|
| Perplexity / token likelihood | whether the text is too easy for a model to predict | formal human writing can also have low perplexity |
| Burstiness | whether sentence length, word probability and syntactic complexity vary too evenly | paraphrasing or a change of style gets around it easily |
| Supervised classifier | hidden features learned from text labeled human / AI | distribution shift when the model, domain or language changes |
| DetectGPT | whether the text sits at a local peak of the probability surface | depends on the detector model; unstable on short or paraphrased text |
| Watermark | whether green-list tokens are unusually common | the generating model has to add the watermark; paraphrasing weakens it |
| Provenance | edit history, platform logs, signatures, content credentials | needs a controlled source, but is usually the most direct evidence |
The intuition behind DetectGPT
Picture the model's probability as hilly terrain. AI-generated text tends to land on a local high point. Make several small perturbations to the text that keep its meaning; if the probability drops for most of them, the original looks more like it was standing on a "probability peak".
A simplified score:
A large score only means the text looks more like a local peak of the detector model's probability. It doesn't prove the text came from an AI.
Evaluating an evaluation
Evaluating a metric comes down to whether it reliably tracks the quality people actually care about. This is called meta-evaluation, and there are seven things to check:
- Correlation: does the score move with human ratings? Look at Pearson, Spearman and Kendall.
- Pairwise accuracy: in an A/B comparison, does it pick the answer humans think is better?
- Sensitivity: after adding a negation, a swapped entity, an omission or repetition, does it take points off when it should?
- Invariance: after a paraphrase or a format change, does it hold steady when it shouldn't take points off?
- Robustness: can keyword stuffing, verbosity, copying the reference or prompt injection fool it?
- Generalization: does it still work across models, tasks, domains, languages and lengths?
- Human agreement: do the annotators agree with each other consistently? If humans can't agree, no metric can have a perfect gold label.
It also matters which level you're asking about: system-level is whether it compares whole systems correctly, and instance-level is whether it judges a single answer reliably. High system-level correlation doesn't make instance-level judgments reliable.
References
- Papineni et al., BLEU: a Method for Automatic Evaluation of Machine Translation
- Lin, ROUGE: A Package for Automatic Evaluation of Summaries
- Zhang et al., BERTScore: Evaluating Text Generation with BERT
- Sellam et al., BLEURT: Learning Robust Metrics for Text Generation
- Pillutla et al., MAUVE: Measuring the Gap Between Neural Text and Human Text
- Mitchell et al., DetectGPT: Zero-Shot Machine-Generated Text Detection using Probability Curvature
- OpenAI, GDPval: Evaluating AI Model Performance on Real-World Economically Valuable Tasks