Part IV — Business workflows · Chapter 13

A catalog that knows what needs review

Model answers stored as data

Decision models tag jewelry images with a probability for every option. Stored as rows in DuckDB, those probabilities pick out answers worth a second look, but a threshold tuned on half of 28 labelled images missed its error target on the other half. The output is a review queue, not an accuracy claim.

On this page
  1. Generated rings with labels; a catalog with a type-tag audit
  2. Confidence sorts right answers from wrong ones
  3. A threshold chosen on the answers it is judged on looks better than it is
  4. Answers about one ring are not independent observations
  5. The catalog: what a review policy would cost
  6. What this does not show
  7. How the pipeline stores and selects work
  8. Reusing the workflow
  9. Run it yourself

Ten decision models each answered 5 questions about 28 generated ring images, and every answer came with a probability for each option. On the hardest question, the cut of the center diamond, 12% of the answers were wrong. Accepting only the answers a model gave a probability of at least 0.8 brought the error among accepted answers to 1.8% and sent 30% of the answers to a person.

That number flatters the method, and the chapter's turning point is why. The 0.8 threshold was picked after seeing every label. Chosen on half the rings and applied to the other half, the shape threshold missed its error target. With only 28 labelled images, a threshold is a starting policy to revise, not a guarantee.

Before the evaluation, here is what one answer looks like. A shop's catalog image goes to a decision model with a fixed question and a list of allowed answers; the model returns one option and a probability for each. The chapter's catalog policy accepts an answer at 0.7 or more and sends the rest to a person. The two images below are teaching examples chosen from the seven type tags the reviewer questioned, not a sample: in the first, low confidence and disagreement point at a real ambiguity in the categories; in the second, a confident answer that most models share clears the threshold although the reviewer finds it just as ambiguous.

One question, one stored answer, one policy decision

  • Catalog image g-1728104936684-233. A necklace with a large pendant; either tag fits.
    Question
    “What kind of jewelry is the main piece?”
    Answer
    pendant, model confidence 0.48
    Other models
    0 of 9 chose pendant; most said necklace
    Reviewer
    A necklace with a large pendant; either tag fits.
    Policy at 0.7
    Sent to review
  • Catalog image g-1729282732047-250. An open cuff: a ring or a bracelet, with nothing to show scale.
    Question
    “What kind of jewelry is the main piece?”
    Answer
    ring, model confidence 0.83
    Other models
    8 of 9 chose ring
    Reviewer
    An open cuff: a ring or a bracelet, with nothing to show scale.
    Policy at 0.7
    Accepted automatically, not checked by a person
Gemini Decision 1's answer to the catalog type question, its probability for that option, how many of the other nine models chose the same type, and the reviewer's note. Accepted means the answer cleared the threshold, not that a person verified it.SourceCatalog images, AI Gateway decision-model responses of 27 November and 3 December 2026, reviewer's type check

A decision model answers a fixed question about an input and returns a typed answer, here one option from a list, with a probability for every option. It does not write prose. That makes its output a column a pipeline can store, version and check like any other measurement. This chapter keeps those answers in DuckDB keyed by the image's hash and the question's wording, so that a rerun pays only for inputs or questions that changed. It then asks three questions in order: does confidence separate right answers from wrong ones where we have labels; does a threshold chosen on some images hold on others; and what would a review policy cost on a catalog where most fields have no labels at all.

Sending the least confident answers to review cuts the error on diamond shape most, at the highest review cost

Error rate among accepted answers against the share sent to review, as the acceptance threshold rises from 0 to 0.99 along each line. Ten decision models' answers pooled; 240 labelled answers for shape, 270 for count and 270 for stamp. Bands are 95% intervals from 1,000 resamples of the images. Metal color and natural-or-lab-grown are not drawn: every model answered every image correctly on both. The rings are generated images, not product photographs.SourceAI Gateway decision-model responses recorded 29 November 2026; hand labels of 28 generated ring images
Querychapters/11-model-answers/pipeline/20_model.sqlShow SQL
20_model.sqlSQL
SELECT question, t, count(*) AS answers,
       1 - count(*) FILTER (confidence >= t) / count(*) AS review_share,
       count(*) FILTER (confidence >= t AND NOT correct)
         / nullif(count(*) FILTER (confidence >= t), 0) AS error_accepted
FROM ring_scored, thresholds
GROUP BY ALL;

70 question-threshold rowsRuns at build time in DuckDB 2.0; shown for reading.Open file

Generated rings with labels; a catalog with a type-tag audit

There are two sets. The ring set has 28 images made by image models from prompts that asked for a metal color, a diamond cut, a number of stones and a hallmark stamp. A person looked at each image and recorded what is visible, which is not always what the prompt asked for, and left a label blank where the feature cannot be seen. Ten decision models answered 5 questions per image: metal color, cut of the center diamond, number of stones, the hallmark stamp and whether the diamond is natural or lab-grown. The last has one right answer from a photograph, "cannot be told", which is an option in the list.

The catalog set has 182 distinct jewelry images from a shop's image bucket, after near-duplicate copies were dropped. Gemini Decision 1 answered 9 questions about each on 27 November: type, metal color, main stone, style, formality and four yes-or-no questions about the photo. Formality is a score on a four-step scale, from everyday to wedding or gala, rather than a choice among options, so it carries no probability and is left out of every confidence count below. The other nine models answered the same questions on 3 December. A person checked every type tag against its image and marked the ones a reviewer would argue with. Nothing else in the catalog has a label, so for metal, stone and style the chapter can count how many answers fall below the threshold but cannot say how many are wrong.

Confidence sorts right answers from wrong ones

Across the 1,340 labelled ring answers, answers given less than 0.5 were right 46% of the time and answers given 0.99 or more were right 99.8% of the time. Ranking errors and stating honest probabilities are different properties. These answers rank well, but their probabilities are not calibrated: answers given 0.8 to 0.9 averaged 86% confidence and were right 98% of the time. What makes a threshold useful is the ranking, not the gap: wrong answers sit mostly at lower confidence than right ones, so most of them fall below 0.8, where little would be lost by sending all of them to a person. The gap between stated and observed accuracy is miscalibration, which a threshold chosen on labelled data works around rather than relies on.

Answers given more confidence were right more often

Share of answers that matched the hand label, by confidence band, against the band's average confidence. Bands: below 0.5, 0.5 to 0.7, 0.7 to 0.8, 0.8 to 0.9, 0.9 to 0.95, 0.95 to 0.99 and 0.99 or more; the lowest band has 24 answers and the highest 520. A calibrated model's answers would be right as often as their confidence says. Bars are 95% intervals from resampling images.SourceTen decision models, 28 generated ring images, 5 questions

The models differ most on the diamond's cut. Gemini Decision 1 answered every labelled question correctly, at the highest price per request in the run. On 28 generated images that is no evidence of zero error on real product photos; on shape, the other nine ranged from 79% to 100% correct. Requests cost from $0.00001 to $0.00016 per image.

Every model got metal color and the natural-or-lab question right; diamond shape split them

Accuracy of ten decision models on 5 questions about 28 generated ring images. An em dash means missing or suppressed.
Model · Question Metal colorDiamond shapeStone countHallmark stampNatural or lab-grown
Baseten Bison 1100%n = 2892%n = 24100%n = 27100%n = 27100%n = 28
Baseten Groundhog 1100%n = 2888%n = 2496%n = 27100%n = 27100%n = 28
Gemini Decision 1100%n = 28100%n = 24100%n = 27100%n = 27100%n = 28
Liquid d1.2100%n = 2892%n = 2493%n = 2796%n = 27100%n = 28
Liquid d1.2 Ultra100%n = 2879%n = 24100%n = 2789%n = 27100%n = 28
Modaic Mo100%n = 2879%n = 2485%n = 2789%n = 27100%n = 28
Nace Drex Max 1.2100%n = 2888%n = 2496%n = 27100%n = 27100%n = 28
Perplexity Decider Flash 1.3100%n = 2892%n = 24100%n = 2796%n = 27100%n = 28
Perplexity Decider 1.3100%n = 2896%n = 2489%n = 2793%n = 27100%n = 28
Typesafe Jev 1.14100%n = 2879%n = 2496%n = 2789%n = 27100%n = 28
70%100%— missing or suppressed
Share of labelled answers that matched the hand label, by model and question; 28 images per cell, fewer where a label is blank.SourceAI Gateway decision-model responses recorded 29 November 2026

A threshold chosen on the answers it is judged on looks better than it is

The hero figure picks a threshold after seeing every label. To see what that costs, the pipeline splits the ring images in half by hash, picks for each question the lowest threshold that keeps the error among accepted answers at or below 2% on the first 14 images, and applies it to the other 14. For shape, 0.8 had no errors on the first half; on the second half 3 of 90 accepted answers were wrong, 3.3%, above the target. For stamp the chosen threshold held, at 1.6%. With 14 images on each side, one hard ring moves these rates by several points.

The shape threshold missed its target on the held-out images

Metal color0.000.0%0.0%0%0%
Diamond shape0.800.0%3.3%35%25%
Stone count0.800.9%0.0%18%7%
Hallmark stamp0.651.6%1.6%2%10%
Natural or lab-grown0.000.0%0.0%0%0%
5 rows
Threshold chosen on one half of the ring images as the lowest that keeps accepted-answer error at or below 2%, then applied to the other half. Answers are pooled over the ten models.SourceTen decision models, 28 generated ring images split in half by hash

Answers about one ring are not independent observations

Each ring was answered 10 times per question, and a ring that fools one model tends to fool others. Treating the 240 shape answers as independent gives a standard error of 2.1 points on the accuracy; resampling images gives 3.4 points. The variance ratio, the design effect, is 2.8 for shape, 2.6 for stamp and 1.8 for count: the answers carry about as much information as a third to a half as many independent ones would.

The catalog: what a review policy would cost

At the 0.7 threshold, 192 of Gemini Decision 1's 1,456 scored catalog answers would go to review, spread over 133 of the 182 images. At an assumed 10 seconds per answer, that is about 32 minutes of a person's time, against $0.032 in model fees for the whole catalog. Style accounts for 90 of those answers: the model put 49% of the images below the threshold. That could mean the six style options overlap, that the question is worded loosely, or that style is hard to read from a photo; this data alone cannot tell those apart.

Answers are also the wrong unit of work. A reviewer opens an image, not an answer, and settles every flagged field at once. If a review takes 20 to 60 seconds per image, the same 133 images take 44 to 133 minutes. Both figures rest on assumed times; a timed review of a few dozen images would replace them.

Half the style answers fell below the threshold, against one in twelve type answers

0%10%20%30%40%50%Answers below 0.7 confidence (%)Style: 49%Style49%Main stone: 28%Main stone28%Plain background: 10%Plain background10%Type: 8%Type8%Metal color: 7%Metal color7%Has text or logo: 2%Has text or logo2%Worn by a person: 1%Worn by a person1%Is jewelry: 0%Is jewelry0%
Share of catalog answers below 0.7 confidence by question, 182 images, Gemini Decision 1
Style49%
Main stone28%
Plain background10%
Type8%
Metal color7%
Has text or logo2%
Worn by a person1%
Is jewelry0%
Share of the 182 catalog images whose answer from Gemini Decision 1 had confidence below 0.7, by question. Formality is a score with no probability and is not included. Only the type answers were checked by a person.SourceAI Gateway decision-model responses recorded 27 November 2026

Without labels, the chapter cannot say how many of the catalog's metal, stone and style answers are wrong. It can ask the other nine models. The store already had their answers on the rings, so adding them for the catalog cost 1638 new requests and $0.104, and the anti join sent nothing twice. On the rings, where the answer is known, the option most of the other nine chose matched the hand label for 94% of shape answers and 98% of stamp answers, more often than a single model did (88% and 95%). Agreement is not correctness, since models can share a mistake, but on these images the majority was the better guess.

On the catalog there is no label to check against, so agreement can only show where the models disagree, not who is right. When a model gave an answer 0.99 or more, the other nine agreed with it 100% of the time on style; between 0.5 and 0.7, 68%. Type, metal and stone follow the same order.

The less sure a model was, the less the other nine agreed with it

Share of the other nine models choosing the same option, by the answering model's confidence band, pooled over all ten models and the 182 catalog images. Bands as in the calibration figure. Agreement is a disagreement diagnostic, not an accuracy estimate: models trained on similar data can share a mistake. On the labelled rings the two moved together, which is suggestive, not proof, for the catalog.SourceAI Gateway decision-model responses, 10 models, recorded 27 November and 3 December 2026

The type check gives one test of whether low confidence and disagreement flag the cases a person would question. The reviewer agreed with 175 of Gemini Decision 1's type tags and marked 7 as judgment calls. The 15 tags below 0.7 included 5 of those 7; catching all of them would have taken a threshold of 0.85 and 45 reviews. The other nine models agreed with the undisputed tags 98% of the time and with the disputed ones 63%.

The seven type tags a reviewer would argue with

  • Catalog image g-1728104936684-233. A necklace with a large pendant; either tag fits.

    Tagged pendant, 0.48

    0 of 9 other models agree; most said necklace

    A necklace with a large pendant; either tag fits.

  • Catalog image g-1749580598769-241. A single drop: an earring or a brooch.

    Tagged brooch, 0.58

    8 of 9 other models agree

    A single drop: an earring or a brooch.

  • Catalog image 0b44d152-fae8-4383-9e02-325981e87552. A necklace with a large pendant; either tag fits.

    Tagged pendant, 0.60

    4 of 9 other models agree; most said necklace

    A necklace with a large pendant; either tag fits.

  • Catalog image g-1748405905902-146. A single climbing piece: an earring or a hair ornament.

    Tagged earrings, 0.63

    5 of 9 other models agree

    A single climbing piece: an earring or a hair ornament.

  • Catalog image g-1728620948911-250. An open cuff: a ring or a bracelet, with nothing to show scale.

    Tagged bracelet, 0.66

    7 of 9 other models agree

    An open cuff: a ring or a bracelet, with nothing to show scale.

  • Catalog image g-1728104958553-233. A necklace with a large pendant, worn; either tag fits.

    Tagged pendant, 0.82

    8 of 9 other models agree

    A necklace with a large pendant, worn; either tag fits.

  • Catalog image g-1729282732047-250. An open cuff: a ring or a bracelet, with nothing to show scale.

    Tagged ring, 0.83

    8 of 9 other models agree

    An open cuff: a ring or a bracelet, with nothing to show scale.

Gemini Decision 1's type tag and its confidence, how many of the nine other models chose the same type, and the reviewer's note. Sorted by confidence.SourceCatalog images, AI Gateway decision-model responses, reviewer's type check of 27 November 2026

The review queue: catalog images with at least one answer below 0.7

g-1728075576687-459earringsMain stonediamond0.2733%1agrees
g-1728861026012-459earringsMain stonediamond0.2856%1agrees
g-1738137043601-437earringsMain stonemulti0.3767%1agrees
1475410b-3109-4e9b-881d-d35347422d15earringsMain stoneruby0.3822%2agrees
15637db3-ec4e-4054-9f9a-a6f43c2e194bnecklaceStylestatement0.400%1agrees
g-1728343914943-400earringsMain stonemulti0.4122%2agrees
g-1728622596422-437earringsMain stonepink0.4144%1agrees
0b44d152-fae8-4383-9e02-325981e87552pendantMain stonepink0.420%3judgment call
03ce5c86-c17c-448a-b711-396efe14258dringTypering0.42100%2agrees
0917936f-afd3-4bf7-9144-7b1e36d5e333earringsMain stonepearl0.4278%3agrees
g-1728104958553-233pendantMain stonemulti0.430%2judgment call
10ba19f4-2f3b-4303-bb64-3514c8164994earringsStyleclassic0.4456%1agrees
12 of 133 rows
133 images, sorted by Gemini Decision 1's least confident answer. "Others agree" is the share of the other nine models that gave the same answer to that question. "Type check" is the reviewer's verdict on the type tag. Three states are kept apart: answers at 0.7 or more are accepted automatically, answers below wait for review, and only the type tags have a recorded human judgment.Sourcepipeline/20_model.sql, review_queue

What this does not show

How the pipeline stores and selects work

  1. Hash every image where it lives

    The answers belong to the bytes a model saw, so the image's identity is the hash of those bytes, not its file name. read_blob fetches each file and sha256 hashes the content.

    10_inventory.sqlSQL
    SET VARIABLE image_urls = (SELECT list(url ORDER BY url) FROM images);
    
    CREATE OR REPLACE TABLE inventory AS
    SELECT i."set", i.image_id, i.url, b.size AS bytes, sha256(b.content) AS input_sha256
    FROM images i
    JOIN read_blob(getvariable('image_urls')) b ON b.filename = i.url;

    210 images, 112 MB over HTTPS, cached in out/inventory.parquetchapters/11-model-answers/pipeline/10_inventory.sql

  2. Read the response store

    Each request is one JSON line: the image hash, the model, how the image was prepared, the version of every question asked, the cost and the raw answers. union_by_name lets a later run add fields without breaking older files, and the answers load as a MAP so each set can have different questions.

    00_sources.sqlSQL
    CREATE OR REPLACE VIEW responses AS
    FROM read_json('chapters/11-model-answers/pipeline/responses/*.ndjson',
                   format = 'newline_delimited', union_by_name = true,
                   columns = {request_id: 'VARCHAR', "set": 'VARCHAR', image_id: 'VARCHAR',
                              input_sha256: 'VARCHAR', image_prep: 'VARCHAR', model: 'VARCHAR',
                              question_versions: 'MAP(VARCHAR, VARCHAR)', cost_usd: 'DOUBLE',
                              answers: 'MAP(VARCHAR, JSON)'});

    2100 requests in two fileschapters/11-model-answers/pipeline/00_sources.sql

  3. One row per answer, with its confidence

    Unnesting the map gives one row per question. The confidence of a choice is the probability of the option chosen; the runner-up probability is kept for a margin.

    20_model.sqlSQL
    SELECT r.request_id, r.model, e.key AS question,
           r.question_versions[e.key] AS question_version,
           e.value ->> 'choice' AS choice,
           (e.value -> 'probabilities')::MAP(VARCHAR, DOUBLE) AS probabilities,
           list_max(map_values(probabilities)) AS confidence
    FROM responses r, unnest(map_entries(r.answers)) AS t(e);

    17,780 answerschapters/11-model-answers/pipeline/20_model.sql

  4. Find what still needs asking

    A request is needed when no stored response matches the image's current hash, the model and a version of the request built from the image preparation and every question's version. The anti join is the whole cache.

    30_work.sqlSQL
    SELECT i."set", i.image_id, i.url, i.input_sha256, p.model
    FROM inventory i
    JOIN plan p USING ("set")
    JOIN question_sets s USING ("set")
    ANTI JOIN stored_requests r
      ON r."set" = i."set" AND r.input_sha256 = i.input_sha256 AND r.model = p.model
     AND r.request_version = request_version(s.image_prep, s.versions);

    0 requests for the current planchapters/11-model-answers/pipeline/30_work.sql

  5. Resample images, not answers

    The ten models' answers about one ring share whatever makes that ring hard, so intervals come from drawing whole images with replacement. hash(b, k) makes the draws repeatable without a random seed; each draw becomes a weight per image.

    20_model.sqlSQL
    WITH imgs AS (SELECT image_id, row_number() OVER (ORDER BY input_sha256) - 1 AS i
                  FROM inventory WHERE "set" = 'rings'),
         draws AS (SELECT b, hash(b, k) % 28 AS i
                   FROM range(1, 1001) AS t(b), range(28) AS u(k))
    SELECT b, image_id, count(*) AS w FROM draws JOIN imgs USING (i) GROUP BY ALL;

    1,000 resamples of the 28 ring imageschapters/11-model-answers/pipeline/20_model.sql

The question's version is a hash of everything the model sees about it: the instruction, the type and the allowed options. Editing the wording or adding an option makes a new version, and the old answers stay in the store under the old one. Because one request asks every question of a set, rewording one question sends every catalog image to every model again, ten times the requests of adding one more model.

Only a change to the image, the model or the questions creates new requests

Rerun with nothing changed0$0.0000
Add another model for the catalog182$0.0323
Reword the catalog style question1,820$0.1361
Resize catalog images to 768 px1,820$0.1361
4 rows
Pending requests under four plans, each priced at its model's average cost per catalog request; a model with no history at Gemini Decision 1's $0.00018. Each plan copies the stored plan or question definitions and changes one thing.Sourcepipeline/30_work.sql over the response store

Reusing the workflow

Treat model output as versioned, probabilistic data.

  1. Key each answer by the hash of the input bytes, the model, and a version of every question and preprocessing step.
  2. Keep the full distribution over options, not only the chosen label.
  3. Select work with an anti join against stored answers, so unchanged inputs are never sent twice and changed ones never overwrite old answers.
  4. Choose the acceptance threshold on labelled data held apart from the data used to report it.
  5. Resample at the level of the input when many answers describe one item.
  6. Publish only the answers that cleared the threshold and the review status of the rest.

A template for step 3, for any enrichment endpoint:

SQL
SELECT i.item_id, i.input_hash, p.model, q.version
FROM items i
CROSS JOIN plan p
CROSS JOIN question_version q
ANTI JOIN stored_answers s
  ON s.input_hash = i.input_hash AND s.model = p.model AND s.question_version = q.version;

Run it yourself

Shell
bash chapters/11-model-answers/pipeline/run.sh                     # seconds; no model calls
python chapters/11-model-answers/pipeline/40_ask.py                # what a rerun would ask
python chapters/11-model-answers/pipeline/40_ask.py --send --limit 200   # paid, needs AI_GATEWAY_API_KEY

The first run reads all images to hash them (112 MB); later runs reuse the hashes unless REHASH=1. Full pipeline: the pipeline folder.