# Fine-tuning a small model to route banking support tickets

Applied AI. Updated Nov 2026 by [Mangesh Kashid](https://eemky.xyz/index.md).

I fine-tuned Qwen3-0.6B with LoRA to classify banking support tickets. I ran the model locally and checked both the predicted intent and whether its response could be parsed by other software.

Figure: A support ticket turns into JSON above an evaluation strip showing 50 correct and schema valid results.

- Role: Creator & Maintainer
- Duration: 2025 project

## Evaluation results

- 50/50: Correct intents on held-out tickets
- 50/50: Schema-valid responses on the same tickets
- 93.4%: Intent accuracy on a separate 2,600-example evaluation
- ~0.5%: Model weights trained with LoRA

The larger evaluation is self-reported. The 50-ticket evaluation is available with per-ticket results.

## Background and problem

Support tickets arrive in natural language. Routing systems need structured intent labels.

The public Bitext dataset had 25,545 rows in November 2026 and covers about 27 intents. I used 90% of the data for training and reserved 10% for evaluation.

The classifier returns a fixed JSON object so downstream code can parse the result.

## When the output doesn’t fit

In the repo’s password-reset example, the classifier returns get_password. The next system can use that label to route the request.

The response has a fixed format so other code can check it.

- Intent
- Confidence
- Reason
- JSON schema

## The opportunity

I wanted one pipeline for training and running the model locally:

Figure: Bitext tickets feed LoRA training, GGUF export and local inference in sequence.

Start with public support tickets, fine-tune a small model, export it to GGUF and classify tickets locally.

## Building the pipeline

I formatted the Bitext examples as chat prompts with structured target responses, then fine-tuned Qwen3-0.6B with TRL and PEFT LoRA.

Data prep, training, conversion and inference each run on their own. The classifier runs locally, so tickets don’t go to a third-party API.

Figure: The pipeline separates dataset preparation, training, conversion and inference into modules.

## Fine-tuned on Apple Silicon

I trained the LoRA adapter locally on Apple Silicon using the MPS backend, without a cloud GPU.

Figure: A training ring shows a LoRA adapter trained on Apple Silicon using PyTorch MPS.

## Validating the response

Each result contains an intent, a confidence number and a one-line reason. The evaluation checks that outputs are valid JSON with the expected keys and types.

Figure: Braces enclose three result fields for intent, confidence and reason.

I use a rule-based confidence score from data preparation. It isn’t a calibrated probability.

Figure: The example confidence of 0.94 comes from a rule in data preparation rather than a calibrated probability.

## Checking held-out results

I tested the local GGUF model on held-out tickets, checking the intent and JSON schema independently.

Figure: Dots group the 50 evaluation tickets by expected intent, and every prediction matches its group.

Figure: Two bars show that all 50 responses parsed as JSON and passed the schema check.

## From a ticket to structured data

The classifier takes a plain-text ticket and returns its intent, confidence and a short reason as JSON. The README shows a password-reset example.

Figure: The password reset example streams JSON with get_password, a confidence of 0.94, and a reason. A divider separates the input and output on wide screens. Narrow screens switch between Ticket and JSON.

I strip Qwen’s reasoning blocks before parsing the classifier response.

Figure: The reasoning block is removed before the remaining JSON is parsed.

## Showing why a label was chosen

The reason field explains why the classifier chose the label.

Figure: Annotations connect the reason text to the get_password intent and the words of the original ticket.

Applications can use the intent field to route the ticket.

Figure: The intent field sends a password reset ticket down the get_password route.

## From training to local inference

I trained a LoRA adapter, merged it into the base model, exported a GGUF f16 checkpoint and ran it locally with llama-cpp-python. The repo documents each step.

Figure: Six workflow steps in one stepper: the public Bitext dataset has 25,545 rows, and the repo uses a 90% training and 10% evaluation split. LoRA trains about 0.5% of Qwen3-0.6B's weights. The adapter is merged into one checkpoint, exported as GGUF f16, and run locally with llama-cpp-python. The model predicted the expected intent for all 50 tickets in the published held-out slice.

Six steps from public data to a local model. Step through them, or read all six at once.

Figure: Braces and quotation marks close around the response to illustrate the JSON syntax check.

Check accuracy and schema validity on a held-out slice.

Figure: A grid checks that the intent, confidence and reason fields are present and have the expected types.

The repo includes a per-sample evaluation report.

## Trying the classifier

The repo shows how to pass a ticket to the classifier and read its parsed response. The trained weights are not bundled; the README documents how to reproduce them.

Figure: The Python example calls classify and prints the JSON response.

The public evaluation report includes the metrics and individual test predictions.

Figure: The evaluation report shows three results of 50 out of 50 beside a sample record.

## Reflections

I published the individual held-out predictions so you can check where the labels came from. This test doesn’t tell us how the classifier would handle all banking support traffic.

- [View source](https://github.com/LEO2822/ticket-classifier)
- [Read the evaluation report](https://github.com/LEO2822/ticket-classifier/blob/main/outputs/eval_results.json)

Page: https://eemky.xyz/ticket-classifier
