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
- Generated rings with labels; a catalog with a type-tag audit
- Confidence sorts right answers from wrong ones
- A threshold chosen on the answers it is judged on looks better than it is
- Answers about one ring are not independent observations
- The catalog: what a review policy would cost
- What this does not show
- How the pipeline stores and selects work
- Reusing the workflow
- 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

- 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

- 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
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
Querychapters/11-model-answers/pipeline/20_model.sqlShow SQL
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
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
| Model · Question | Metal color | Diamond shape | Stone count | Hallmark stamp | Natural or lab-grown |
|---|---|---|---|---|---|
| Baseten Bison 1 | 100%n = 28 | 92%n = 24 | 100%n = 27 | 100%n = 27 | 100%n = 28 |
| Baseten Groundhog 1 | 100%n = 28 | 88%n = 24 | 96%n = 27 | 100%n = 27 | 100%n = 28 |
| Gemini Decision 1 | 100%n = 28 | 100%n = 24 | 100%n = 27 | 100%n = 27 | 100%n = 28 |
| Liquid d1.2 | 100%n = 28 | 92%n = 24 | 93%n = 27 | 96%n = 27 | 100%n = 28 |
| Liquid d1.2 Ultra | 100%n = 28 | 79%n = 24 | 100%n = 27 | 89%n = 27 | 100%n = 28 |
| Modaic Mo | 100%n = 28 | 79%n = 24 | 85%n = 27 | 89%n = 27 | 100%n = 28 |
| Nace Drex Max 1.2 | 100%n = 28 | 88%n = 24 | 96%n = 27 | 100%n = 27 | 100%n = 28 |
| Perplexity Decider Flash 1.3 | 100%n = 28 | 92%n = 24 | 100%n = 27 | 96%n = 27 | 100%n = 28 |
| Perplexity Decider 1.3 | 100%n = 28 | 96%n = 24 | 89%n = 27 | 93%n = 27 | 100%n = 28 |
| Typesafe Jev 1.14 | 100%n = 28 | 79%n = 24 | 96%n = 27 | 89%n = 27 | 100%n = 28 |
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 color | 0.00 | 0.0% | 0.0% | 0% | 0% |
| Diamond shape | 0.80 | 0.0% | 3.3% | 35% | 25% |
| Stone count | 0.80 | 0.9% | 0.0% | 18% | 7% |
| Hallmark stamp | 0.65 | 1.6% | 1.6% | 2% | 10% |
| Natural or lab-grown | 0.00 | 0.0% | 0.0% | 0% | 0% |
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
| Style | 49% |
|---|---|
| Main stone | 28% |
| Plain background | 10% |
| Type | 8% |
| Metal color | 7% |
| Has text or logo | 2% |
| Worn by a person | 1% |
| Is jewelry | 0% |
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
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

Tagged pendant, 0.48
0 of 9 other models agree; most said necklace
A necklace with a large pendant; either tag fits.

Tagged brooch, 0.58
8 of 9 other models agree
A single drop: an earring or a brooch.

Tagged pendant, 0.60
4 of 9 other models agree; most said necklace
A necklace with a large pendant; either tag fits.

Tagged earrings, 0.63
5 of 9 other models agree
A single climbing piece: an earring or a hair ornament.

Tagged bracelet, 0.66
7 of 9 other models agree
An open cuff: a ring or a bracelet, with nothing to show scale.

Tagged pendant, 0.82
8 of 9 other models agree
A necklace with a large pendant, worn; either tag fits.

Tagged ring, 0.83
8 of 9 other models agree
An open cuff: a ring or a bracelet, with nothing to show scale.
The review queue: catalog images with at least one answer below 0.7
| g-1728075576687-459 | earrings | Main stone | diamond | 0.27 | 33% | 1 | agrees |
| g-1728861026012-459 | earrings | Main stone | diamond | 0.28 | 56% | 1 | agrees |
| g-1738137043601-437 | earrings | Main stone | multi | 0.37 | 67% | 1 | agrees |
| 1475410b-3109-4e9b-881d-d35347422d15 | earrings | Main stone | ruby | 0.38 | 22% | 2 | agrees |
| 15637db3-ec4e-4054-9f9a-a6f43c2e194b | necklace | Style | statement | 0.40 | 0% | 1 | agrees |
| g-1728343914943-400 | earrings | Main stone | multi | 0.41 | 22% | 2 | agrees |
| g-1728622596422-437 | earrings | Main stone | pink | 0.41 | 44% | 1 | agrees |
| 0b44d152-fae8-4383-9e02-325981e87552 | pendant | Main stone | pink | 0.42 | 0% | 3 | judgment call |
| 03ce5c86-c17c-448a-b711-396efe14258d | ring | Type | ring | 0.42 | 100% | 2 | agrees |
| 0917936f-afd3-4bf7-9144-7b1e36d5e333 | earrings | Main stone | pearl | 0.42 | 78% | 3 | agrees |
| g-1728104958553-233 | pendant | Main stone | multi | 0.43 | 0% | 2 | judgment call |
| 10ba19f4-2f3b-4303-bb64-3514c8164994 | earrings | Style | classic | 0.44 | 56% | 1 | agrees |
What this does not show
How the pipeline stores and selects work
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_blobfetches each file andsha256hashes 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
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_namelets a later run add fields without breaking older files, and the answers load as aMAPso 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
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
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
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 changed | 0 | $0.0000 |
| Add another model for the catalog | 182 | $0.0323 |
| Reword the catalog style question | 1,820 | $0.1361 |
| Resize catalog images to 768 px | 1,820 | $0.1361 |
Reusing the workflow
Treat model output as versioned, probabilistic data.
- Key each answer by the hash of the input bytes, the model, and a version of every question and preprocessing step.
- Keep the full distribution over options, not only the chosen label.
- Select work with an anti join against stored answers, so unchanged inputs are never sent twice and changed ones never overwrite old answers.
- Choose the acceptance threshold on labelled data held apart from the data used to report it.
- Resample at the level of the input when many answers describe one item.
- Publish only the answers that cleared the threshold and the review status of the rest.
A template for step 3, for any enrichment endpoint:
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
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_KEYThe first run reads all images to hash them (112 MB); later runs reuse the hashes unless REHASH=1. Full pipeline: the pipeline folder.