In machine learning, verified labels can be used for training and evaluation. If a model flags an email as spam and the verified label says it is safe, the model made an error. For an LLM feature, a product manager or domain expert can specify ground truth as an exact value, a reference answer, or a set of criteria the answer must meet. Compare each new output against that reference when you change the prompt or model.
Meaning and origin of the term
The phrase comes from remote sensing, cartography and meteorology. Satellite images and aerial photos have to be interpreted, and those interpretations can be wrong. To check them, teams went to the location and recorded what was actually there: crop type, land cover, the size of a flooded area. That on-site check is called ground truthing, and the observations it produces are the ground truth.
The term moved into statistics and data science with the same idea attached. Ground truth observations are the trusted measurements, and everything else, whether a satellite classifier or a neural network, is judged by how closely it matches them. In everyday English, "ground truth" is also used more loosely for the facts on the ground, as opposed to what a report or a plan assumes.
Common synonyms in AI and data science are reference data, gold standard, gold labels and expected output.
Ground truth in machine learning
In supervised learning, a model learns from labeled data: inputs paired with the correct output. Those labels are the ground truth. For image classification, a human annotator marks whether a photo shows a cat or a dog. For speech recognition, someone writes down what was actually said. For a fraud model, the label records whether a transaction turned out to be fraudulent.
Ground truth serves two jobs in a machine learning project:
- Training data. The model adjusts its parameters until its predictions match the labels used to train it as closely as possible.
- Evaluation data. A separate, held-out data set measures model performance on cases the model has not seen. Metrics such as accuracy, precision and recall are only meaningful because predictions are measured against ground truth.
If the labels are inconsistent or biased, the model learns those errors and the evaluation metrics report them as correct. The quality of your ground truth often limits model accuracy more than the choice of algorithm.
Ground truth in LLM evaluation
An LLM feature rarely has one correct label. A support assistant can answer a refund question in many acceptable ways, and the output can be free text, JSON, a classification or a mix of these. Ground truth for an LLM feature usually takes one of three forms:
- An exact expected output, for tasks such as extraction or classification where only one answer is right: "tier 2", "invoice total: 1,240.50". These cases can be checked with a deterministic eval, a code check that compares the values directly.
- A reference answer, a full response the expert approved as the ideal one. An LLM judge then checks whether a new answer says the same thing, even when the wording differs.
- Required and forbidden elements, for example "must state the 30-day return window, must not promise a refund before the item is received."
Ground truth is one way to evaluate an AI feature, and you don't need it for every eval. Some checks score an answer on its own, such as whether the JSON is valid or the tone fits your brand. Comparing against ground truth works best when the team can say exactly what the right answer is for a given input.
Ground truth vs. golden dataset
The two terms are closely related and often used interchangeably, but they describe different things.
- Ground truth is the correct answer for one input.
- A golden dataset is a curated collection of real inputs, each paired with its ground truth, that a team re-runs after every change to a prompt, model or pipeline. Typical golden datasets for an AI feature hold 50 to 200 cases, including uncomfortable edge and adversarial cases.
Put simply, ground truth is the answer key for a single question, and the golden dataset is the full exam.
How to create ground truth
- Collect real inputs. Use production data or realistic test scenarios, including edge cases and inputs that caused errors before.
- Run them through your actual setup. Use the same prompt, the same context and the same model your feature uses. Ground truth written in isolation often describes an answer your AI could never produce from the information it has.
- Let product and domain experts review the real answers. Starting from a real AI answer is faster than writing one from a blank page. The expert keeps what is right, fixes what is wrong and approves the result as the expected output. In product teams this is usually the product manager. Depending on the product, clinicians, lawyers, support leads or sales ops can contribute too.
- Pick one standard. Two experts can approve different answers for the same input. Decide whose standard the AI should meet, name one person who has the final say, and apply that standard the same way across every iteration.
- Keep it up to date. Ground truth goes stale when the feature changes, the product changes or user behavior changes. Treat it as a maintained asset with an owner.
Read our study on a mental health AI companion, where the same model scored very differently depending on which clinician's standard it was measured against — Mental health AI: an expert rubric does not make a trustworthy judge.
How to create ground truth in Lovelaice
Lovelaice is built so the people who know what a good answer looks like can create ground truth themselves, without writing code or editing spreadsheets.
- Run your test scenarios on your real setup. Bring your prompt, your context and your test inputs. Lovelaice runs them on every model you want to compare, from 400+ models, with no API keys to set up.
- Compare the answers side by side. For each test input, you see what every model answered next to each other. One of them is often close to what you want.
- Save the best answer as the expected output. One click on an answer opens it in an editor. Keep it as it is, or change the parts that are wrong: a tier, a sentence, a promise the AI shouldn't make. JSON answers can be edited in a structured view or as raw text.
- Add it to your dataset. Lovelaice suggests the dataset your experiment already uses, or you can create a new one. The approved answer becomes the ground truth for that test input, and every future experiment is measured against it.
Reviewing and fixing a real answer takes a fraction of the time it takes to write one from scratch. That is what lets a product manager or domain expert own the golden dataset, instead of handing it to engineering and waiting.
An example
A team is building an AI sales assistant for B2B SaaS companies. It reads each incoming lead and sorts it into priority tiers 1 to 4, using the customer's own ideal customer profile and product description. The team agreed on one rule: if the company is in the target segment, the lead is tier 1, even when the contact is not in a buying role.
A lead comes in from a company that fits the segment, but the contact is a working student in marketing. The team runs this test case on three models in Lovelaice. Two of them assign tier 3 because the contact doesn't match the buyer profile. The third assigns tier 1, but gives the wrong reason. The product manager saves the third answer as the expected output, rewrites the reasoning to point to the company fit, and adds it to the golden dataset.
From then on, every prompt or model change is tested against this case, and a deterministic check confirms whether the tier matches. Without the product manager's approved answer, the team would only see three confident answers, with no way to tell which one followed their rule.
