Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Evidence Testing & Control After 22 Days of AI

· 7 min read · Home Tech

In this article
  1. Formula
  2. Worked Example
  3. What Evidence Testing Actually Means in AI
  4. Control: The Input Side
  5. Common Mistakes After 22 Days
  6. How to Choose What to Test
  7. Comparing Evidence Testing to Traditional QA
  8. Costs and Practical Limits
  9. Frequently Asked Questions

After 22 days of building AI systems, the clearest lesson is that evidence testing and control are not optional extras—they are the core engineering discipline. You test every output against known evidence, and you control every input, prompt, and data source so that the system cannot drift into fabrication or bias. This article explains what that practice looks like in concrete terms, what goes wrong when it is skipped, and how to build it into your own workflow.

in t | Test cases run | count | 50 | 0
in p | Tests passed | count | 47 | 0
out pass_rate | Pass rate | % | (p / t) * 100 | 1
out fail_count | Failed tests | count | t - p | 0

Formula

The pass rate is the ratio of tests that produced correct, evidence-backed outputs to the total tests run, expressed as a percentage:

Pass Rate (%) = (Passed Tests / Total Tests) × 100

Where:

  • Passed Tests (p) – number of outputs that matched the known evidence or ground truth
  • Total Tests (t) – number of test cases executed
  • Failed Tests – simply t − p, the count of outputs that did not match evidence

This is the same formula used in any binary classification evaluation: accuracy = correct predictions / total predictions. In AI systems, the “correct” answer is defined by a curated evidence set before you run the test.

Worked Example

Using the default values from the calculator: you run 50 test cases and 47 of them produce outputs that match the evidence base.

  1. Pass rate = (47 / 50) × 100 = 94.0%
  2. Failed tests = 50 − 47 = 3

The calculator returns a pass rate of 94.0% and 3 failed tests. This matches the manual calculation exactly.

What Evidence Testing Actually Means in AI

Evidence testing is not the same as unit testing traditional software. In a normal program, you check that a function returns the expected output for a given input. In an AI system, the model is probabilistic—the same prompt can produce different outputs across runs. So evidence testing requires a fixed set of input-output pairs that you trust as ground truth, drawn from reliable sources like official datasets, peer-reviewed studies, or manually verified examples. You run the system against those pairs and measure how often it agrees.

For example, if you build a medical Q&A bot, your evidence set might include 100 questions with answers sourced from clinical guidelines. If the bot answers 92 correctly, your pass rate is 92%. But you also need to test for harmful outputs—not just correctness. A separate evidence set might contain adversarial prompts designed to elicit unsafe or fabricated responses, and you track the rate at which the system refuses or gives a safe fallback.

Control: The Input Side

Control is about governing what goes into the system. After 22 days, the most important control is the prompt template. If you let users type anything directly into the model, you lose control over the system’s behavior. Instead, you wrap the user input in a structured template that instructs the model to only use provided context, to say “I don’t know” when uncertain, and to never invent citations or numbers.

Another control is the context window. Many AI systems retrieve information from a database or documents before generating an answer. You must control which documents are eligible for retrieval. If you allow any file, the model may pull in outdated or contradictory information. A whitelist of approved sources—updated regularly—keeps the evidence base consistent.

A third control is output validation. Before showing the user a result, you run it through a rule-based checker. For example, if the output is supposed to be a number, the checker verifies it is numeric and within a plausible range. If the output contains a citation, the checker verifies the citation exists in the approved source list. This catches many failures before the user ever sees them.

Common Mistakes After 22 Days

  • Testing with the same data you trained on – the model will score high but fail on new inputs. Always hold out a separate test set.
  • Only measuring accuracy – a system can be 95% accurate but still produce a dangerous hallucination 5% of the time. Track the severity of failures, not just the count.
  • Ignoring prompt drift – when you update the prompt template, you must re-run the full evidence suite. A small wording change can shift outputs significantly.
  • Not versioning your evidence set – if you change the ground truth without tracking it, you cannot compare results across time. Store evidence sets in version control.
  • Forgetting to test the “I don’t know” case – a good system should refuse to answer when evidence is missing. Test that it does so gracefully.

How to Choose What to Test

You cannot test everything. After 22 days, the practical approach is to prioritize based on risk and frequency. Start with the top 20 use cases your system will face. For each, write 10–20 evidence pairs. That gives you a baseline suite of 200–400 tests, which is manageable to run in a few minutes with automation.

Next, add a smaller set of edge cases: empty inputs, extremely long inputs, inputs with typos, inputs in a different language, and inputs that are designed to trick the model (prompt injection). These often reveal failures that the happy-path tests miss.

Finally, include a set of safety tests specific to your domain. If you are building a legal assistant, test that it does not give definitive legal advice. If it is a financial tool, test that it does not promise returns. These tests are not about correctness but about boundary enforcement.

Comparing Evidence Testing to Traditional QA

Traditional QA checks that software does what the spec says. Evidence testing checks that AI does what the evidence says. The difference is that AI has no spec—only examples. So your evidence set is the spec. This means the quality of your evidence set matters more than the model itself. A mediocre model with a rigorous evidence set will outperform a great model with a sloppy one.

Another difference is that traditional QA is deterministic—the same test always passes or fails. AI tests are probabilistic, so you need to run them multiple times and report a distribution, not a single pass/fail. For example, you might run each test 5 times and require a pass rate of at least 80% across runs. This accounts for the model’s temperature and sampling randomness.

Costs and Practical Limits

The main cost is not compute—it is human time to curate the evidence set. Writing 200 high-quality evidence pairs can take a full day. Maintaining them as the domain evolves takes ongoing effort. For a small team, this is often the bottleneck.

There is also a limit to what evidence testing can catch. It cannot prove that the system is safe or correct in all cases—only that it behaves well on the tested examples. This is why you must combine evidence testing with runtime monitoring. Log every production output and periodically sample it for manual review. If you see a new failure pattern, add it to your evidence set and re-test.

Finally, evidence testing does not solve the problem of unknown unknowns. The system may produce a plausible-sounding answer that is wrong but not obviously so. The best mitigation is to constrain the system to only use the provided evidence and to explicitly tell it to say “I don’t know” when the evidence is insufficient. This reduces the space of possible hallucinations.

Frequently Asked Questions

How many test cases do I need?

Start with at least 50 per major use case, but the number matters less than coverage. Aim to cover every input type, every output format, and every known failure mode. 200–400 total tests is a reasonable target for a small production system.

What is the difference between a test case and an evidence pair?

They are the same thing. A test case is an input paired with the expected output, and that expected output is the “evidence” you trust. The term evidence pair emphasizes that the expected output must come from a reliable source, not from the model itself.

How often should I re-run the evidence suite?

Every time you change the prompt, the model version, the retrieval database, or any system component. In practice, this means running the suite after every commit that touches the AI pipeline. Automate it so it runs in CI/CD.

Can I use the model to generate my evidence set?

No. The whole point of evidence is that it is independent of the model. If you use the model to generate expected outputs, you are just testing whether it agrees with itself. Use human-verified sources, official documents, or manually crafted examples.

What if my pass rate is below 90%?

First, check whether the failures are concentrated in a specific input type. If so, fix that area—improve the prompt, add more context, or retrain. If failures are scattered, consider whether the evidence set itself is ambiguous. Sometimes the “correct” answer is not clear, and you need to refine the evidence before blaming the model.

Does evidence testing guarantee the system won’t hallucinate?

No. It reduces the probability by catching known failure modes, but it cannot guarantee behavior on unseen inputs. Use evidence testing as one layer, and add runtime monitoring and human review for high-stakes outputs. Always keep a human in the loop for consequential decisions.