ML Systems Lab Open interactive version →
Intermediate 29 min read labelinglabel noiseweak supervisionprogrammatic labeling

Label Generation

Programmatic labeling, label noise, weak supervision, distant supervision

You want to predict which support tickets will need escalation. You have 500,000 old tickets — plenty of data. Then the label reality hits: "escalation" meant something different before 2022, 60% of tickets have no recorded outcome at all, and the outcomes that exist only showed up 14 days after the ticket closed. This is harder than picking a model. It is harder than building features. In most real production ML, *getting the labels right is the actual bottleneck.*


Four ways to get labels, each with its own cost, delay, and noise

*Natural labels* come free from user behavior — clicks, purchases, chargebacks. The label already exists; the only catch is delay (clicks in seconds, chargebacks in days), so you design the pipeline around that wait.

*Human annotation* has experts or crowd workers label examples directly — Scale AI or Surge for hard tasks, MTurk for easy ones, running from roughly fifty cents to five dollars an example. You *must* measure quality: inter-annotator agreement (Cohen's κ) above 0.7 is acceptable, 0.8 is good, and below 0.6 means the task itself is ambiguous — fix the guidelines before spending on more labels.

*Weak supervision* (Snorkel) writes many *labeling functions* — small heuristics such as keyword matches, regexes, existing classifiers, or crowd rules-of-thumb — each of which votes a label or abstains on every example. A small set of *gold-labeled examples* (a few hundred, hand-labeled) is held out to estimate each labeling function's accuracy and how often functions agree with each other; Snorkel's label model uses those estimates to weight and combine the noisy votes into one probabilistic label per example. Worked example: five labeling functions, each roughly 65-75% accurate alone, weighted and combined against the gold set, can produce an aggregate label model above 90% accuracy — because their errors aren't perfectly correlated with each other, so they cancel out when combined — all without collecting a single additional human label beyond the gold set.

*Active learning* trains a model, finds the examples it's most unsure about, and sends only those to humans — often reaching the same accuracy as random labeling with 5–10× fewer labels.


The trap almost everyone hits: label delay

If the truth for an event at time T only arrives at T+7 days, you must drop the last 7 days from training. Skip that, and your recent examples are full of positives that simply haven't been labeled yet. The model sees a near-zero positive rate in the latest window and "learns" that recent traffic is safe. That's not a pattern — it's an artifact of how you built the dataset.


A second common trap: labels that are quietly biased by subgroup

Aggregate accuracy can look fine — 92% overall — while one demographic group's error rate is far higher, because that group is a small enough share of the test set to hide inside the average. Two checks catch this: per-group accuracy metrics (compute accuracy separately for each subgroup — never trust the blended number alone), and *confident learning* — a technique, implemented in the open-source `cleanlab` library, that flags likely-mislabeled examples by finding where the model's predicted-probability distribution disagrees with the label it was actually given. Run a confident-learning audit on the affected subgroup specifically: if it surfaces a disproportionate share of likely-mislabeled examples there, the disparity is a labeling problem, not just a sampling artifact — the fix is auditing and relabeling those examples plus reweighting the minority class, not just collecting a bigger test set.


And the myth to kill: "we have tons of data, we don't need labels." Data is not labeled data. Ten million unlabeled rows teach a supervised model nothing. Label quality is the ceiling on model quality — a model can't learn the right thing from the wrong signal, no matter how much you feed it. Spend on annotation *quality* before annotation *quantity.*

Key points

Takeaway

Label quality sets the ceiling on model quality — a model cannot learn the right pattern from wrong labels, and collecting more labels from the same biased process amplifies the bias rather than fixing it.

Recap

Check your understanding

Q1. You are building a content moderation model. Human labelling is too expensive at scale. Walk through a programmatic labelling workflow.

Q2. Your model achieves 92% test accuracy, but manual inspection reveals it is wrong on most examples involving a specific demographic group. Select the two accurate diagnoses/fixes.

Q3. You have 10,000 examples labelled by humans with inter-annotator agreement of kappa=0.45. How do you handle this in model training?

Q4. What is the failure mode of using a model trained on weak labels to generate more labels for the same dataset, and how do you avoid it?

Try it interactively

ML Systems Lab is a free interview-prep platform for ML engineers — work through the full interactive module, quizzes, and drills.

Open ML Systems Lab →