Concepts / Assessing LLM-Generated Text Quality

Assessing LLM-Generated Text Quality

Computing training and validation set losses is a way to assess the quality of LLM-generated text during training.

  • Programming

Why One Loss Number Is Not Enough

Training a large language model produces a stream of numbers, and one of the most important of them is the loss. A single number on its own does not tell you very much, though. When you see the loss going down, a useful question is whether the model is learning something useful, or whether it is only getting better at the particular text it has already seen. The source for this topic answers that question with a practical method: compute the loss on two different sets of data, the training set and the validation set, and read the two results together.

The purpose stated in the source is direct: computing the training and validation set losses is a way to assess the quality of LLM-generated text during training. Keep one question in mind as you read: what does each of the two losses tell you that the other one cannot?

Where Each Dataset Goes

The training set loss is computed on the training set, and the validation set loss is computed on the validation set. Two datasets enter the process, and each one is used to compute a loss on the same model. The two resulting losses are then looked at side by side. The assessment therefore does not come from one loss alone. It comes from the pair.

Training settext the model is trainedonThe modelsame model for both lossesTraining set losscomputed on training setAssessmentread the pair togetherValidation setseparate held-out textValidation set losscomputed on validation setfeedsfeedsyieldsyieldscompared withcompared with
Where does each set of text go, and how do the two resulting losses come together?

Read the diagram from left to right. The two datasets sit at the start, the model sits in the middle, and the two losses appear at the end, where they are compared. Notice that the model is the same object in both measurements. What differs is the text that the loss is measured on.

What Changes Between the Two Losses

The two losses share a purpose and a measuring procedure, but they differ in which text is used. The training set loss uses the training set. The validation set loss uses the validation set. The name of each set tells you its role: the training set is the data that the training process is built around, and the validation set is a separate collection that the source treats as its own measurement target.

AspectTraining set lossValidation set loss
Data usedThe training setThe validation set
What it measuresHow the model does on the text it is training onHow the model does on separate text
Shared elementSame modelSame model
Role in assessmentOne of two separate measurementsOne of two separate measurements, read together with the first

The two losses use the same model but different data, and they are read together.

Training setthe data usedTraining set lossmeasured on the trainingsetValidation setthe data usedValidation set lossmeasured on the validationsetused forused for
What is shared between computing the training loss and the validation loss, and what differs?

Reading the Two Losses Over Training

Training is not a single measurement. As training continues, the developer computes both losses again and again, so the two values form a history. Reading that history is how the pair is used to judge the model. The question from the source is the guiding one: is the model learning something useful, or is it only getting better at the text it has already seen?

Early trainingtraining and validationlosses recordedLater trainingboth losses recorded againContinued trainingcompare the two historiesJudgmentis the model generalizing?more trainingmore trainingread together
As training continues, what does the developer look at, and how do the two values relate over time?

The source does not provide specific loss values, so no particular curve shape is established by it. What it does establish is the reasoning: a low or falling training loss alone cannot tell you whether the model is only fitting the text it has seen. The validation loss is the second piece of evidence that the source says you need to read alongside it.

Walking Through One Assessment Step by Step

Worked example

Assessing generated text quality with both losses

A developer is training an LLM and wants to judge the quality of the text it generates. Using only the sequence of steps described in the source, how should the two losses be computed and used together? No specific numbers are given, so the focus is on the workflow.

  1. 1
    Prepare two separate datasets

    The developer has a training set and a validation set. They are distinct collections of text, so the two losses are measured on different data.

  2. 2
    Compute the training set loss

    The model is evaluated on the training set, and the result is the training set loss. This is the first of the two separate measurements.

  3. 3
    Compute the validation set loss

    The same model is evaluated on the validation set, producing the validation set loss. This is the second measurement, taken on different text.

  4. 4
    Record both values during training

    Because training continues over time, both losses are recorded at the points the developer chooses, forming two histories that can be compared.

  5. 5
    Read the two losses together

    The assessment comes from the pair. A single training loss value is not enough to conclude that the model is learning something generally useful.

Result

The quality assessment is a judgment made from both losses read side by side, not from either loss on its own.

Common Misreadings of Training and Validation Loss

  • Common mistake

    Treating a low training loss as proof that the text quality is good

    What it looks like

    A developer sees the training loss is small and concludes the generated text is reliable.

    Why it fails

    The training loss is measured on text the model has already seen. The source's guiding question is whether the model is only getting better at that particular text.

    Do this instead

    Read the training loss together with the validation loss before drawing a conclusion about quality.

  • Common mistake

    Averaging the two losses into a single number

    What it looks like

    Combining the training and validation values into one figure to get a simpler score.

    Why it fails

    The source describes the two losses as separate measurements that are not interchangeable. Averaging them discards which dataset each value came from.

    Do this instead

    Keep the two values as separate measurements and compare them.

  • Common mistake

    Judging the model from the validation loss alone

    What it looks like

    A developer looks only at the validation loss and ignores the training loss history.

    Why it fails

    The source says judging text quality from a single loss leaves out part of the evidence.

    Do this instead

    Use both losses, read together over the course of training.

  • Common mistake

    Assuming the two losses measure the same text

    What it looks like

    Reading the validation loss as just a second copy of the training loss.

    Why it fails

    The two losses are computed on different datasets, the training set and the validation set.

    Do this instead

    Remember which dataset each loss was computed on before interpreting the gap between them.

Checking Your Reading

MEDIUM

A colleague says: my training loss went down a lot during the run, so the model's generated text must be good. Using only the reasoning from this article, explain what is missing from that conclusion and what second measurement you would ask for.

Hints
  • Think about which dataset the training loss is computed on.
  • The source says the two losses are read together, not interchangeable.
  • The question to answer is whether the model is learning something useful or only getting better at text it has already seen.

Key Takeaways

  • Computing the training set loss and the validation set loss is a way to assess the quality of LLM-generated text during training.
  • The training set loss is computed on the training set and the validation set loss on the validation set; they are separate measurements read together, not interchangeable numbers.
  • A single loss leaves out part of the evidence, because a low training loss alone cannot show whether the model is learning something useful or only fitting text it has already seen.
  • Common misreadings include treating a low training loss as proof of quality, averaging the two losses, and reading the validation loss as a copy of the training loss.

Related concepts

More concepts starting with A