Labs  ·  02

An AI analyst, graded on every answer.

AI can now answer business questions straight from a database. The hard part is knowing when to trust the answer. I gave an AI analyst ten questions about a payments company, ran each one five times, and graded every answer against a key. Here is every score, including the misses.

Every run is a recorded session of a real AI analyst (Claude Opus 5.5) querying a synthetic dataset for Tidepay, a fictional payments processor. No real payment data is involved.

Results

Passed every check
43of 50 answers
Right numbers, traced to its own queries
50of 50 answers
Model grader agreed with my grades
92%24 of 26 answers
Average cost per answer, grading included
10¢Claude Opus 5.5

The misses all look alike. In every failed run the numbers were right and traced to the analyst’s own queries. What failed was a supporting claim the data did not back, such as calling a gap universal when one group broke the pattern. That is the mistake a busy reader is least likely to catch, which is why the grading matters more than the demo.

The analyst

Pick a question and watch it work.

01 Tests: a basic rate, with retries counted once

“What was our approval rate in Q3?”

Passed 5 of 5 runs. Showing one of the passing runs.

Run 1 passed every check

  1. Analyst

    I will read the table notes first, then compute the Q3 2026 approval rate using the documented definition.

  2. Read the data notes

    Six tables and their definitions. See what it read.

  3. Analyst

    I need to group retries into payments, since approval rate counts each payment once. I will chain attempts on the same card, merchant and amount within 60 seconds.

  4. q1 · query failed

    Q3 2026 approval rate, counting each payment once, by month and total

    SQL
    WITH a AS (
      SELECT *, LAG(created_at) OVER (PARTITION BY card_id, merchant_id, amount ORDER BY created_at, transaction_id) AS prev_at,
             LAG(status) OVER (PARTITION BY card_id, merchant_id, amount ORDER BY created_at, transaction_id) AS prev_status
      FROM transactions
    ), b AS (
      SELECT *, CASE WHEN prev_at IS NOT NULL AND prev_status='declined'
         AND (julianday(created_at)-julianday(prev_at))*86400 <= 60 THEN 0 ELSE 1 END AS new_pay
      FROM a
    ), c AS (
      SELECT *, SUM(new_pay) OVER (PARTITION BY card_id, merchant_id, amount ORDER BY created_at, transaction_id) AS pay_seq FROM b
    ), p AS (
      SELECT card_id, merchant_id, amount, pay_seq, MIN(created_at) AS first_at,
             MAX(status='approved') AS approved, COUNT(*) AS attempts
      FROM c GROUP BY card_id, merchant_id, amount, pay_seq
    )
    SELECT COALESCE(substr(first_at,1,7),'Q3 total') AS period, COUNT(*) AS payments, SUM(approved) AS approved_payments,
      SUM(attempts) AS attempts,
      ROUND(100.0*SUM(approved)/COUNT(*),2) AS approval_rate_pct
    FROM p WHERE first_at >= '2026-07-01' AND first_at < '2026-10-01'
    GROUP BY substr(first_at,1,7) WITH ROLLUP

    near "WITH": syntax error

  5. q2 · 4 rows · 262 ms

    Q3 2026 approval rate, counting each payment once, by month and total

    SQL
    WITH a AS (
      SELECT *, LAG(created_at) OVER w AS prev_at, LAG(status) OVER w AS prev_status
      FROM transactions WINDOW w AS (PARTITION BY card_id, merchant_id, amount ORDER BY created_at, transaction_id)
    ), b AS (
      SELECT *, CASE WHEN prev_at IS NOT NULL AND prev_status='declined'
         AND (julianday(created_at)-julianday(prev_at))*86400 <= 60 THEN 0 ELSE 1 END AS new_pay
      FROM a
    ), c AS (
      SELECT *, SUM(new_pay) OVER (PARTITION BY card_id, merchant_id, amount ORDER BY created_at, transaction_id) AS pay_seq FROM b
    ), p AS (
      SELECT substr(MIN(created_at),1,7) AS m, MIN(created_at) AS first_at,
             MAX(status='approved') AS approved, COUNT(*) AS attempts, SUM(status='approved') AS appr_att
      FROM c GROUP BY card_id, merchant_id, amount, pay_seq
    ), q AS (SELECT * FROM p WHERE first_at >= '2026-07-01' AND first_at < '2026-10-01')
    SELECT m AS period, COUNT(*) AS payments, SUM(approved) AS approved_payments, SUM(attempts) AS attempts, SUM(appr_att) AS approved_attempts,
      ROUND(100.0*SUM(approved)/COUNT(*),2) AS approval_rate_pct, ROUND(100.0*SUM(appr_att)/SUM(attempts),2) AS attempt_rate_pct
    FROM q GROUP BY m
    UNION ALL
    SELECT 'Q3 total', COUNT(*), SUM(approved), SUM(attempts), SUM(appr_att),
      ROUND(100.0*SUM(approved)/COUNT(*),2), ROUND(100.0*SUM(appr_att)/SUM(attempts),2) FROM q
    periodpaymentsapproved_paymentsattemptsapproved_attemptsapproval_rate_pctattempt_rate_pct
    2026-07633358606566586092.5389.25
    2026-0863715925658959259389.92
    2026-09654360866775608693.0289.83
    Q3 total1924717871199301787192.8589.67
  6. Q3 2026 approval rate was 92.85%, steady across the three months
    1. Jul92.53
    2. Aug93
    3. Sep93.02
    4. Q3 total92.85

    Plotted from q2: approval_rate_pct by period

  7. Answer

    Q3 2026 approval rate (payments counted once)
    92.85%
    Q3 approved payments
    17,871
    Q3 total payments
    19,247
    Approval rate counting every attempt, for comparison
    89.67%

    Our approval rate in Q3 2026 (July to September) was 92.85%. That is 17,871 approved out of 19,247 payments, with each payment counted once even when it was retried. The rate held steady across the quarter: 92.53% in July, 93.00% in August and 93.02% in September. If you count every attempt, retries included, the rate drops to 89.67%, but company reporting counts each payment once.

    Assumptions

    • I treated an attempt as a retry if it used the same card at the same merchant for the same amount, within 60 seconds of a declined attempt. A payment counts as approved if any of its attempts was approved.
    • Each payment is placed in a month by the time of its first attempt, in UTC.
    • Q3 means July 1 to September 30, 2026, and includes all channels, merchants and countries.

    Caveats

    • The data has no payment ID, so I had to group retries using the rule above. A real new purchase made within 60 seconds of a decline, with the same card, merchant and amount, would be counted as a retry.

    Cites q2 and chart c1

Scorecard · run 1

  • Right answer: pass

    Matches the answer key.

  • Numbers come from its queries: pass

    Every headline number appears in a cited query result.

  • Chart backs the answer: pass

    Chart c1 plots q2, which holds the headline.

  • States its assumptions and limits: pass

    The answer says plainly that each payment was counted once even when retried, explains the retry grouping rule and its limits, and every figure matches the query results.

Recorded 2026-10-13 · cost $0.10 including grading

How this question is graded

Answer key

  • Q3 approval rate92.85% within 0.5 points

Rubric for the model grader

  • Says retried attempts were counted as one payment, or otherwise states how retries were handled.
Answer key SQL

Approval rate per payment

WITH attempts AS (
  SELECT t.*,
    CASE WHEN LAG(status) OVER w = 'declined'
          AND unixepoch(created_at) - unixepoch(LAG(created_at) OVER w) <= 60
         THEN 0 ELSE 1 END AS starts_payment
  FROM transactions t
  WINDOW w AS (PARTITION BY card_id, merchant_id, amount ORDER BY created_at)
),
numbered AS (
  SELECT *, SUM(starts_payment) OVER (PARTITION BY card_id, merchant_id, amount ORDER BY created_at ROWS UNBOUNDED PRECEDING) AS payment_no
  FROM attempts
),
payments AS (
  SELECT card_id, merchant_id, amount, payment_no,
    MIN(created_at) AS created_at,
    MAX(channel) AS channel,
    MAX(is_cross_border) AS is_cross_border,
    MAX(status = 'approved') AS approved,
    COUNT(*) AS attempts
  FROM numbered
  GROUP BY card_id, merchant_id, amount, payment_no
)
SELECT ROUND(100.0 * AVG(approved), 2) AS approval_rate_pct, COUNT(*) AS payments
FROM payments WHERE created_at >= '2026-07-01' AND created_at < '2026-10-01'

How it is graded

A grade is a fact here, not an opinion.

The dataset is generated from a fixed seed, with patterns and traps planted on purpose, so every question has a known answer. Code checks three things about each answer. A model grader with a written rubric checks the fourth, and I checked that grader against my own grades before trusting it.

  1. 01 · Code

    Right answer

    Headline numbers and names match the answer key within a published tolerance.

  2. 02 · Code

    Numbers come from its queries

    Every headline number appears in a query result the answer cites, so nothing is invented or worked out by hand.

  3. 03 · Code

    Chart backs the answer

    The chart plots a query the analyst ran, and it shows the figure the answer rests on.

  4. 04 · Model grader

    States its assumptions and limits

    The rubric for the question is met, and nothing in the answer is false or misleading against its own results.

Runs that passed each check, by question
QuestionPassedRight answerFrom its queriesChartAssumptions and limits
Approval rate5 of 55 of 55 of 55 of 55 of 5
Processed volume5 of 55 of 55 of 55 of 55 of 5
Cross border5 of 55 of 55 of 55 of 55 of 5
Decline spike3 of 55 of 55 of 55 of 53 of 5
Chargebacks by category5 of 55 of 55 of 55 of 55 of 5
September chargebacks3 of 5n/a5 of 55 of 53 of 5
Risk review5 of 55 of 55 of 55 of 55 of 5
3D Secure2 of 55 of 55 of 55 of 52 of 5
AI agents5 of 55 of 55 of 55 of 55 of 5
Profit margin5 of 55 of 55 of 55 of 55 of 5
All questions43 of 5045 of 4550 of 5050 of 5043 of 50

“Did chargebacks drop in September?” has no single right number, so it is graded on its rubric alone. That is why Right answer counts 45 answers, not 50.

  • Real pass rates, even below 100%. An analyst that is right 2 times in 5 on a question is a finding, not something to hide.
  • Every failed run is on the page, with the reason it failed.
  • The grader was checked first. I graded 26 answers by hand, and it agreed on 24. Three times it caught a mistake I had missed, and I corrected my grade.
  • The rubric and answer key SQL are published with every question, so anyone can check the grading.

The data

Nine months of payments at a company that does not exist.

Tidepay is a fictional processor with 120 merchants. The data runs from January to September 2026 and is generated from a fixed seed, so every run sees the same rows and every answer key can be recomputed. The analyst reads the notes below before it writes any SQL. They tell the truth about the data but never hand out an answer.

  1. 01

    Retries

    Declined payments are often retried within 60 seconds. Count every attempt and the approval rate looks 3 points worse than it is.

  2. 02

    Mixed currencies

    Amounts are stored in local currency. Add them up without converting and Q3 volume comes to 14.6 million instead of 1.57 million USD.

  3. 03

    Chargeback lag

    Cardholders dispute 20 to 75 days after buying, so the most recent month always looks cleaner than it is.

  4. 04

    A decline spike

    For one week in July, debit cards issued in Brazil were declined three times as often as usual, mostly as do not honor.

  5. 05

    A risky cohort

    Ten digital goods merchants that joined in Q2 carry most fraud chargebacks, and none of them ever used 3D Secure.

  6. 06

    A missing column

    The data holds fees but no costs, so profit margin cannot be computed. The right answer says so.

merchants120 rowsBusinesses that take payments through Tidepay.
merchant_id
Merchant ID.
name
Trading name.
category
retail, travel, digital_goods, food_delivery, subscriptions, electronics or marketplace.
country
Two letter country code where the merchant is based.
currency
Currency the merchant is paid in. All its transactions use this currency.
onboarded_at
Date the merchant joined Tidepay (YYYY-MM-DD).
risk_tier
low, medium or high, set at onboarding and not updated since.
cards30,000 rowsPayment cards used at merchants. No card numbers are stored.
card_id
Card ID.
brand
visa, mastercard, amex or discover.
card_type
credit, debit or prepaid.
issuer_country
Two letter country code of the bank that issued the card.
transactions52,237 rowsOne row per authorization attempt. When an attempt is declined, the merchant may retry the same card for the same amount within 60 seconds, and each retry is its own row. Company reporting counts a payment once: a payment is approved if any of its attempts was approved.
transaction_id
Attempt ID.
created_at
Time of the attempt in UTC, ISO 8601 (YYYY-MM-DDTHH:MM:SSZ).
merchant_id
References merchants.merchant_id.
card_id
References cards.card_id.
amount
Amount in the merchant's local currency, not USD. Convert with fx_rates.
currency
Currency of amount.
channel
online, in_store or ai_agent (a purchase made by an AI agent for a customer).
status
approved or declined.
decline_code
Reason given by the issuer for a decline: insufficient_funds, do_not_honor, suspected_fraud, expired_card or invalid_cvv. Null when approved.
is_cross_border
1 when the card was issued in a different country from the merchant, else 0.
used_3ds
1 when the customer completed 3D Secure authentication. Only possible for online and ai_agent payments.
fee
What Tidepay charged the merchant, in local currency. 0 for declined attempts. This is revenue only; Tidepay's own costs are not in this data.
chargebacks429 rowsDisputes raised by cardholders. Cardholders usually dispute 20 to 75 days after the purchase, so recent purchases have had less time to collect chargebacks. Data includes chargebacks opened up to 2026-09-30.
chargeback_id
Chargeback ID.
transaction_id
The approved transaction being disputed.
reason
fraud, not_received or not_as_described.
amount
Disputed amount in the local currency of the transaction.
opened_at
Date the dispute was opened (YYYY-MM-DD).
outcome
won (the merchant kept the money), lost or pending.
refunds1,169 rowsRefunds merchants issued on approved transactions.
refund_id
Refund ID.
transaction_id
The refunded transaction.
amount
Refunded amount in the local currency of the transaction.
created_at
Date of the refund (YYYY-MM-DD).
fx_rates1,911 rowsDaily exchange rates. One row per currency per day, including USD at 1.0.
date
Date (YYYY-MM-DD).
currency
Currency code.
rate_to_usd
USD value of one unit of the currency on that date. amount * rate_to_usd = USD.

Definitions the analyst is given

  • Processed volume means the USD value of approved payments, before refunds and chargebacks.
  • Approval rate means approved payments divided by all payments, counting each payment once (see transactions).
  • Chargeback rate means chargebacks divided by approved payments, by the date of the purchase.

Work with me

Put an analyst like this on your data.

I help payments and fintech teams put AI to work on their own data, with the answer keys and grading that tell them when to trust it.