Guide · evaluating an AI system with Seismograph

Evaluate the process, not the sample

One good answer tells you little about a system that answers differently each time. This guide walks the whole loop in seven steps: declare what must not change, run it many times, read the chart, read the modes, and let a deterministic gate decide the release.

DeclareA contract: fields that must hold still, and the tolerance.
SampleThe same probe, many times, under each change to the input.
ReduceFlip rate, malformed rate, set overlap, outcome modes.
ChartLimits from your own baseline. A point outside is a signal.
GateCode decides pass or block. The evidence is attached.

Start the instrument

You need Docker. No API key is needed for anything in this guide.

git clone https://github.com/nuwansamaranayake/Seismograph
cd Seismograph
cp .env.example .env
docker compose up -d --build
# open http://localhost:8000

In development the API runs without a token. Anywhere else it refuses to start without one, and this dashboard asks for it before showing a single number.

The overview board listing contracts with their gate state, trend, and chart signals
The overview board. Every figure on it is read from the API. An empty instance says so.

Declare what must not change

A contract is a YAML file that lives beside your prompt. It names fields of the answer, the changes to the input each field must survive, and the tolerance the gate enforces. Open Contracts, keep or edit the example, and press Register and compile.

contract: refund-full-invariants
subject: support-agent
invariants:
  - field: eligibility_decision          # this field of the answer
    under: [repeat_run, irrelevant_context, reordering, format]
    relation: equal                      # must be the same under each change
  - field: cited_policy_ids
    under: [repeat_run]
    relation: jaccard_at_least           # set overlap between runs
    threshold: 0.85
  - field: eligibility_decision
    under: [monotonic]
    relation: monotonic                  # may only move in this direction
    order: [eligible, ineligible]
run_policy: {samples: 20, configs: 1, confidence: 0.95}
gate: {max_decision_flip_rate: 0.10, max_malformed_rate: 0.05}
probes:
  - id: refund-basic
    input: "Customer bought a blender 12 days ago, unopened. Are they refund eligible?"
repeat_run

Repeat run

Nothing. The same input, asked again.

Catches: Run to run noise, drift over time, and malformed output.

irrelevant_context

Irrelevance

One unrelated sentence is added before or after the input.

Catches: A system swayed by text that has no bearing on the question.

reordering

Order

The sentences of the input are reordered.

Catches: A system that reads only the start, or stops at the question mark.

format

Format

Same words, different case, spacing and line breaks.

Catches: A brittle parser in front of the model.

monotonic

Monotonicity

A ladder of inputs along one quantity, such as days since purchase.

Catches: An answer that moves the wrong way as the quantity grows.

paraphrase

Paraphrase

A model proposes rewordings. Code accepts only the ones that keep every number.

Catches: A decision that depends on phrasing.

A perturbed answer is compared with the answer to the unperturbed input. If every variant is wrong in the same way, the variants agree with each other perfectly, and that must still count as a failure.

Point it at a system

Your system is any Python object with one method. It receives the probe text and returns JSON text carrying the fields your contract names.

# my_app/eval.py
import json

class RefundAgent:
    def run(self, probe_input: str, t: int, rng) -> str:
        answer = call_my_agent(probe_input)          # your LLM application
        return json.dumps({
            "eligibility_decision": answer.decision,
            "cited_policy_ids": answer.policies,
            "response_wording": answer.text,
        })

sut = RefundAgent()

To learn the instrument first, use the built-in simulators. Each one is a small program with one defect planted on purpose, so you can watch the instrument catch a defect you know is there. They are labelled simulator everywhere they appear, and nothing they produce is a measurement of a real system.

Every screenshot in this guide was recorded by one command against a fresh instance:

python scripts/seed_demo.py     # four contracts, four simulators, same seeds every time

Run it, then read the chart

Open the contract and launch runs. Each run is one point. The first eight set the baseline, and from the ninth on each point is judged against limits computed from that baseline. Choose the jump simulator and launch 12 runs twice: its flip rate jumps at run 12.

1. baseline: the first 8 runs set the limits. They are never judged.2. control limit: 3 sigma above the baseline mean. Frozen.baseline mean3. signal: a point beyond the limit. The process changed.run 0latest run
Illustration of the three things to read on a control chart. Shape only, not measured data.
Control charts for flip rate and malformed rate with a signal after the planted jump
A recorded run of the jump simulator. The chart is quiet through the baseline and signals at the planted onset.

The gold line is not a target you chose. It is where your own baseline says ordinary noise ends. The red dotted line is the tolerance you declared in the contract. They answer different questions: did the process change, and is it still good enough to ship.

Find which invariant broke

The invariant matrix shows the latest run cell by cell: probes down, changes to the input across. Zero means the answer held. A red cell names the exact condition under which your system stops being consistent.

Invariant matrix with one violated cell under the format perturbation
The format-sensitive simulator: consistent on repeat runs, broken by upper case and doubled spaces.

Look for the second mode

An average hides shape. A system can keep its decision field perfectly stable while one answer in ten reaches that decision by a different route. The mode view groups answers by their signature over the invariant fields and pools a window of runs, so a small mode that keeps coming back is reported with a confidence bound.

Mode topology showing a persistent second band and the pooled share with its Wilson bound
The bimodal simulator. The flip chart stays flat at zero. The mode view shows the second behaviour.

Gate the release

The same engine runs as one command. It exits 0 on pass, 1 on block, and 2 when the gate could not be evaluated, and writes a summary a reviewer can read on the pull request.

seismo gate --contract contracts/refund.yaml --sut my_app.eval:sut --points 12
# .github/workflows/seismograph.yml
on: [pull_request]
jobs:
  gate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: nuwansamaranayake/Seismograph@main
        with:
          contract: contracts/refund.yaml
          sut: my_app.eval:sut

If a model scores your answers, measure the scorer

A judge model is an instrument too. The Judge panel scores each judge against labelled anchor items, with an interval and a chance-corrected kappa. A judge that falls under the agreement floor, or drifts from its own baseline, is quarantined. Its vote is then excluded by name, and a panel left without a quorum returns no verdict.

Judge panel with two active judges and one quarantined below the agreement floor
Three simulated judges. One agreed with 60% of the anchors on its latest round and is quarantined.

Where you have labels, score against them

A contract can carry a golden set: items a person labelled. Golden sets shows the committed reports of those runs against a live model, with recall, false positives, a reliability diagram and agreement between two model versions. Each report states the one model build and the one set it describes.

Golden-set report with recall, cost, a scope note and a reliability diagram
A committed report of a real run: 130 labelled excerpts, five runs each, against one model build.

What it cannot see

Published limits · verbatim from EVAL.md · measured on synthetic systems

Seismograph detects an abrupt mean shift of 1 sigma or larger in the monitored statistic within a median of 5 monitored points (40 samples per point) at a false alarm rate of 0.017 per point, and it misses below that: a 0.5 sigma shift is caught about half the time (0.50, 95% CI 0.33-0.67) and a 0.25 sigma shift about two times in five (0.43, 95% CI 0.27-0.61).

Shipped
  • Contracts, the sampler, flip, malformed and overlap metrics
  • Six invariants, including monotonicity
  • X chart and p chart with frozen limits
  • Outcome modes with a pooled confidence bound
  • Judge calibration, quarantine and panel verdict
  • The CI gate and this dashboard
Planned, not built
  • Fault attribution under controlled replay
  • Scheduled production monitoring with re-baselining
  • Benchmarking across providers
  • An incident narrator grounded in verified statistics