Measuring RAG grounding claim by claim
A small, runnable version of the evaluation used in RAG Evaluation and Grounding: break an answer into claims, then test each claim against the records it cites.
Test answer 2: one claim is stated in the cited inspection report; the other names equipment that no record mentions.
Method
- Source records as named graphs. Each record — here a batch record and an inspection report from a synthetic PV production line — is stored as its own RDF graph using BFO and Relation Ontology terms.
- Answers as claims. Each answer is a set of claims (subject, predicate, object) with the records it cites.
- Structure check. A SHACL shape requires every claim to be complete and to cite at least one record.
- Support check. Each claim is looked up in the records it cites, then in all records.
- Report. One row per claim with a verdict and the reason, exportable as CSV.
Results on the four test answers
| Verdict | Meaning | Claims |
|---|---|---|
| Supported | Stated in a record it cites | 4 |
| Mis-cited | Stated in the sources, but not in the record cited | 1 |
| Unsupported | No record states it | 1 |
| Invalid | Fails the SHACL shape (no citation) | 1 |
One of four answers is fully grounded. Download the sample report (CSV).
In a client engagement
- Questions and expected sources come from your users and records, not a synthetic plant.
- Claims are extracted from the system's free-text answers as structured output, and a human-labelled sample calibrates the automated judging.
- Retrieval is checked too: whether the records that should answer a question were retrieved at all.
- The same test set is re-run after each change, so improvements are measured rather than assumed.
Limitations
- The data is synthetic and the four answers were written by hand to show each verdict; they are not model output.
- Claims are matched as exact triples. Paraphrases, inferences and partial matches need entailment checks or human review.
- Claim extraction from free text is not shown here.
- SHACL checks structure, not truth: a well-formed claim can still be wrong, which is what the support check is for.