Skip to content
zac-obryantPublic

About

Validate AI like a process, not like software. Pin, AI R&R, c=0 sampling and p-charts for any AI system.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AIPV harness

Validate AI like a process, not like software.

A small, dependency-free harness that treats an AI system as a manufacturing process: pin its configuration, measure its variation, sample its output, and chart it over time. It is the working code behind the AI Process Validation (AIPV) method, built on public standards and quality engineering tools that already exist: Gage R&R, attribute acceptance sampling and control charts.

The harness is the gauge. The AI system is the part. The gauge knows nothing about the part except what comes out of it.

Learning project, built in public. Views are my own. AIPV is a personal method built on public frameworks; it is not a standard and does not make anything "compliant". Not validated for use in any regulated quality system.

The contract

Any system plugs in if it is a command that reads one question on stdin and prints one line of JSON:

{
  "answer": "Occlusion alarms were reported ... [1234567-2025-00012]",
  "cited_ids": ["1234567-2025-00012"],
  "retrieved_ids": ["1234567-2025-00012", "..."],
  "config": {"model_served": "...", "temperature": 0, "system_prompt_sha256": "..."}
}

That is the whole interface. Any language, any vector store, any model. examples/toy_rag.py is a complete second system in 25 lines.

What it measures

AIPV step Command Quality tool What it answers
3. Pin the configuration every command Installation qualification Did config stay identical across every output? Any drift is flagged by key.
4. Measure the variation rr Gage R&R Repeatability: same question, asked again. Reproducibility: different wordings of the same question. Measured separately for retrieval and for citations, so you can see which stage the variation comes from.
5. Prove it with sampling sample c=0 attribute sampling Zero defects in 299 outputs shows the defect rate is at most 1% with 95% confidence. Reports the exact upper bound for any sample.
7. Monitor for drift pchart p-chart Defect rate per batch against limits set by the validation run. Flags batches whose configuration changed since the baseline.

Defect, today: the output is missing or invalid, or the answer cites a source the system never retrieved. Both are checked by machine, so every output can be checked, not a sample of a sample. Human-judged defects (wrong claim, unsupported claim) are the next step.

Use

python aipv.py run --cmd "python examples/toy_rag.py" \
    --questions examples/maude/questions.json --reps 10 --out runs/baseline.jsonl
python aipv.py rr runs/baseline.jsonl
python aipv.py sample runs/baseline.jsonl            # --p0 0.01 --confidence 0.95
python aipv.py pchart runs/baseline.jsonl runs/2026-W47.jsonl runs/2026-W48.jsonl
python test_aipv.py                                  # self-check

Questions file: a list of {"id", "group", "question"}. Questions that share a group are paraphrases of each other and are used for reproducibility.

Every run file starts with a manifest (command, question-file hash, reps, start time, harness version), so a result can always be traced to what produced it.

Example system under test: MAUDE RAG

examples/maude/questions.json asks questions of a retrieval-augmented generation system over public FDA MAUDE insulin pump adverse event reports, a separate learning project. Its ask --json mode implements the contract:

python aipv.py run --cmd "cd ../MAUDE_RAG && .venv/bin/python -m maude_rag.ask --json" \
    --questions examples/maude/questions.json --reps 10 --workers 4 --out runs/maude-baseline.jsonl

Honest limits

  • Repeats are not independent samples. 299 outputs from 10 questions tests repeatability, not the population of real questions. sample warns when distinct questions are fewer than the plan's n.
  • Agreement is set overlap (Jaccard) on cited and retrieved ids, not a variance decomposition. It is attribute-agreement logic applied in the spirit of Gage R&R, not a textbook %GRR.
  • p-chart limits from a zero-defect baseline are zero, so any later defect is a signal. That is deliberate.
  • MAUDE reports are unverified, can be duplicated, and do not establish that a device caused an event. Nothing here is medical or regulatory advice.

Roadmap

  1. Pin, AI R&R, c=0 sampling, p-chart (this release)
  2. Reviewer attribute agreement: seed known errors and measure whether the human check catches them
  3. Change classification: which config changes mean revalidate, verify, or document only
  4. Risk tier to sample size table (model influence × decision consequence)

License

MIT

About

Validate AI like a process, not like software. Pin, AI R&R, c=0 sampling and p-charts for any AI system.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages