QA Interview Hub · Knowledge base · Quizzes · Українська

AI › Testing AI features in a product

What counts as correct: criteria, rubric and golden set

The correct answer of an AI feature is described by properties a run can check, not by a reference text. These are required facts, forbidden content, form and a threshold expressed as a share of passed cases. A rubric with pass and fail examples scores what cannot be reduced to a rule, such as tone. A golden set is built from typical and edge cases, questions with no answer and past incidents.

AI for QA · AI features

Product asks for "good email summaries". How do you turn that into a checkable criterion?

An AI feature (an email summary, field extraction, classification, search-based answers) returns different text for the same input. A test "expected string equals actual" does not work here, and a requirement "should work well" cannot be checked. QA’s first job is to agree with product on what counts as correct and write it down so that a run can say yes or no.

How it works and why. Instead of a reference text you describe the properties of a correct answer. Code, a schema or another model checks them, and the set of properties stays stable even though the wording varies from run to run. Acceptance criteria usually have four parts.

  • Required facts: the email summary contains the amount, the date and the counterparty.
  • Forbidden: invented numbers, names and links, other people’s personal data, needless disclaimers where they do not belong.
  • Form: up to N words, the answer language matches the request language, valid JSON.
  • Threshold: not "always" but a share of passed cases, for example at least 90% and no failure among the critical ones.

A string or properties

brittle

String equality

expect(summary).toBe("Pay 1200 UAH by May 5"). A different wording with the same meaning fails although the answer is correct.

robust

Checkable properties

The amount 1200 is there, the date May 5 is there, no invented numbers, at most 40 words. The wording can be anything.

Figure 1. Properties survive a change of wording and truly reject wrong answers.

Rubric is a short list of items with weights by which an answer is scored: a human or an automatic check. It helps when a property cannot be reduced to a string (tone, completeness). For each item give an example of passing and failing so that two graders give the same score.

Golden set is a set of requests with expected properties. It is built from more than typical cases.

What a golden set is made of

Typical requestswhat users do every dayEdge casesempty input, a very long document, mixed languagesUnanswerable questionsthe right answer is "I don’t know"Cases from incidentsevery production failure is added
Figure 2. Every production incident becomes a new case, so the set grows along with the product.

Example: criteria as code. Each case has facts, forbidden patterns, a length limit and a criticality flag. The grader returns a list of failures, not just yes or no: you see what exactly broke. The summary is the pass share and a separate condition for critical cases.

type Case = {
  id: string;
  input: string;
  mustInclude: string[]; // facts that must be present
  mustNotMatch: RegExp[]; // forbidden: invented numbers, other people’s data
  maxWords: number;
  critical: boolean; // a failed critical case blocks the release
};

function grade(output: string, c: Case): string[] {
  const failures: string[] = [];
  for (const fact of c.mustInclude)
    if (!output.includes(fact)) failures.push(`missing: ${fact}`);
  for (const re of c.mustNotMatch)
    if (re.test(output)) failures.push(`forbidden: ${re}`);
  if (output.split(/\s+/).length > c.maxWords) failures.push('too long');
  return failures;
}

// threshold: at least 90% and no failure among the critical ones
const results = await Promise.all(cases.map(async (c) => ({ c, f: grade(await run(c.input), c) })));
const passRate = results.filter((r) => r.f.length === 0).length / results.length;
expect(passRate).toBeGreaterThanOrEqual(0.9);
expect(results.filter((r) => r.c.critical && r.f.length > 0)).toEqual([]);

Grounding and citations. For answers based on documents check not only that a link is present but that the quote really appears in the source and supports the claim. A link to an existing but irrelevant document is also a defect. Questions with no answer in the documents must be in the set: the right behaviour there is to abstain, not invent.

Limits and alternatives. Properties do not catch everything: an answer can have all the facts and still be clumsy or rude, which needs a rubric with human scoring or a judge model (see the regression lesson). A small set gives noise: 20 cases cannot tell 90% from 95%. Synthetic requests are quick to make but resemble each other and do not replace real ones. So the set is a mix: real (anonymised) requests, synthetic ones for coverage, cases from incidents.

Typical mistakes.

  • Taking one "good" output as the reference and checking equality with it.
  • A criterion "the answer should be good" with no examples of passing and failing.
  • A set without edge cases and unanswerable questions.
  • A "100%" threshold on non-deterministic output: it is either never reached or the set is too easy.
  • Not adding production incidents to the set.

Check yourself

Why check properties rather than string equality for an email summary?

Answer

The model words it differently each time, so equality fails correct answers, while a word-similarity metric passes wrong ones: a summary without the amount but with the same words looks like the reference. Properties (facts, forbidden, form) check substance, not words.

Why put unanswerable questions into a golden set?

Answer

Because there the right behaviour is "I don’t know", not an invention. Without such cases a model that always answers looks perfect.

Why set the threshold as a share rather than "always"?

Answer

Output is non-deterministic, so a hundred percent will not happen. The share is supplemented by a "no failure among critical cases" condition.

In an interview. Junior: The model output differs each time, so I do not compare strings but check properties: needed facts, no invention, format and length. I agree acceptance criteria with product. Middle/Senior: I write criteria as code and a rubric, and build a golden set from typical and edge cases, unanswerable questions and incidents. I set the threshold as a share plus no failure on critical ones. For quality aspects that cannot be reduced to a rule I add a rubric with human scoring and a judge calibrated on humans.

More articles in this chapter