Sub topic 16
An Iterative Workflow for Weak Supervision Projects
Prerequisites and the project loop
This chapter assumes you know basic Python, supervised text classification, precision, recall, F1, regular expressions, and basic probability. You should also understand the difference between training data and evaluation data.
Weak supervision works best as an iterative process. You begin with a small, trusted gold set, write noisy labeling sources, inspect their behavior, train a classifier, and study the errors. Each round improves the sources or reveals that the task definition needs revision.
Define the task and create a gold set
Start by defining the classes and the unit being labeled. For example, decide whether a review receives one sentiment label, whether neutral reviews are allowed, and how mixed opinions are handled.
Create a small gold set by hand. The gold set contains examples labeled according to written guidelines, not according to your labeling functions. Keep it separate from weakly labeled training data. It is your measuring instrument.
The gold set should include ordinary examples and difficult cases. Record disagreements between human annotators when possible. Those disagreements may indicate ambiguous classes rather than poor model performance.
Add sources gradually
Begin with a few interpretable labeling functions. Each function should return a class or abstain. Use different evidence types, such as sentiment words, a product lexicon, metadata, or a known phrase pattern.
After adding each source, inspect:
- Coverage: how often the source votes.
- Overlap: how often it votes where another source also votes.
- Conflict: how often its vote disagrees with another source.
- Accuracy on the gold set, if the source can be checked there.
A source with high coverage is not automatically useful. A broad rule may label many examples incorrectly. A narrow rule may provide valuable precision even when it abstains often.
Combine, train, and measure
Use majority vote as a simple baseline. Then fit a label model when sources have different reliabilities or correlated errors. The label model produces probabilities, which preserve uncertainty instead of forcing every example into a hard class.
Train the end classifier on weak labels, then evaluate it on the untouched gold set. Compare precision, recall, and F1 by class. Also inspect predictions manually. Aggregate scores can hide systematic failures, such as missing short negative reviews.
A compact experiment log makes iterations reproducible:
rounds = [
{"name": "initial_rules", "sources": 3, "f1_gold": 0.71},
{"name": "add_refund_lexicon", "sources": 4, "f1_gold": 0.76},
]
for result in rounds:
print(result["name"], result["sources"], result["f1_gold"])Diagnose failure and repeat
Review false positives and false negatives. Ask which source caused each weak label, whether multiple sources share the same evidence, and whether a rule accidentally uses information unavailable at prediction time. Remove leakage before training.
When generated text or LLM labels are added, validate them with the gold set and filter low-agreement results. Synthetic examples should expand missing cases, not dominate the distribution.
A useful stopping rule is reached when new labeling sources produce small gold-set gains, the remaining errors are understood, and performance is stable across a later time split.
Exercise
Your label model has high training coverage, but gold-set recall for the negative class is poor. What should you inspect first?
Show answer
Inspect negative-class labeling functions for low coverage, overly narrow rules, conflicts, and shared blind spots. Add or revise sources that target missed negative examples, then re-evaluate on the untouched gold set.