Where A Small Language Model Helps in Invoice Categorisation, Understood Through Embedding Geometry
Organizations: University of Bristol, U.K. · System Holdings Limited
Abstract
Categorising invoices into the correct General Ledger (GL) code underpins financial reporting and tax compliance. This is a skilled accounting judgement rather than a routine task: the correct category depends subtly on the nature of the purchasing business, the vendor and the invoice text. Whilst AI is increasingly being adopted across industries to automate tasks, including invoice categorisation, implementations built on in-house small language models (SLMs) can simultaneously reduce cost and improve data security, confidentiality, and interpretability. We investigate this approach by first analysing the pre-trained embedding geometry of a small sentence transformer (SBERT) and classic SLM (DeBERTa). The sentence-embedding space of this financial corpus is globally anisotropic but composed of locally isotropic clusters, extending prior token-level findings to sentence embeddings in a financial setting, and these clusters are strongly correlated with the vendor identity. SBERT fine-tuned on a single GPU reaches 0.96 accuracy on invoice classification, above both a zero-shot LLM and a vendor identity baseline, increasing performance for smaller, challenging categories and new clients. For this important generalisation problem, SBERT reaches 0.9 F1 with roughly 100 client-specific invoices, showing that an in-house SLM implementation is promising. Combining these results with geometric analysis shows that pre-trained embedding geometry is associated with classification performance and reveals a counterintuitive finding that a structured input that would help a human reader does not improve the SLM performance.
Figures & tables
| Model | A | B | C | |
|---|---|---|---|---|
| SBERT | 42 | 61 | 57 | 384 |
| DeBERTa mean | 13 | 7 | 6 | 768 |
| DeBERTa CLS | 10 | 1 | 1 | 768 |
| Model | A | B | C |
|---|---|---|---|
| SBERT | 0.365 | 0.282 | 0.496 |
| DeBERTa mean | 0.973 | 0.933 | 0.949 |
| DeBERTa cls | 0.999 | 0.992 | 0.993 |
| Model | A | B | C |
|---|---|---|---|
| SBERT | 54 | 59 | 60 |
| DeBERTa mean | 52 | 2 | 2 |
| DeBERTa CLS | 52 | 2 | 2 |
| True labels | K-means clustering | ||||||||
| Uncentered | Centred | Uncentered | Centred | ||||||
| Type | Model | Within | Between | Within | Between | Within | Between | Within | Between |
| B | SBERT | 0.478 | 0.249 | 0.003 | 0.000 | 0.708 | 0.265 | -0.015 | 0.000 |
| B | DeBERTa mean | 0.938 | 0.930 | 0.013 | 0.009 | 0.942 | 0.841 | 0.002 | 0.001 |
| C | SBERT | 0.641 | 0.485 | 0.003 | 0.000 | 0.823 | 0.476 | -0.031 | 0.000 |
| C | DeBERTa mean | 0.956 | 0.948 | 0.019 | 0.011 | 0.953 | 0.864 | 0.000 | 0.001 |
| DeBERTa CLS | DeBERTa mean | SBERT | Vendor | LLM | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| A | B | C | A | B | C | A | B | C | baseline | baseline | |
| Acc. | |||||||||||
| M F1 | |||||||||||
| W F1 | |||||||||||
| Model | Acc. | M F1 | W F1 |
|---|---|---|---|
| SBERT 2l | |||
| SBERT 4l | |||
| SBERT 6l | |||
| SBERT 2l b.n. | |||
| SBERT 4l b.n. | |||
| SBERT 6l b.n. |
Appendix figures & tables17 assets
Supplementary material from the paper’s appendix.
Appendix
| Account Category | Definition |
|---|---|
| Purchases | Cost of goods, raw materials or components bought for resale or for consumption in production during the period. A profit-and-loss item forming part of cost of sales; it records the buying flow, not stock held. Excludes capital assets and overhead services. |
| Directors’ Loan Account | Related-party control account for amounts a director personally lends to, or withdraws from, the company other than salary, dividend or reimbursed expenses. May be in credit (company owes the director — a liability) or overdrawn (director owes the company — an asset); overdrawn balances attract a s455 CTA 2010 charge and beneficial-loan implications. |
| Petrol and Oil | Fuel and lubricant costs incurred in operating business motor vehicles. |
| Sub | Abbreviation for Subcontractor. Payments for subcontractor or subcontract labour directly attributable to revenue-generating work. |
| Motor Repairs and Servicing | Maintenance, servicing and repair of company vehicles. |
| Subscriptions | Recurring professional-body memberships, journals and software or service subscriptions of an administrative nature. |
| Type | Model | Within | Between |
|---|---|---|---|
| A | SBERT | 0.503 | 0.348 |
| A | DeBERTa CLS | 0.999 | 0.999 |
| A | DeBERTa mean | 0.977 | 0.972 |
| B | SBERT | 0.478 | 0.249 |
| B | DeBERTa CLS | 0.995 | 0.993 |
| B | DeBERTa mean | 0.938 | 0.930 |
| Type | Model | Within | Between |
|---|---|---|---|
| A | SBERT | 0.820 | 0.341 |
| A | DeBERTa CLS | 0.999 | 0.999 |
| A | DeBERTa mean | 0.991 | 0.970 |
| B | SBERT | 0.708 | 0.265 |
| B | DeBERTa CLS | 0.997 | 0.981 |
| B | DeBERTa mean | 0.942 | 0.841 |
| Input A | Input B | Input C | |||||||
|---|---|---|---|---|---|---|---|---|---|
| Class | P | R | F1 | P | R | F1 | P | R | F1 |
| Accountancy Fee | |||||||||
| Cleaning of Premises | |||||||||
| Directors’ Loan Account | |||||||||
| Light, Heat & Power | |||||||||
| Motor Repairs and Servicing | |||||||||
| Input A | Input B | Input C | |||||||
|---|---|---|---|---|---|---|---|---|---|
| Class | P | R | F1 | P | R | F1 | P | R | F1 |
| Accountancy Fee | |||||||||
| Cleaning of Premises | |||||||||
| Directors’ Loan Account | |||||||||
| Light, Heat & Power | |||||||||
| Motor Repairs and Servicing | |||||||||
| Input A | Input B | Input C | |||||||
|---|---|---|---|---|---|---|---|---|---|
| Class | P | R | F1 | P | R | F1 | P | R | F1 |
| Accountancy Fee | |||||||||
| Cleaning of Premises | |||||||||
| Directors’ Loan Account | |||||||||
| Light, Heat & Power | |||||||||
| Motor Repairs and Servicing | |||||||||
| Precision | Recall | F1-score | |
|---|---|---|---|
| Accountancy Fee | |||
| Cleaning of Premises | |||
| Directors’ Loan Account | |||
| Light, Heat & Power | |||
| Motor Repairs and Servicing | |||
| Petrol and Oil |
| Precision | Recall | F1-score | |
|---|---|---|---|
| Accountancy Fee | |||
| Cleaning of Premises | |||
| Directors’ Loan Account | |||
| Light, Heat & Power | |||
| Motor Repairs and Servicing | |||
| Petrol and Oil |
| Model | Acc. | M F1 | W F1 |
|---|---|---|---|
| SBERT - 2 l | 0.880 | 0.845 | 0.882 |
| SBERT - 4 l | 0.876 | 0.845 | 0.874 |
| SBERT - 6 l | 0.917 | 0.875 | 0.914 |
| SBERT - 2 l + b.n. | 0.903 | 0.839 | 0.904 |
| SBERT - 4 l + b.n. | 0.931 | 0.874 | 0.929 |
| SBERT - 6 l + b.n. | 0.929 | 0.873 | 0.927 |
| Model | Acc. | M F1 | W F1 |
|---|---|---|---|
| SBERT - 2 l | 0.942 | 0.892 | 0.939 |
| SBERT - 4 l | 0.945 | 0.894 | 0.938 |
| SBERT - 6 l | 0.938 | 0.898 | 0.934 |
| SBERT - 2 l + b.n. | 0.940 | 0.895 | 0.937 |
| SBERT - 4 l + b.n. | 0.959 | 0.923 | 0.956 |
| SBERT - 6 l + b.n. | 0.959 | 0.931 | 0.956 |
| Precision | Recall | F1 | |
|---|---|---|---|
| Accountancy Fee | |||
| Cleaning of Premises | |||
| Directors’ Loan Account | |||
| Light, Heat & Power | |||
| Motor Repairs and Servicing | |||
| Petrol and Oil |
| Precision | Recall | F1 | |
|---|---|---|---|
| Accountancy Fee | |||
| Cleaning of Premises | |||
| Directors’ Loan Account | |||
| Light, Heat & Power | |||
| Motor Repairs and Servicing | |||
| Petrol and Oil |
| Precision | Recall | F1 | |
|---|---|---|---|
| Accountancy Fee | |||
| Cleaning of Premises | |||
| Directors’ Loan Account | |||
| Light, Heat & Power | |||
| Motor Repairs and Servicing | |||
| Petrol and Oil |
Small Language Models
Small language models are compact neural language systems designed to deliver useful text and reasoning capabilities with limited compute, memory, and energy.
See all 277 papers