Verification — check the evidence
Language models can be confidently incorrect. Require empirical evidence, verify mathematical invariants, and use clean-context peer review to audit findings.
Researchers remain responsible for the scientific integrity of their published work. When collaborating with an agent, effective supervision requires maintaining an active verification posture: "What assumptions could invalidate this result?"
The three levels of analytical validation
- Procedural alignment: Did the agent execute the instructions you actually requested?
- Computational correctness: Does the code correctly implement the mathematical formulas, cohort definitions, and statistical models?
- Substantive validity: Is the formulated research question scientifically sound, and do the conclusions follow logically from the empirical data?
Agent automation accelerates levels 1 and 2, but level 3 remains the intellectual responsibility of the researcher.
Characteristic agent failure modes
- Silent data modifications: Imputing missing values, trimming outliers, or deduplicating records without explicitly logging the changes.
- Partial file inspection: Inspecting only the initial dozen rows of a multi-gigabyte dataset while asserting conclusions about the entire cohort.
- Hallucinated entities: Generating fabricated bibliographic citations, non-existent dataset column names, or invented software API methods.
- Confirmation bias (sycophancy): Agreeing uncritically with leading questions or premature hypotheses proposed by the researcher.
- Superficial completeness: Reporting that an analysis is complete when script execution produced uncaught warnings or truncated outputs.
Demand empirical evidence over conversational reassurance
Asking subjective questions such as "Are you confident this is correct?" typically triggers sycophantic reassurance ("Yes, the calculation is verified"). Instead, require checkable, objective evidence:
Provide the terminal commands executed and the explicit sample sizes (denominators) behind every percentage. Generate an audit table listing every excluded record, categorized by exclusion rule.
A standard verification ritual
- Verify mathematical invariants (Conservation of records): Total raw records must strictly equal the sum of retained records and explicitly documented exclusions. Unreconciled counts indicate silent data drops.
- Explicit denominators: Ensure every proportion, percentage, or rate displays both the numerator and the active denominator.
- Independent cross-checks: Calculate key summary statistics using an orthogonal method (e.g., verifying a logistic regression odds ratio against a 2x2 contingency table calculation).
- Rerun from clean state: Execute the generated analysis script in a fresh shell to confirm that it runs end-to-end without interactive dependencies.
Reviewing agent-generated code
Evaluating code does not require writing every line yourself. When reviewing an analytical script, focus on critical inflection points:
- Data ingestion: Which source files and columns are loaded?
- Filtering criteria: Which rows are dropped, and do the thresholds match the study protocol?
- Missing value policies: Are missing entries omitted, imputed, or grouped into separate categories?
- Relational joins: Are table merges one-to-one, one-to-many, or inner joins that silently discard non-matching keys?
- Output generation: Which variables are exported, and are unit scales transformed correctly?
Ask the agent to explain any specific algorithmic block or mathematical operation that appears ambiguous.
Peer review using a secondary agent
An agent that just completed an analysis carries its earlier assumptions throughout its active context window, making it poorly suited to audit its own code.
To conduct an objective review, open a separate session with a fresh context window and instruct a second agent to adopt an adversarial auditing perspective:
You are conducting an independent peer review of an analysis script. Inspect <protocol.md>, <scripts/analyze.py>, and <out/results.md>. Audit the script line by line against the protocol. List all discrepancies, unjustified assumptions, and unhandled edge cases in order of severity. Do not modify any files.
Using a secondary agent provides an independent review unencumbered by prior conversation history, though researchers should note that foundation models from the same family may share underlying inductive biases.
Calibrating verification to research stakes
Calibrate verification effort to the operational stakes of the work: exploratory data sketches require brief spot-checks, whereas analyses informing manuscripts, clinical protocols, or institutional policy demand full invariant accounting, code review, and independent peer review.
Try it
- Analyze an exposure and outcome, crude and adjusted. Conduct crude and multivariable adjusted statistical comparisons, evaluating how controlling for baseline confounders alters estimated effect sizes.
- Build a study cohort with a flow table. Translate formal study eligibility criteria into a reproducible cohort dataset, accompanied by an attrition flow diagram reconciling excluded populations.
- Classify many records with a language-model API. Execute batch record classification via programmatic API calls with dry-run estimation, incremental state checkpointing, and validation against a benchmark sample.
- Clean the data with a script, and show the flow. Implement approved cleaning rules in a non-destructive script that produces cleaned datasets and a reconciled record-flow table.
- Evaluate an AI tool, with intervals. Measure how well a model separates positive from negative cases, compare models on the same patients, check subgroups, and report every estimate with its uncertainty.
- Find references from a bibliographic database. Build a verified BibTeX bibliography via programmatic API retrieval (PubMed E-utilities), establishing a reproducible search log and eliminating hallucinated citations.
- A first answer from raw data. Generate an initial exploratory estimate from uncleaned data, requiring explicit definitions and denominators to establish an uncleaned baseline.
- Look at the images. Have the agent read image headers and render a labelled contact sheet you can open, so that your own eyes check what the numbers say.
- Turn the analysis into a tool and a skill. Package proven analytical pipelines into tested, parameterized command-line tools and modular agent skills for persistent reproducibility.
- Profile the data and find problems. Generate a systematic data-quality audit documenting anomalies, null patterns, and unit mismatches without modifying source files.
- Read and summarize text files. Direct the agent to inspect and synthesize project-local text files, validating source provenance and avoiding copy-paste truncation.
- Build references from links you provide. Construct an auditable BibTeX bibliography from researcher-curated URLs, using DOI content negotiation and PMID lookups while barring model speculation.
- Build a viewer and review the flagged images. Have the agent flag suspect images with code, build a small offline viewer, and confirm or reject each flag yourself before anything is changed.
- Review the analysis with a fresh second agent. Commission an independent peer review of scripts and findings using a secondary agent session with a clean context window.
- Run an AI model yourself, on a CPU. Reproduce the scores you were given by running the pretrained model on your own machine, and explain every score that does not match.
- Before-and-after comparison with a comparison group. Execute a quasi-experimental difference-in-differences analysis comparing intervention and control sites to account for secular temporal trends.
- Write a research abstract as LaTeX, with citations. Author a structured scientific abstract in LaTeX from empirical results files and a verified bibliography, compiling a publication PDF and tracing numerical claims to their source.