加载中…
加载中…
Fine-tuned distilroberta-base that reads a short purchase or invoice line (for example "ANNUAL MAINTENANCE OF HV SWITCHGEAR") and returns one of 14 spend categories, with a confidence score. Low-confidence lines are meant to go to a person. Code, data preparation and tests: https://github.com/saeedm31/SpendCoder
| Model | Accuracy | Macro F1 | Weighted F1 |
|---|---|---|---|
| TF-IDF + logistic regression (baseline) | 0.673 | 0.616 | 0.675 |
| Fine-tuned distilroberta-base | 0.665 | 0.569 | 0.664 |
At the chosen review threshold (0.99), 29.0% of test lines are coded automatically with 91.3% accuracy; the rest go to a person.
Train: 17,098 lines (contracts starting before Oct 2023). Validation: 2,065 (Oct 2023 to Sep 2024). Test: 1,547 (from Oct 2024). Test lines whose exact text appears in training were removed.
US Department of Energy contract descriptions and their Product and Service Codes from USAspending.gov (public domain), grouped into the 14 categories above.
Suggest a spend category for purchase and invoice lines in accounts payable or procurement; send lines below the review threshold to a person. Not for automatic posting without review. Trained on one public-sector buyer's wording: before using it in another company, check it on that company's labelled lines and fine-tune further.
AutoModelForSequenceClassification.from_pretrained(...)onnx/: model.onnx, tokenizer.json, spendcoder.json (labels, review threshold) for CPU serving with
onnxruntime, no PyTorch needed