Inspiration
A container ship catches fire about every 17 days, and misdeclared dangerous goods are a leading cause. The paperwork said "coconut pellets"; the box held charcoal. Checking a manifest means two hard things: knowing what "pool chlorine tablets" really is (calcium hypochlorite, Class 5.1), and knowing which cargoes may not share a container. On the external DGEval benchmark, the best of 13 frontier models scored only about $50\%$ on stowage questions. So we asked: what if the AI only reads, and the regulation decides?
What it does
Drop in a packing list or invoice (PDF, Excel or CSV). StowCheck:
- extracts the cargo lines for you to review,
- identifies each line against the 49 CFR 172.101 Hazardous Materials Table,
- checks every pair in a shared container against the 176.83 segregation table and 176.84 stowage codes, citing the rule for each finding,
- gives each container a decision: Re-stuff, Hold or Load,
- flags typed UN numbers that don't match their description,
- sends unsure lines to a person, and never calls anything unsure "safe",
- prints a one-page stowage report with a sign-off line.
How we built it
The AI does the language work; deterministic code applies the law.
- AI reads the description and writes regulatory search terms.
- Code retrieves candidate rows from the 3,001-row table with BM25.
- AI picks a real row or abstains. It cannot invent a UN number.
- Code checks all $\binom{n}{2}$ pairs per container, so for $n$ lines it runs $\frac{n(n-1)}{2}$ rule lookups, each with a citation.
Stack: FastAPI on Vercel, vanilla JS, pdf.js and SheetJS in the browser, gpt-oss-120b on Groq (free tier) for the demo, and Gemma 4 on the Gemini API (free tier) for evaluation.
Results
Each free model was tested alone and inside StowCheck:
| Test | gpt-oss alone | Gemma 4 alone | StowCheck |
|---|---|---|---|
| Held-out, right UN number (run once) | $9/24$ | $15/24$ | $21/24$ with both |
| Dangerous cargo called safe (dev set) | 4 | 2 | 0 |
| Unsafe answers, 100 segregation pairs | n/a | 24 | 0 |
| Real ship-fire declarations caught | $5/7$ | $4/7$ | $4/7$ |
Held-out accuracy went from $37.5\%$ and $62.5\%$ to $87.5\%$.
Challenges we ran into
- Free-tier limits, at roughly 8k tokens per minute. We added model fallback,
Retry-Afterhandling and saved answers for the sample, so the demo stays up. - Honest limits. On real incidents StowCheck caught $4/7$, no better than the model alone. If the words are a deliberate lie ("dolls"), no reader of the words can catch it. We published that result instead of hiding it.
Accomplishments that we're proud of
- Two different free models both reach $21/24$ inside StowCheck.
- Zero unsafe answers on 100 segregation pairs.
- Every finding is traceable to a regulation paragraph, so an inspector can audit it.
What we learned
Models are good readers and unreliable rule engines. Grounding them in a real table and letting code decide gave more accuracy and an audit trail.
What's next
- IMDG Code support for international voyages
- More real incident data and larger held-out sets
- Integration with booking and terminal systems
US 49 CFR only. Research demo: a qualified person must confirm every result.
Built With
- fastapi
- gemini-api
- gemma
- gpt-oss-120b
- groq
- javascript
- pdf.js
- python
- sheetjs
- vercel