Data Science & ML · AI & Agents
Industry Classification of Firms (BERT + GPT-4 Labelling)
By David Gadyan · Published · Updated · Client: Andrew Miles
End-to-end pipeline that assigns NAICS/SIC industry codes to New York firms that had no labels. Fuzzy name and location matching against secondary registries recovers known codes, GPT-4 few-shot labelling expands the training set without manual annotation, and a BERT classifier, benchmarked against SVM and Random Forest, predicts codes for the rest, with QA reviews and a replication package.
The problem
The client had records of New York firms with only a name, an owner, an address, zip code, city and state, and establishment or dissolution years, and no industry labels at all. They needed NAICS/SIC codes for every firm, at scale, and manual annotation was not an option at that volume.
What I built
- A matching stage that links each unlabelled firm to secondary registries through fuzzy string matching on names and location-based matching on addresses, recovering known NAICS/SIC codes wherever a match exists.
- A labelled training set assembled from the successful matches and expanded with GPT-4 few-shot labelling, so coverage grew without anyone annotating records by hand.
- A BERT-based classifier in Python that predicts industry codes for the firms that could not be matched, chosen after comparing it with SVM and Random Forest baselines and optimised for both accuracy and inference cost.
- QA controls in the form of random manual reviews of both the registry matches and the model's predictions, to keep data quality high.
- Full documentation and a replication package covering the matching logic, the labelling strategy and the training and inference workflows.
How it was delivered
I was the sole engineer. Rather than hand over predictions alone, I delivered the pipeline as something the client's stakeholders can rerun: the documentation and replication package reproduce the matching logic, the labelling strategy and the model training and inference end to end.
Outcome
Every firm in the dataset ends up with a NAICS/SIC code: the matched ones from the registries, the rest from a BERT classifier trained on a set that GPT-4 helped label. The random QA reviews keep both stages honest, and the replication package means the workflow can be reproduced rather than treated as a one-off run.
Related projects
AI Real Estate Lot Analysis Platform for a Residential Builder
AI & Agents · Full-Stack & UI/UX · Data Science & ML
Resume Analysis with NLP and LLMs
Data Science & ML · AI & Agents
Computer Vision with YOLO26/27: Three Edge-Ready Demos
Computer Vision & Generative Media · Data Science & ML · Cloud, DevOps & LLMOps