Weakly Supervised Recurrent Neural Network

Machine Learning
Introduced by
Broadly attributed to the weak supervision / distant supervision research community (Mintz et al., 2009; Ratner et al., 2016)
Year
2009–2016
Type
Supervised learning under noisy or incomplete labels
Family
Deep learning / NLP / CV

What does it do?

A weakly supervised recurrent neural network (WS-RNN) trains an RNN on sequences whose labels come from imperfect sources, such as heuristic rules, distant supervision from knowledge bases, aggregated crowdsourced annotations, or a generative label model, instead of expert annotation.

It is used when labelled sequences are scarce but large unlabelled or weakly labelled corpora are available, for tasks such as text classification, named entity recognition, or time-series labelling. Because the labels are noisy, the method depends on a noise-handling step applied before or during training.

The intuition behind the method

Fully supervised RNNs need large sets of carefully annotated sequences, which are costly to produce. Weak supervision replaces part of that annotation with labels generated automatically, for example by matching text against a knowledge base or applying hand-written labelling rules. Zhou (2018) groups weak supervision into incomplete, inexact, and inaccurate forms; the last of these, where the given labels are not always ground truth, is the case that the noise-handling step is designed for. The recurrent network can help only in a limited way: when neighbouring positions in a sequence carry evidence about a noisy label, the context may outweigh an isolated error, but this depends on how the errors are distributed across the sequence.

History

Weak supervision is reviewed systematically by Zhou (2018), published in National Science Review (online in 2017), which distinguishes incomplete, inexact and inaccurate forms of supervision. Distant supervision, which derives training labels from external knowledge bases, is one of the main sources of weak labels discussed on this page. Ratner et al. (2016) introduces data programming, in which labelling functions are combined through a generative label model to create training sets.

When to use it

Use a weakly supervised RNN when the data are sequential (text, time series, or speech), expert-annotated labels are too costly to obtain at the required volume, and at least some labelling heuristics or external knowledge bases can produce weak labels for a meaningful part of the corpus. It suits tasks such as distant-supervision relation extraction, NER bootstrapping, sentiment classification from noisy reviews, or event detection in clinical notes. Do not use it when a clean annotated training set is already available in sufficient size, since a fully supervised model is the simpler choice. Avoid it when the domain offers no reliable labelling heuristics, or when the noise is so unstructured that a label model cannot estimate source reliability from the available sources.

Limitations and considerations

  • Performance is bounded by the quality and coverage of the weak labelling sources; poor heuristics produce a poor training signal.
  • The label model adds parameters and design choices. Estimating source reliability requires overlap between sources, so with few or non-overlapping sources the estimates are weak.
  • On short or sparse sequences the RNN has little context to exploit, which limits any benefit from its sequential structure.
  • Systematic errors that are consistent across neighbouring positions can be reinforced by the recurrent context rather than corrected, because the context agrees with the mistake.
  • Training processes time steps in order, so the cost of training grows with sequence length.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Labels can be generated at scale from existing resources such as knowledge bases, rules, and crowd annotations, so the recurrent model can be trained on corpora that would be too costly to annotate by hand.
  • Token-level weak labels map directly onto the per-position outputs of an RNN tagger, so sequence labelling tasks need no change to the output structure.
  • The noise-handling step is separate from the recurrent architecture: soft labels or corrected losses can be used with a standard LSTM or GRU without redesigning the network.
  • Context from neighbouring positions, from one side or both depending on the architecture, may offset some isolated label errors, an advantage that a bag-of-words model, which ignores token order, cannot draw on.

Applications

  • Named entity recognition from distantly supervised or heuristically labelled corpora.
  • Relation extraction using knowledge-base alignment as distant supervision.
  • Sentiment and opinion classification from noisily labelled social media or review data.
  • Clinical event detection in electronic health records where expert annotation is expensive.
  • Time-series event labelling using rule-based weak signals as training supervision.

How it works

How it works

1

Weak labels are produced without manual annotation. Distant supervision matches sequences against external knowledge bases or databases, labelling functions encode domain heuristics, or crowdsourced annotations are aggregated. Each source is imperfect, and its coverage of the corpus varies, so the resulting labels are incomplete as well as noisy.

2

Because the weak labels are noisy, a noise-handling step is applied before or during training. One approach is a generative label model, as in data programming (Ratner et al., 2016), which combines labelling functions, estimates the reliability of each source and produces probabilistic soft labels. Other options include adjusting the loss with estimated noise rates and down-weighting examples that are likely mislabelled.

3

The RNN, typically an LSTM or GRU, is trained on the weakly labelled sequences using the soft or corrected targets. Backpropagation through time is the standard training procedure. A unidirectional RNN conditions each prediction on preceding positions only, whereas a bidirectional RNN conditions it on both preceding and following positions. In either case, a label error at one position may be partly offset by evidence in the context used, and whether this happens depends on how the errors are distributed.

4

At inference, the trained RNN produces a prediction for each position (for example token-level NER tags) or for the whole sequence (for classification). A conditional random field (CRF) layer is a common option on top of the RNN outputs for enforcing label consistency constraints across the sequence.

Common pitfalls

  • Training the RNN on hard weak labels as if they were ground truth, so that it learns to reproduce the source errors at every time step.
  • Evaluating on a weakly labelled test set instead of a clean, manually annotated held-out set, which overstates accuracy.
  • Using heuristics that cover mainly frequent entities or events, so the RNN sees few examples of rare patterns and the imbalance in the weak labels is inherited.
  • Relying on a single labelling function; a label model cannot estimate its reliability without other sources to compare against.
  • Applying the trained tagger to a target domain without checking that the labelling heuristics match that domain's vocabulary or event definitions.
  • Ignoring agreement between labelling sources: low agreement or very uneven coverage across classes signals that the weak labels may be too noisy or biased to train on directly.
  • Skipping a baseline comparison: without comparing against a simple majority-vote labelling baseline on the same clean test set, it is unclear whether the weakly supervised model adds value.

Frequently asked questions

What is the difference between weak supervision and semi-supervised learning for RNNs?

Semi-supervised RNNs leverage unlabeled data alongside a small clean labeled set, often via self-training. Weakly supervised RNNs instead use noisily labeled data generated from heuristics or external databases, so there may be no clean labeled examples at all. Both address label scarcity but through different mechanisms.

Do I always need a generative label model such as data programming?

Not always. Simpler approaches include majority voting over labeling functions, confidence thresholding, or adjusting the loss for estimated noise. A generative label model, as in data programming (Ratner et al., 2016), is most useful when you have multiple heterogeneous labeling sources whose individual reliabilities differ substantially.

How do I evaluate a weakly supervised RNN correctly?

Always evaluate on a clean, manually annotated held-out test set that was never exposed to the weak labels. Evaluating on weakly labeled test data gives an optimistic and misleading accuracy estimate.

Is a Transformer-based model better than an RNN for weak supervision?

Transformer-based models are a common alternative for the same sequence tasks, so the choice should be settled by evaluation on a clean test set rather than by assumption. An RNN can be a reasonable choice for long streaming sequences, for low-resource settings where pretrained transformer weights are not available for the domain, or where the computational cost of fine-tuning a large model is prohibitive.

How many labeling functions or heuristics do I need?

Several diverse labelling functions are needed so that a label model can compare their agreement and estimate their reliabilities. A single heuristic gives no basis for estimating its reliability and is better handled by simple filtering or thresholding.

Related methods

Sources

  1. Ratner, A., De Sa, C., Wu, S., Selsam, D., & Re, C. (2016). Data Programming: Creating Large Training Sets, Quickly. Advances in Neural Information Processing Systems (NeurIPS), 29.

    Open publication reference
  2. Zhou, Z.-H. (2018). A brief introduction to weakly supervised learning. National Science Review, 5(1), 44–53.

    Open DOI reference