Bank Transaction Categoriser - Fine-tune and Compare Runs

Fine-tune a small pretrained encoder to sort card transactions into spending categories, one comparable report per run.

by Temple Compute

Run Bank Transaction Categoriser - Fine-tune and Compare Runs on Horus

W-46 · Bank Transaction Categoriser - Fine-tune & Compare Runs

Fine-tune a small pretrained encoder to sort card transactions into spending categories, one comparable report per run.

Domain: AI horus-runtime

Overview

Fine-tunes a pretrained text encoder (default distilbert-base-multilingual-cased) with Hugging Face Transformers to classify transaction descriptions such as PUBLIX 7860 UNIVERSITY LN OAKLAND CA into categories. Each run ends in an HTML report with its metrics, confusion matrix, training time, hardware and hyperparameters, so runs launched with different settings can be compared side by side. The workflow has 4 tasks.

Pipeline

prepare_data  ──► train / val / test splits + label map      (small_cpu, cached)
   └─► train  ──► fine-tuned checkpoint + training log       (trainer: CPU or L4 GPU)
         └─► evaluate  ──► metrics.json + confusion_matrix.png   (small_cpu)
               └─► report  ──► report.html                       (small_cpu)

prepare_data only sees the data inputs and splits with a fixed seed, so runs that change only hyperparameters reuse its output. train runs on its own trainer target. Point it at an L4 machine and set gpus: 1 to train on GPU; the script uses CUDA whenever a GPU is present and records the hardware in the report.

Inputs / Outputs

Parameters

| id | Default | Meaning | |---|---|---| | transactions_csv | examples/transactions.csv | Transactions CSV | | text_column | description | Column with the transaction description | | label_column | category | Column with the spending category | | model_name | distilbert-base-multilingual-cased | Hugging Face model to fine-tune | | learning_rate | 1e-4 | Peak learning rate | | epochs | 3 | Passes over the training split | | batch_size | 32 | Examples per optimizer step | | max_length | 32 | Max tokens per description | | seed | 42 | Training seed (the split always uses 42) |

References