Saeedhoj's picture
Upload README.md with huggingface_hub
09dc826 verified
|
Raw History Blame Contribute Delete
2.37 kB
---
license: apache-2.0
base_model: distilroberta-base
language: en
pipeline_tag: text-classification
library_name: transformers
tags: [finance, accounting, spend-classification, procurement, onnx]
metrics: [accuracy, f1]
---
# SpendCoder: purchase line to spend category
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
## Results (test year, contracts the model never saw)
| 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.
## Categories
- Engineering & professional services
- Research & development
- Facility operations & management
- Construction & building maintenance
- Equipment maintenance & repair
- IT & telecom services
- Environmental services
- Utilities, security & housekeeping
- Other services
- IT hardware & software
- Electrical & power equipment
- Lab instruments & chemicals
- Vehicles & machinery
- Other goods
## Data
US Department of Energy contract descriptions and their Product and Service Codes from
[USAspending.gov](https://www.usaspending.gov) (public domain), grouped into the 14 categories above.
## Use
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.
## Files
- PyTorch / Transformers weights at the repo root: `AutoModelForSequenceClassification.from_pretrained(...)`
- `onnx/`: `model.onnx`, `tokenizer.json`, `spendcoder.json` (labels, review threshold) for CPU serving with
onnxruntime, no PyTorch needed