Data Labeling Pipelines: Humans, Models, and QA
Model quality is capped by label quality. This sounds obvious until you measure it: teams routinely spend six months tuning architectures while training on labels that two annotators would disagree about 30% of the time. Data labeling â turning raw text, images, or audio into supervision a model can learn from â is where most of that risk hides, because the errors are silent. A noisy label just looks like a slightly harder example.
A labeling pipeline is a production system with the same concerns as any other: throughput, unit cost, versioning, and quality control. It needs clear instructions, a way to route easy cases past humans quickly, a way to find the cases humans disagree on, and a feedback loop that improves the guidelines instead of letting confusion compound.
This lesson covers the anatomy of a modern labeling workflow, active learning strategies that cut labeling volume, LLM-assisted pre-labeling â including where it backfires â and inter-annotator agreement metrics that tell you whether your guidelines are actually working.
The workflow from raw data to trusted labels
A robust pipeline has five stages. Raw data is sampled and deduplicated, then pre-labeled by a model or heuristic. Humans review the pre-labels rather than starting from a blank screen, which is typically two to three times faster. A validation stage re-checks a random slice â often with a second, independent annotator â to measure agreement. Disagreements flow back into a guideline revision loop. Only labels that pass validation enter the training set.
The order matters. Sampling comes before annotation so you control class balance; random sampling of naturally skewed data yields a training set dominated by the majority class. And validation must be independent â if the same annotator confirms their own work, you are measuring nothing.
| Stage | Who does it | Output | Cost per 1,000 items |
|---|---|---|---|
| Sampling and dedup | Automated | Candidate pool | Negligible |
| Pre-labeling | Model (rules, LLM, weak classifier) | Draft labels + confidence | Low (API or inference cost) |
| Human review | Annotator, editing drafts | Proposed labels | Highest line item |
| Validation | Second annotator or gold-set checks | Agreement statistics | Medium |
| Guideline revision | Domain lead | Updated instructions, edge cases | Occasional, high leverage |
Notice where the money goes. Human review dominates the budget, which is exactly why active learning and pre-labeling matter: they shrink the number of items that reach the expensive stage without shrinking the information each labeled item carries.
Active learning: labeling the five percent that matters
Labeling a random sample is wasteful because most items are easy â the model would have gotten them right anyway. Active learning closes the loop between the current model and the labeling queue, sending humans only the examples the model finds informative.
Uncertainty sampling is the standard query strategy: compute the model's predictive distribution over the unlabeled pool and request labels for the items where entropy is highest. Margin sampling is a cheaper variant that only compares the top two classes.
import numpy as np
from typing import List
class ActiveLearner:
def __init__(self, model, X_pool: np.ndarray):
self.model = model
self.X_pool = X_pool
self.labeled: List[int] = []
self.unlabeled: List[int] = list(range(len(X_pool)))
def query_entropy(self, n: int = 20) -> List[int]:
probs = self.model.predict_proba(self.X_pool[self.unlabeled])
entropy = -np.sum(probs * np.log(probs + 1e-12), axis=1)
order = np.argsort(entropy)[::-1][:n]
return [self.unlabeled[i] for i in order]
def query_margin(self, n: int = 20) -> List[int]:
probs = self.model.predict_proba(self.X_pool[self.unlabeled])
top2 = np.sort(probs, axis=1)[:, -2:]
margins = top2[:, 1] - top2[:, 0]
order = np.argsort(margins)[:n]
return [self.unlabeled[i] for i in order]
def add_labels(self, indices: List[int], labels: List[int]):
for idx, label in zip(indices, labels):
self.labeled.append(idx)
self.unlabeled.remove(idx)
self.y[idx] = label
def retrain(self):
self.model.fit(self.X_pool[self.labeled], self.y[self.labeled])
The economics are compelling. On typical classification tasks, active learning reaches the accuracy of random sampling with 20â40% of the labels, because every human judgment is spent where the model is genuinely uncertain. Two caveats: uncertainty sampling can chase outliers, so mix in a slice of random sampling each round; and retraining on every batch is expensive, so many systems query in batches of a few hundred to a few thousand.
Pre-labeling with language models â and its traps
Large language models changed the pre-labeling economics. For text classification, a single prompt with a fixed label set and temperature set to zero produces draft labels plus a confidence estimate, letting humans accept rather than decide. The speedup is real, but it introduces two traps.
The first is correlated errors. When the same LLM pre-labels everything and a human skims rather than re-decides, the model's blind spots pass straight into the training set â you have laundered model bias through a human checkbox. The second is confidence inflation: models report certainty that does not correlate with correctness. The mitigation is to force review on a random sample of "confident" items, not just the flagged ones.
import json
from typing import Dict, List
class LLMPreLabeler:
def __init__(self, client, model: str = "gpt-4o-mini"):
self.client = client
self.model = model
def label_batch(self, texts: List[str], labels: List[str],
review_rate: float = 0.2) -> List[Dict]:
results = []
label_str = ", ".join(labels)
for i, text in enumerate(texts):
resp = self.client.chat.completions.create(
model=self.model,
temperature=0,
response_format={"type": "json_object"},
messages=[
{"role": "system", "content":
f"Classify into exactly one of: {label_str}. "
'Return JSON: {"label": "...", "confidence": 0.0-1.0}'},
{"role": "user", "content": text},
],
)
parsed = json.loads(resp.choices[0].message.content)
conf = float(parsed.get("confidence", 0.5))
needs_human = conf < 0.8 or (hash(text) % 100) / 100 < review_rate
results.append({
"text": text,
"draft_label": parsed.get("label"),
"confidence": conf,
"needs_human": needs_human,
})
return results
That forced-review slice on confident items is the important line. It keeps the human in a verification role rather than a rubber-stamp role, and it gives you a continuous measurement of how trustworthy the pre-labeler actually is.
Measuring agreement before trusting labels
If two qualified annotators looking at the same item with the same guideline disagree, your labels are not ground truth â they are samples from a distribution. Cohen's kappa quantifies that disagreement while correcting for the agreement you would expect by chance:
from typing import List
def cohens_kappa(a: List[str], b: List[str]) -> float:
assert len(a) == len(b) and len(a) > 0
n = len(a)
categories = set(a) | set(b)
p_o = sum(1 for x, y in zip(a, b) if x == y) / n
p_e = sum((a.count(c) / n) * (b.count(c) / n) for c in categories)
if p_e == 1:
return 1.0
return (p_o - p_e) / (1 - p_e)
Interpretation is where teams go wrong. Raw agreement of 90% looks excellent until you realize both annotators answer "negative" 90% of the time â chance agreement is then 0.82 and kappa is near 0.4, which is mediocre. The conventional thresholds are below 0.4 poor, 0.4â0.6 moderate, 0.6â0.8 substantial, above 0.8 near-perfect, but the right target depends on the task: medical coding demands far more than topic tagging. Fleiss' kappa extends the same idea to three or more raters and is what you want for crowdsourced work.
Low agreement is a guideline bug, not an annotator bug. The response is to collect the disagreement cases, write explicit rules for them, retrain the annotators, and re-measure. Agreement that climbs over successive waves is your evidence that the label definitions have stabilized.
Cost, throughput, and workforce trade-offs
Every labeling program eventually confronts the same triangle: speed, cost, and quality, pick two. In-house annotators cost more per item but accumulate domain expertise and give you direct feedback on guideline problems. Crowdsourced workforces deliver volume and low unit cost but turn over quickly, so expertise never compounds and agreement metrics run lower. Managed vendors sit in between, with the caveat that their incentives favor throughput over disagreement-hunting unless your contract explicitly pays for quality signals as well as completed items.
The choice should follow the task's ambiguity. Mechanical labeling â transcribing audio, drawing boxes around visible objects, tagging obviously positive examples â scales well with crowdsourcing or vendors because the guideline surface is small. Judgment-heavy labeling â clinical severity grading, nuanced sentiment, intent classification with overlapping categories â concentrates value in annotators who have seen the edge cases, which argues for a smaller, trained, retained team.
Autonomy matters too. Active learning and pre-labeling change the economics by reducing how many items reach the human stage at all; on a mature pipeline, human review may cover fewer than half the items while the labeled set keeps growing. Budget conversations should reflect that structure â the marginal cost per label falls as the pipeline matures, and the fixed investment in guidelines, tooling, and QA is what actually determines whether your unit economics improve over time.
QA loops that keep quality from decaying
Gold-standard items â examples with labels you have verified independently â are sprinkled into the annotation queue at a known rate (often 5â10%). An annotator whose gold accuracy drops below a threshold gets flagged for retraining rather than having their labels silently removed. Combined with the double-annotation slice and the active learning queue, this gives a pipeline where throughput, cost, and quality are all visible numbers instead of hopes.
The final loop is the one teams skip: annotator feedback. The people labeling are the first to notice that the guideline does not cover a recurring case. A weekly batch of disagreement reviews feeding a changelog of guideline updates is the cheapest quality investment available â and it compounds, because every future item benefits from the clarified rule.
Common Mistakes
Shipping guidelines without a worked example for each class
Fix: Include two or three borderline examples per label; most disagreement lives in the boundaries.
Trusting raw accuracy instead of kappa
Fix: Class imbalance inflates raw agreement; report Cohen's or Fleiss' kappa alongside it.
Letting an LLM pre-label and a human skim-confirm the whole batch
Fix: Force independent review on a random slice of confident items to catch correlated model errors.
Labeling a random sample of naturally skewed data
Fix: Stratify sampling by class and difficulty so rare but important cases reach training.
Never re-measuring agreement after guideline changes
Fix: Re-run a double-annotated batch after every revision to confirm the change actually reduced confusion.
Key Takeaways
- Label quality caps model quality, and noisy labels fail silently â build measurement into the pipeline.
- Pre-labeling plus human review beats blank-screen annotation; active learning cuts volume further by targeting uncertainty.
- LLM pre-labeling speeds things up but risks correlated errors â always keep a random verification slice.
- Kappa, not raw agreement, is the honest measure of whether your guidelines are well-defined.
- Gold items, double annotation, and a guideline feedback loop are the three QA mechanisms that prevent quality decay.