Skip to main content
For the complete documentation index for agents and LLMs, see llms.txt.

Evaluation Metric Values and DirectionBeta

Beta
This is coming — this page describes a feature that's still being rolled out and may not be available to you yet.

A metric returns a score or a label, and you can declare which direction counts as better.


Scores and Labels​

Each metric returns one of two kinds of value. A score is a number, such as 0.8. Use it for things that come in degrees, such as relevance or cost. Scores let you see a distribution and spot sessions at the low end.

To chart a score against the scale it's measured on, declare its range, for example 0 to 1 or 1 to 5. Each score in a metric can have its own range.

A score outside its declared range doesn't end the run in error. The platform clips it to the nearest bound, so a value of 576.71 in a range of 0 to 300 is reported as 300, and a value of -2 in a range of 0 to 1 is reported as 0. One unusually slow or large session therefore doesn't throw away the scores of the whole run. If a measured quantity has no natural ceiling, such as a generation time, set the upper bound high enough to cover the values you expect to tell apart. A score that isn't a number (NaN) can't be clipped, so the platform refuses it.

A label is one value from a list you define, such as called or skipped, or grounded, partly grounded, and not grounded. Use it for things that fall into categories. A yes-or-no question is a label with two values.

When you ask a model to judge, prefer labels. A model picks between clearly described categories more reliably than it places a value on a numeric scale.

A metric can also report that it doesn't apply to a session, for example a tool-call metric on a session where no tool was needed. Not applicable is an answer, not a failure: the metric had nothing to judge. The platform counts those sessions separately, so they don't distort your results.

Give a Label a Scale​

A label on its own has no order and no direction. To say how good each word is, declare a Scale on a closed label, which is a label with a fixed list of words. Write its vocabulary in the @metrics entry as a mapping from each word to a number from 0 to 1, where higher is better. For example: @metrics(verdict=Label(grain="session", vocabulary={"wrong": 0, "partial": 0.5, "correct": 1})). The platform keeps the words in the order you wrote them, and returns the Scale with the metric's declaration.

Write the mapping as literals, because the platform reads the declaration without running your code. When you save the metric, these rules apply:

  • Each value must be a finite number from 0 to 1. Booleans aren't valid values.
  • No two words can have the same value.
  • A Scale applies to a label with a fixed vocabulary only.

If a value breaks a rule, the save is refused, and the message names the metric key and the word to fix.

Like a score's direction, a Scale describes how to read a label, not what the metric measures. Any version of a metric can add, change, or drop its Scale. Narrowing a label's vocabulary is still refused, whether or not it has a Scale.

In an LLM-as-a-judge metric that answers with a label, you rank the answers in the judge form instead of writing code. Each word gets a value from 0 to 1, prefilled evenly in the order the words are listed, and the form writes the mapping for you. A new label starts ranked, with fail at 0 and pass at 1. A word you add to a ranked label starts without a value, so you place it yourself. If the answers have no order, select These answers don't rank (categories). The form then writes a plain list of words with no Scale.

The form doesn't let you save while a value is empty, outside 0 to 1, or repeated, or while a word is empty or repeated on a ranked label. Fix the highlighted fields to save. Words stay where you put them while you edit, and the form sorts them by value when you open and save a judge. To sort them sooner, click Sort by value. It appears only when the words are out of order and every value is valid.

On the run page of a scoring run, a label with a Scale is shown from worst to best. Each bar is tinted from red at 0 to green at 1, with its word beside it. A label without a Scale keeps grey bars.

Metric Direction​

To see whether a change in a score is an improvement, declare which way is better: better="higher" or better="lower". Labels don't take a direction. Declare it in the score's @metrics entry, for example @metrics(helpful=Score(grain="session", range=(1, 5), better="higher")). Without a direction, comparisons show only the numeric change.

In an LLM-as-a-judge metric that answers with a score, you don't write code for this. Under the score's range, choose Higher is better, Lower is better, or Not set when neither direction is better.

When you compare experiments, or review the candidates of a pipeline optimization, the platform classifies how the candidate moved each metric against the baseline:

  • Improved: the value moved in the direction you declared as better.
  • Regressed: the value moved the opposite way.
  • Unchanged: the difference is exactly zero. There's no tolerance.
  • Unknown: there's no difference to read, or the score declares no direction.

Direction describes how to read a change, not whether a value is good, so the platform never judges an absolute value. The built-in pipeline metrics, such as cost, duration, and tokens, always count lower as better.

Any version of a metric can set, flip, or drop its direction, because direction isn't part of what the metric measures. The newest version that judged the metric on either side of a comparison decides the direction. Changing it in a new version therefore also changes how earlier results read.