gl-classifier-lora-r32
bank transaction classifier for accounting
2 min read
A lightweight LoRA adapter (a small add-on layer over a base model) that categorizes bank transactions based on their text descriptions and maps them to one of 20 general ledger accounts. For example, entries like UBER *EATS are categorized as meals and entertainment expenses, while GUSTO TAX PAYMENT goes to payroll taxes. Built on the compact unsloth/Llama-3.2-1B-Instruct base by author rafayelmirijanyan, this adapter significantly outperforms both the unadapted base model and traditional TF-IDF with logistic regression on test benchmarks. It is ideal for developers building fintech tools, accounting software, and automated statement tagging systems.
Key features
- Compact base: built on a 1B-parameter model (
Llama-3.2-1B-Instruct), allowing fast deployment even on budget GPUs. - Higher accuracy on new vendors: achieves an accuracy of 0.576 on a test set of unseen merchants, compared to just 0.051 for the zero-shot base model.
- Fast inference: merging weights with the base model via
merge_and_unload()and running on a T4 GPU via vLLM delivers a median latency of 51 ms and a throughput of 105 requests per second. - Simple integration: loads easily with the standard
peftlibrary, and can be merged directly into the core model weights for maximum production speed.
What you can do
- Embed it into an automated expense-tracking service or internal accounting system for initial bank statement sorting.
- Use it as a starting point and fine-tune it on real statements from a specific company using its internal accounting rules.
- Deploy it via vLLM as a fast microservice for batch categorization of English-language transactions.
Example
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base = AutoModelForCausalLM.from_pretrained("unsloth/Llama-3.2-1B-Instruct", dtype=torch.float16)
model = PeftModel.from_pretrained(base, "rafayelmirijanyan/gl-classifier-lora-r32")
Read more
DetailsMetrics (tested on ~18 new merchants): Accuracy 0.576 / Macro-F1 0.537 (compared to 0.199 / 0.164 for Llama 3.2 1B 5-shot and 0.387 / 0.403 for TF-IDF + logreg).
Training: QLoRA via Unsloth (rank 32, alpha 32, lr 2e-4, 2 epochs) on ~6,000 synthetic descriptions in ~13 minutes on a single T4.
Prompt requirements: A system message listing the 20 accounts and the raw transaction string in the user message.
Limitations: Trained exclusively on synthetic US bank-style statement lines mapped to a fixed 20-account chart; has not seen real statements and does not account for corporate policies.










Comments