MACHINE LEARNING · NLP

AI Incident Classification

Classifying real-world AI incidents into taxonomies from free-text descriptions, using fine-tuned transformer models.

Problem

AI incident databases — records of things that went wrong when an AI system was deployed — are maintained largely as free text. Useful analysis (trends by sector, by failure type, by severity) needs those incidents sorted into a consistent taxonomy, and doing that by hand doesn't scale as the volume of reported incidents grows. The goal was a system that could read an incident description and assign it to the right category automatically, accurate enough to trust without a human re-checking every prediction.

Approach

01
Data cleaning
02
Text preprocessing
03
Feature representation
04
Pretrained language models
05
Classification & evaluation

Technical decisions

I used Hugging Face Transformers as the modelling backbone and fine-tuned BART — a sequence-to-sequence model pretrained on large text corpora — rather than training a classifier from scratch, since the labelled dataset of incidents was too small to learn good text representations on its own. Fine-tuning let the model start from strong general language understanding and specialise on incident-specific vocabulary and structure.

Preprocessing focused on cleaning inconsistent formatting across incident sources and normalising text length, since incident descriptions ranged from one-line summaries to multi-paragraph reports. Evaluation used accuracy, precision, recall and F1-score rather than accuracy alone, since incident categories were unevenly represented and a model that just predicted the most common class would still score well on accuracy alone.

Result

The fine-tuned model reached 91% accuracy on the classification task, with precision and recall balanced enough across categories that it wasn't just winning on the dominant class. That was accurate enough to use as a first-pass classifier, with human review reserved for lower-confidence predictions rather than every incident.

Next steps

The natural extensions are active learning (routing only the lowest-confidence predictions to a human, and feeding corrections back into the training set), and testing whether a smaller distilled model can match the accuracy at a fraction of the inference cost for production use.

GET IN TOUCH

Let's build something interesting.

Data, AI, travel, wildlife — or some combination of all four.