Back to glossary

Term

Ground Truth

A reference taken to be correct, against which model outputs are measured. In AI code analysis it is a piece of code with deliberately injected, known defects, so you can measure how many real problems a model actually finds.

Ground Truth — explained in detail

Ground Truth denotes a reference that is treated as correct by definition and against which a model’s outputs are measured. It is the benchmark used to decide whether a model is right or wrong.

In the context of AI-assisted code analysis, ground truth is a piece of code into which a known set of defects has been deliberately injected. Because you know in advance which and how many problems are actually present, you can measure what share of them a model detects (see recall). Without this known truth, you can only assess what a model claims to find — not what it misses.

That is precisely the value: ground truth makes the invisible visible. False positives (reported issues that are not real) and false negatives (real issues that go undetected) only become measurable once a reliable reference exists.

Example / Practical use

You prepare a codebase with 20 deliberately injected weaknesses — for instance an SQL injection, an off-by-one error and a missing null check. These 20 are the ground truth. If a model then runs its analysis and correctly reports 12 of them, recall is 60 percent.

Without that reference you would only know: “The model reported 12 issues.” Whether that is good or poor, whether eight real defects slipped through — that would remain unknown. Ground truth turns a mere claim into a verifiable hit rate.

Ground truth must not be confused with groundedness or faithfulness. Groundedness asks whether a model’s statement is supported by a provided source text (i.e. not hallucinated). Ground truth, by contrast, is the external, correct-by-definition reference against which results are evaluated. One concerns fidelity to the source, the other the benchmark of evaluation — two distinct concepts that are easily mixed up because of their similar word roots.

Entdecke mehr

Themenuebersicht