TTB Label Verification
Checks alcohol-label photos against COLA application data. The model perceives; the code judges.
TTB Label Verification in offline mock mode. Two sample labels checked against applications.csv: 01-bourbon-clean.png is all match, and 07-warning-wrong-word.png has one issue.
The problem
A compliance agent comparing an alcohol label to its COLA application needs to see, in a few seconds, which fields match, which do not, and which need a second look. This is a standalone proof of concept. It does not integrate with the legacy COLA system.
What we built
A browser app checks a label image against the values on the application. The vision model only transcribes what is on the label. Deterministic code decides the verdict. The model never sees the expected values, so it cannot talk itself into a match.
Providers are OpenAI gpt-4o, Anthropic, any OpenAI-compatible local vision model, or an offline mock that needs no API key. Zod validates the request and the model's response. A Netlify function is the only API.
Stack
Notable engineering
-
The model perceives, the code judges
extractLabel() is the only outbound call. verifyLabel() is a pure function. Brand, class, and producer names tolerate case and punctuation. ABV and net contents are unit-aware. A proof-only statement is flagged rather than quietly converted to a percent.
-
The government warning is exact
That field is a word-level diff against the statutory text, plus capitalization and bold checks. Close enough is a violation there.
-
Images are prepared in the browser
Before anything is uploaded, the page fixes EXIF orientation, downscales, and re-encodes as JPEG.
-
Low confidence does not pass
A low-confidence read, or a warning whose formatting could not be determined, becomes needs-review instead of a match.
-
Sixty-five tests
Node's built-in test runner covers the comparison logic, including every government-warning failure mode, plus the rate limiter. No network and no API key.
What the measurements said
On a 13-label batch against gpt-4o, at the app's default concurrency of 5, the mean was 2.85 seconds, the median 2.6 seconds, and 12 of 13 labels finished under 5 seconds. The slowest was 5.6 seconds.
The same run caught every wording violation and the missing-warning case, and missed two of the four typography violations: a title-case warning prefix, and a warning body set in bold. Typography is the weak spot. The app treats it as needs-review rather than an automatic denial, and the original photo stays next to the result.
The hosted demo runs real gpt-4o extraction and only accepts traffic from the United States. Locally, with no API key, it stays in offline mock mode.