Instructions to use MersivMedia/ttb-label-clef27b-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use MersivMedia/ttb-label-clef27b-lora with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
ttb-label-clef27b-lora
A LoRA adapter and decision head for Cloudflare/clef (27B), tuned to check the typography of the US Government Health Warning on alcohol labels:
- header in capitals: is "GOVERNMENT WARNING:" written in all caps?
- header bold: is the header heavier than the warning text that follows?
- body not bold: is the rest of the warning in regular weight? 27 CFR 16.22(a)(2) requires the header in capital letters and bold type, and forbids bold in the rest of the statement.
It also answers the field questions the base model already handled well (brand, class/type, alcohol content, net contents against the application data). It answers fixed questions with probabilities; it does not generate text, so it cannot rewrite what it reads.
Use optA/checkpoint-200. The other checkpoints are kept so the checkpoint choice can be audited.
Results
All typography numbers count bad labels let through: a label with a typography defect that the model scored as correct. Cutoffs were fixed on a dev set before the test sets were scored.
| Model | Sealed test (unseen fonts): bad let through | Sealed: good labels passed | Locked test (photos, flat art, real labels): bad let through | Locked: good labels passed |
|---|---|---|---|---|
| Base Clef | 4 of 229 on dev alone | 42% on dev | not usable | |
| Run 1, step 250 | 9 / 900 | 97% | 5 / 150 | 85% |
| Run A, step 200 (this release) | 0 / 900 | 82% | 0 / 150 | 43% |
With 0 misses, the 95% upper bound on the true miss rate is about 0.33% on the sealed set and about 2% on the locked set.
Known limits
- Cautious on photos: on real and generated phone photos, 57% of good labels are sent to a person on typography. Safe, but it means review work.
- Brand names that drop a word: on the field checks, the model treats an application brand that leaves out a word ("Crowsnest" vs a printed "Crowsnest Estate") as a match. Such cases need a separate rule.
- The crop matters: typography is judged from a zoomed crop of the warning. If the warning is not located, the label should go to a person.
- Small caps are out of scope: they are routed to a person by design.
How it was trained
- Method: LoRA (r 64, alpha 128) plus a joint decision head on Clef 27B at revision
2f3de3dd85f379784083b0814d997ab627200f0c; label smoothing 0.05. Run A is 200 steps on 5,710 records. - Data: procedurally rendered labels in 49 open-licence font families, with semibold and serif warning bodies emphasised, photo-style degradation, and 110 CC-licensed real photos split by product.
- Leak checks: no test image, test font or test brand was used in training; this was checked with image matching against the locked test set.
- Hardware and cost: one RTX PRO 6000 (96 GB), about $19 of GPU across all runs.
Use
Each checkpoint folder holds adapter/ (PEFT LoRA) and joint_head.safetensors (the decision head). The base model needs about 55 GB of GPU memory in bf16.
pip install clef-finetune==0.1.0
hf download MersivMedia/ttb-label-clef27b-lora --include "optA/checkpoint-200/*" --local-dir ttb-lora
clef-finetune eval --model Cloudflare/clef --checkpoint ttb-lora/optA/checkpoint-200 --data records.jsonl --max-length 4096
The request format (question set, image order, the zoomed warning crop) must match training: see the records produced by eval/tools/build_e2e_records.py in the project repository.
Licence
Apache-2.0, the same as the base model.
- Downloads last month
- -