Building an AI training dataset from company data: 5 bugs that ruin the model
If you train an AI model that predicts something about companies (who will buy, who will default, who will grow), the model is rarely the weak part. The AI training data is. Most teams build their training dataset from the web: scraped profiles, websites, job posts. That gives you features fast. It

If you train an AI model that predicts something about companies (who will buy, who will default, who will grow), the model is rarely the weak part. The AI training data is.
Most teams build their training dataset from the web: scraped profiles, websites, job posts. That gives you features fast. It also gives you five bugs that no amount of tuning fixes, because they are in the data before the first epoch.
I work at CompanyData.com, where we deliver company data from official registers, so the field names below are ours. The bugs and the fixes apply to any source.
A scraped profile has a URL, not an identity. "ACME Ltd", "Acme Limited" and "ACME UK" become three rows, or one row that mixes a parent with its subsidiary. Your label (churned, defaulted, converted) then lands on the wrong entity some of the time. That is label noise, and it puts a ceiling on accuracy.
Fix: resolve every record to a legal entity first, and key on registration number plus country.
import pandas as pd reg = pd. read_parquet ( "registry/2026-11.parquet" ) # one row per legal entity crm = pd. read_csv ( "crm_accounts.csv", dtype = str ) # Join on the identifier, never on the name train = crm. merge ( reg, left_on = [ "registration_number", "country_code" ], right_on = [ "Company Registration Number", "Country Code" ], how = "left", validate = "m:1", # fails loudly if the registry side is not unique ) print ( "unmatched:", train [ "ID" ]. isna ( ). mean ( ) ) Enter fullscreen mode Exit fullscreen mode Read IDs and registration numbers as strings. Many start with a zero, and a numeric column silently drops it.
A web-built dataset contains the companies that have a web presence. LinkedIn lists about 70 million company pages; our registry file holds 377 million companies. The missing ones are not random: small, local, non-digital, holding companies. A model trained on the visible part learns "what a company with a marketing team looks like".
You cannot detect this from inside the dataset. You need the population.
Fix: measure coverage against the register, per segment.
-- How much of each segment does my training set actually see? SELECT r. "Country Code", substr ( r. "Business Category Code 1", 1, 2 ) AS sic2, COUNT (*) AS population, COUNT(t.id) AS in_training, ROUND(100.0 * COUNT(t.id) / COUNT(*), 1 ) AS coverage_pct FROM registry r LEFT JOIN training t ON t. id = r. "ID" GROUP BY 1, 2 ORDER BY coverage_pct; Enter fullscreen mode Exit fullscreen mode Segments with 3% coverage are segments your model has no business scoring. Either add them, reweight, or refuse to predict there.
Revenue and headcount are the strongest features in most B2B models. On scraped profiles, headcount is a range someone picked once and revenue does not exist, so vendors model it. Train on that and your model learns another model's guesses, including its errors.
Registers are better here but not perfect: accounts are filed yearly, small companies often file without turnover, and US states collect no accounts at all. So part of any dataset is estimated. What matters is that you know which part.
In our data every size figure carries an indicator: "0" is an actual filed figure, "1" the low end of a range, "2" an estimate.
train [ "revenue_is_actual" ] = ( train [ "Yearly Revenue Indicator" ] == "0" ). astype ( int ) train [ "employees_is_actual" ] = ( train [ "Employees Total Indicator" ] == "0" ). astype ( int ) # Option A: let the model learn how much to trust each value features = [ "revenue_usd", "revenue_is_actual", "employees", "employees_is_actual" ] # Option B: evaluate only where the truth is known test_actual = test [ test [ "revenue_is_actual" ] == 1 ] Enter fullscreen mode Exit fullscreen mode Option B is the one teams skip. If you evaluate on estimated revenue, you are measuring agreement with the estimator, not accuracy.
A current company file contains companies that exist today. Ours removes a company when it is deregistered; a scraped dataset does the opposite and keeps dead profiles for years. Both break a failure model, in different ways:
Fix: keep every monthly snapshot. The companies that disappear between two snapshots are your labels.
prev = pd. read_parquet ( "registry/2026-10.parquet", columns = [ "ID" ] ) curr = pd. read_parquet ( "registry/2026-11.parquet", columns = [ "ID" ] ) gone = set ( prev [ "ID" ] ) - set ( curr [ "ID" ] ) # deregistered this month new = set ( curr [ "ID" ] ) - set ( prev [ "ID" ] ) # newly registered labels = pd. DataFrame ( { "ID": list ( gone ), "event": "deregistered", "month": "2026-11" } ) Enter fullscreen mode Exit fullscreen mode Start archiving snapshots on day one, even before you have a model. History is the one thing you cannot buy back cheaply later.
You predict "will this company default in 2026?" with features from today's record. But today's record already knows the company moved to a formation agent's address in March 2026. The model looks brilliant offline and fails in production.
Fix: build features from the snapshot that existed at prediction time, with an as-of join.
events = events. sort_values ( "event_date" ) # what you predict snapshots = snapshots. sort_values ( "snapshot_date" ) # all monthly files, stacked features = pd. merge_asof ( events, snapshots, left_on = "event_date", right_on = "snapshot_date", by = "ID", direction = "backward", # only data known before the event tolerance = pd. Timedelta ( "62D" ), ) Enter fullscreen mode Exit fullscreen mode The same snapshots give you real change features, which are stronger than any level: revenue falling two filings in a row, a new director, a new parent company, a new address.
Put together, the pipeline looks like this:
None of this makes web data bad. It makes it the second layer instead of the foundation.
Sample data and loaders to try this on: companydata-api on GitHub. For whole countries as monthly files, see the data licence. The field reference, including the indicator flags, is in the API docs. For the business side of the same argument, see AI training data for B2B.