Index Ai Academy
Glossary · Phase 1 · Building with LLMs

Held-out

Also written: held out, held-out data

Data kept aside and never used for training, so you can test the model on examples it hasn't seen.

What it means

Held-out data is data you keep aside and never train on, so you can test a model on examples it hasn't seen. It's the only honest way to find out whether a model learned a pattern or just memorized its examples, because a model's score on its own training data tells you very little.

An example in Python

import random

random.seed(1)
# 200 customers. The label depends partly on the number, and partly on chance.
rows = [(i, (i % 3 == 0) != (random.random() < 0.2)) for i in range(200)]
random.shuffle(rows)
train, held_out = rows[:160], rows[160:]

# A "model" that only memorizes its training data.
memory = dict(train)
def predict(i):
    return memory.get(i, False)

def accuracy(data):
    return sum(predict(i) == label for i, label in data) / len(data)

print(f"on the training data: {accuracy(train):.0%}")
print(f"on the held-out data: {accuracy(held_out):.0%}")
What it prints
on the training data: 100%
on the held-out data: 65%

This "model" only memorizes, so it's perfect on what it has seen. On the held-out data it has nothing to go on, and it drops to 65%. Only the second number says anything about new customers.

Three rules for keeping it honest

Hold the data out before you look at it. Don't tune on your final test set: use a separate validation set for choosing settings, and score the test set once, at the end, because every extra look leaks a little of it into your decisions. And check for leaks, such as the same customer appearing on both sides.

The same goes for LLM apps. If you tune a prompt against the same questions you use to judge it, the score stops meaning anything, so keep a held-out set of questions for your evals.

Try it now

Use the cheapest grader that measures what you care about.

Learn it properly

Evals · Measure output quality with test sets instead of vibes. About 30 minutes.

Create a free account See what's in the lesson

Other terms from the same lesson

Never trained an AI?

Teach a small one to write, right in your browser. It takes about 20 seconds and needs no account.

Teach it to write