Relation Extraction and Distant Supervision
Labeling sentences by what a knowledge base already knows teaches a classifier the knowledge base's opinion of each entity pair. Bags, aggregation, and positive-unlabeled corrections recover facts, not sentences.
Overview & Motivation
A filing says “Martin Hollis has spoken publicly about Pellucid Software.” The named entity recognition topic finds the two names. Relation extraction asks the next question: does this sentence say how they are related? It does not. It mentions a person and a company and states nothing between them. Yet Hollis is Pellucid’s chief financial officer, and the corpus’s knowledge base knows it.
That gap is the subject of this page. Labeling sentences by hand is expensive, so the standard shortcut, distant supervision, labels them with the knowledge base instead: any sentence that mentions two entities is taken to express whatever the knowledge base holds between them. Our sentence gets the label CFO_OF. A classifier trained on such labels reads it as CFO_OF with probability , ahead of NA at . The same classifier trained on what each sentence actually states reads it as NA with probability .
On this corpus the second classifier is perfect: with sentence-level gold labels it scores F1 on both test sets, because the corpus is templated and its features read the templates exactly. So everything on this page is about supervision: what each way of labeling teaches. In order:
- What distant supervision learns. We prove it learns the expected distant label, which on a sentence that states nothing is a property of the corpus, not of the sentence, and does not shrink with data.
- At least one witness. Multi-instance learning labels bags of mentions. We prove what its gradient does to each mention and which mentions its labels can determine.
- From mentions to facts. How to aggregate, and why the right aggregator depends on how the model was trained.
- An incomplete knowledge base. Missing facts make distant supervision positive-unlabeled learning; we prove how the optimum shrinks and how evaluation against the same knowledge base misreports precision.
Then the finance case study: the named entity recognition topic’s tagger on companies held out from training, feeding the extractor, and the knowledge base that the next topic embeds.
Relation mentions and distant supervision
The corpus’s knowledge base, WORLD, holds facts over ten relations among companies, subsidiaries, officers, cities, regions, and sectors: CEO_OF, CFO_OF, IN_SECTOR, COMPETES_WITH, SUBSIDIARY_OF, PARENT_OF, ACQUIRED, HQ_IN, LOCATED_IN, and BASED_IN. Its documents are rendered from it. A fact sentence states a relation (“Martin Hollis, chief financial officer of Pellucid Software, reviewed …”). A co-mention sentence mentions a pair and states nothing; by the generator’s design, the knowledge base relates the pair of the time.
Definition 1 (Relation mentions and facts).
A sentence’s mentions are its entity spans, each linked to a knowledge-base entity when it names one. A candidate is an ordered pair of distinct linked mentions in one sentence, with entities and . Its gold label is the relation that the sentence states from to , or NA. A fact is a triple of knowledge-base entities. Sentence-level extraction labels candidates; fact-level extraction outputs facts.
Definition 2 (Distant supervision).
Label each candidate with , the set of relations the knowledge base holds from to , or with when it holds none. As a target distribution, .
Mintz, Bills, Snow, and Jurafsky (2009) put the assumption this way: any sentence containing both entities might express the relation. Every relation a sentence states is a knowledge-base fact, so distant supervision never misses one. What it adds is the problem.
Proposition 1 (Three sources of distant-supervision error).
A distant label that the sentence does not state falls into exactly one of three classes:
- entailed: follows from what the sentence states by the knowledge base’s own rules (BASED_IN HQ_IN LOCATED_IN, ACQUIRED PARENT_OF, PARENT_OF and SUBSIDIARY_OF inverse, COMPETES_WITH symmetric);
- overlap: it is not entailed, and the sentence states a different relation for the same ordered pair;
- co-mention: the sentence states nothing that yields .
Proof.
The three conditions are tested in this order, and the third is the complement of the first two, so each label lands in exactly one class.
∎The proposition is bookkeeping, but each class is a different failure. On the training corpus distant supervision makes labels, of which are stated: precision . Of the errors, are co-mentions, entailed, and overlaps (an acquisition sentence also labeled PARENT_OF, or the reverse). Entailed labels are the debatable ones. “From its head office in Toronto, Canada, Quillon Systems manages …” implies that Quillon is based in Canada, but the corpus’s annotation guideline marks it unstated, and we follow the guideline: those labels are errors for the sentence and true facts for the knowledge base. LOCATED_IN is the only relation with precision , since cities and regions are never co-mentioned. ACQUIRED has the lowest, . The DS labels tab of the lab shows the split.
What a distantly supervised classifier learns
The classifiers on this page are softmax logistic regressions over NA and the ten relations, on entity-blind features: the two entities’ types, which comes first, the words between them joined into one string and conjoined with that order, the between words and bigrams, and one word on each side (Mintz et al.’s lexical features). No feature names an argument’s own words. The conjunction matters. Which argument is the subsidiary depends on the template (“X, a subsidiary of Y” against “Y owns X”) as well as on the order, an interaction no sum of separate weights can represent: the XOR of the linear classifiers topic again. Without the conjunction, the gold-trained classifier scores on the seen test and on the held-out one, instead of .
Write for the features and for a classifier’s output.
Theorem 1 (Distant supervision learns the expected distant label).
Let be the distant-supervision risk. Over all conditional distributions, is minimized, uniquely for almost every , by
Because every stated relation is in ,
the chance that the sentence states , plus the chance that the knowledge base holds unstated.
Proof.
Condition on and write , a distribution over labels. Then , and for each
which by Gibbs’ inequality (formalML: KL divergence) is minimized exactly at . The decomposition splits and takes conditional expectations.
∎Corollary 1 (A co-mention's label is its base rate).
If a context never states a relation, then , where is the share of its pairs that the knowledge base relates. With the top relation and its share of the relation mass, argmax predicts if and only if
Neither quantity depends on the sample size.
Proof.
With nothing stated, exactly when , so , and the relations share the rest. Argmax compares the largest, , with .
∎Distant supervision is therefore not noisy in the way a coin flip is noisy. Its errors are a deterministic function of the context: the classifier learns, correctly, how often the knowledge base relates the pairs that appear in each kind of sentence. On the finance corpus there are eleven frequent co-mention templates, with base rates from to , and on each one the fitted classifier’s probability of some relation is within of the template’s training rate. “X commented on conditions across banking” has and one candidate relation (, IN_SECTOR), so the classifier labels it IN_SECTOR. Our overview sentence, “P has spoken publicly about X”, has split between CEO_OF and CFO_OF (): , a relation. “Analysts who cover X also follow Y” has and : , so NA, though its base rate is nearly as high.
The distantly supervised classifier scores sentence F1 on the seen-company test (precision , recall ) and on the held-out companies. It labels and of the related co-mentions with a relation, every entailed candidate, and only and of the unrelated ones. The What DS learns tab plots each template in the plane against the line . Its slider removes a share of the related co-mentions from training, which lowers each template’s : below no template crosses, and sentence F1 rises to . Removing data helps because the removed data was teaching the base rate.
At least one witness
Riedel, Yao, and McCallum (2010) replaced the distant assumption with a weaker one: if two entities are related, at least one sentence mentioning them might express it. They found the distant assumption wrong for of sampled New York Times candidates. On our training corpus it is wrong for of distant labels, while the at-least-one assumption fails for of the related (pair, relation) combinations (): pairs the knowledge base relates that the corpus never states.
Definition 3 (Bags and the at-least-one assumption).
A bag is every training mention of one ordered entity pair. At least one: if , some mention in the bag states ; if not, none does. With instance probabilities treated as independent, the bag’s likelihood for is the noisy-OR
when , and otherwise. Multi-instance learning (MIL) maximizes the sum of their logarithms over bags and relations.
This is Dietterich, Lathrop, and Lozano-Pérez’s (1997) multiple-instance problem, whose examples are positive when at least one of their instances is; “bag” is the later word. How does a bag’s label reach its mentions?
Theorem 2 (The bag gradient is an E-step).
Let independently and . Then
Proof.
By Fisher’s identity (Dempster, Laird, and Rubin 1977, Section 3; formalStatistics: hidden Markov models, Remark 16), , because . Here , so the conditional expectation acts term by term with weights . Since implies , .
∎Each mention is pushed toward in proportion to the posterior that it is the bag’s witness. The coefficients have a closed form.
Corollary 2 (One witness silences the rest).
As any other , this tends to , while the confident mention’s own coefficient tends to .
Proof.
From Theorem 2, the coefficient of is . With this is , and . If then and the numerator, which contains the factor for every , tends to .
∎The At least one tab opens the bag of our overview pair, Hollis and Pellucid, for CFO_OF. Four of its nine mentions state the relation (“Martin Hollis, chief financial officer of Pellucid Software, reviewed …”), and the MIL classifier gives them to . The five co-mentions get , and Corollary 2’s coefficient on each is : once the witnesses are confident, nothing pushes the co-mentions toward CFO_OF, and every bag in which the pair is unrelated pushes them toward NA. MIL labels no co-mention with a relation on either test. Zeng et al. (2015) train each bag on its single most probable mention, Corollary 2’s limit, where the other mentions receive nothing at all.
The same mechanism costs sentence recall. A stating mention whose bag already has a confident witness also stops learning, and if all its bags have one, nothing forces it to be labeled at all. Which mentions do the bag labels determine?
Proposition 2 (What the bag labels determine).
Let be a finite set of classes (here, templates), a hypothesis, and bags labeled by , so at least one holds. Let be the set of classes that occur in some negative bag. Then:
- is consistent with every bag label;
- it is the only consistent hypothesis if and only if every is the only non- class of some positive bag;
- in that case .
Proof.
(1) A negative bag holds only classes in , where . A positive bag holds a class with , which no negative bag can hold, so it holds a class outside . (2) Every consistent is on , so ; write with . If such an with is consistent, so is for any , since it is pointwise larger. That hypothesis fails exactly at a positive bag whose only non- class is . So a second consistent hypothesis exists if and only if some is the sole non- class of no positive bag. (3) is consistent.
∎The harness checks the proposition by brute force on random bag worlds. On the corpus, a stating template is forced for its relation when some training bag has it as its only template outside , and free otherwise. MIL’s recall on the seen test is on mentions of forced templates and on free ones ( and on the held-out test). The bag labels never ask for the free mentions, and Corollary 2 means the gradient does not either. Overall, MIL’s sentence precision is and its recall : F1 , below distant supervision’s .
From mentions to facts
A knowledge base needs facts, not sentence labels.
Definition 4 (Aggregating mentions into facts).
Score a fact by the max of over the mentions of (Mintz et al.’s and Hoffmann et al.’s deterministic OR) or by the noisy-OR over them, and predict the facts that score above .
Proposition 3 (Noisy-OR dominates the max, and saturates).
For probabilities , , and if every then .
Proof.
, since every other factor is at most , and .
∎Noisy-OR is MIL’s own likelihood, so MIL’s mention probabilities are trained for it. A classifier trained sentence by sentence has no such calibration, and a pair co-mentioned many times accumulates its weak probabilities toward . Scored against the world’s facts among the pairs each test co-mentions, the distantly supervised classifier’s fact precision is with the max and with noisy-OR on the seen test, and against on the held-out test, where six companies repeat many co-mentions. MIL keeps precision under noisy-OR. At the fact level MIL wins: F1 against distant supervision’s (seen) and against (held out), each with its own aggregator. MIL gave up sentences it did not need to recover the facts.
An incomplete knowledge base is positive-unlabeled
So far the knowledge base has known every fact. Real ones do not, and Mintz et al. note that their held-out evaluation “suffers from false negatives”. A mention of a pair the knowledge base forgot is labeled NA, so the NA class holds unlabeled positives.
Definition 5 (An incomplete knowledge base).
Each unordered entity pair that the world relates is known, with all of its facts, independently with probability and independently of the text. The mentions of an unknown pair are labeled NA.
This is Elkan and Noto’s (2008) “selected completely at random” assumption, applied to pairs (Bekker and Davis 2020 call it SCAR).
Theorem 3 (Incompleteness scales the optimum by c).
Let be Theorem 1’s optimum for the complete knowledge base and for the incomplete one. Then:
- for every , and ;
- a template with keeps under argmax if and only if ;
- Elkan and Noto’s estimator , the mean of over labeled positives, has expectation , which equals only if puts no mass on NA at the labeled positives.
Proof.
(1) Off NA, the incomplete label is with , independent of given the pair. Conditioning on the pair, , and Theorem 1 applies; NA takes the remaining mass. (2) Argmax compares with . (3) by (1), averaged over the labeled positives.
∎Part (1) is Elkan and Noto’s Lemma 1, , at the level of pairs. Part (3) makes explicit what their proof assumes, that the labeled positives are certain positives. Distant supervision’s own target is not: on co-mention positives it is , below , so for the complete knowledge base. Elkan and Noto recommend ; here it runs low.
Part (2) predicts something surprising, and the Incomplete KB tab shows it. As falls, the classifier’s relation mass falls in step ( of the complete classifier’s at , at , slightly below because the L2 prior shrinks the rarer signal more). Co-mention templates sit near Corollary 1’s threshold and fall below it first, while stating templates hold until . So a moderately incomplete knowledge base raises distant supervision’s sentence F1, from to at , before recall collapses ( at , at ). Dividing by the true restores recall to at least down to , and with it the co-mention false positives: F1 returns to about .
Proposition 4 (Held-out evaluation reports c times the precision).
For a set of predicted facts chosen independently of which pairs the knowledge base knows, the expected precision measured against the incomplete knowledge base is times the precision against the world:
Proof.
is fixed, and each true fact in lies in with probability , so linearity of expectation gives the result. False facts are never in .
∎From down, every fact the incomplete-KB classifier predicts is true, yet scored against an independent knowledge base of the same rate its precision reads at and at , as Proposition 4 predicts. Scored against the knowledge base it trained on, a case the proposition does not cover because the predictions depend on it, the readings are and .
Names the extractor never saw
Tap a point for its template. At κ = 1 the fitted P(relation) matches ρ within 0.05 on every template (Theorem 1). Moving κ left removes related co-mentions from training, which lowers each ρ; the decisions are refits, and π is drawn at its κ = 1 value. Removing data raises F1, because that data was teaching the base rate.
Where this sits
The named entity recognition topic returned spans; this page reads relations between them and aggregates the readings into facts. Its main theorem is a warning about the labels rather than the model: distant supervision teaches a classifier the knowledge base’s opinion of each pair (Theorem 1), multi-instance learning trades sentence recall for fact precision (Theorem 2, Proposition 2), and an incomplete knowledge base shrinks everything by its keep rate (Theorem 3). The output is a set of scored triples over companies, officers, places, and sectors, whose relations are symmetric (COMPETES_WITH), inverse (SUBSIDIARY_OF and PARENT_OF), and composed (BASED_IN from HQ_IN and LOCATED_IN). The next topic, knowledge-graph embeddings, asks which geometric models can represent those patterns.
Honest caveats
Implementation
The companion notebook (notebookPath) imports the topic’s Python module, which owns every number on this page. It imports the named entity recognition topic’s module for the test splits, the headline tagger and its predictions, and the masked-LM encoder’s states, and through it the linear classifiers topic’s softmax objective and the finance corpus with its knowledge base. Its harness checks:
- Proposition 1’s three sources against the corpus’s own distant-supervision precision;
- Theorem 1 on random finite worlds, and Corollary 1 on every frequent co-mention template;
- Theorem 2 and Corollary 2 by complex step, the MIL objective’s analytic gradient by complex step, and Proposition 2 by brute force;
- Proposition 3 on every classifier’s facts, Theorem 3 and Proposition 4 exactly on toys and across eight keep rates on the corpus;
- Proposition 5’s bound on both tests for every classifier, and every comparison this page states.
The laboratory reads its data from a JSON file that one of the harness’s tests requires to equal the module’s viz_payload() exactly, so the figure cannot drift from the code.
Connections
- Every classifier here is its softmax logistic regression; the order-conjoined between-string feature is its XOR lesson again, since which argument is the subsidiary depends on the template and the order together. linear-text-classifiers
- Theorem 1 says a distantly supervised classifier is calibrated, but to the wrong target: its probabilities forecast the knowledge base's label, not whether the sentence states the relation. language-model-calibration
References & Further Reading
- paper Distant Supervision for Relation Extraction without Labeled Data — Mike Mintz, Steven Bills, Rion Snow, and Dan Jurafsky (2009) Proceedings of ACL-IJCNLP 2009, 1003–11. Section 4: any sentence containing both entities might express the relation; Section 5.1: each lexical feature conjoins the words between the entities, their order, and a window, with the entity types; features are aggregated per entity pair; Section 7.1: held-out evaluation suffers from false negatives
- paper Modeling Relations and Their Mentions without Labeled Text — Sebastian Riedel, Limin Yao, and Andrew McCallum (2010) ECML PKDD 2010, Lecture Notes in Computer Science 6323, 148–63. The expressed-at-least-once assumption; the distant-supervision assumption fails for 31% of sampled New York Times candidates (Section 1, Table 1)
- paper Knowledge-Based Weak Supervision for Information Extraction of Overlapping Relations — Raphael Hoffmann, Congle Zhang, Xiao Ling, Luke Zettlemoyer, and Daniel S. Weld (2011) Proceedings of ACL-HLT 2011, 541–50. 18.3% of the Freebase facts matched to New York Times sentences have overlapping relations (Section 1); sentence-level labels join into facts through a deterministic OR (Section 3.2)
- paper Multi-instance Multi-label Learning for Relation Extraction — Mihai Surdeanu, Julie Tibshirani, Ramesh Nallapati, and Christopher D. Manning (2012) Proceedings of EMNLP-CoNLL 2012, 455–65. Latent sentence labels and pair labels modeled jointly
- paper Solving the Multiple Instance Problem with Axis-Parallel Rectangles — Thomas G. Dietterich, Richard H. Lathrop, and Tomás Lozano-Pérez (1997) Artificial Intelligence 89, no. 1–2: 31–71. Section 1: an example is positive if and only if at least one of its instances is (they say examples and instances, not bags)
- paper Learning Classifiers from Only Positive and Unlabeled Data — Charles Elkan and Keith Noto (2008) Proceedings of KDD 2008, 213–20. Section 2: labeled positives selected completely at random; Lemma 1, p(y = 1 | x) = p(s = 1 | x)/c; the estimators e1, e2, e3, with e1 recommended
- paper Maximum Likelihood from Incomplete Data via the EM Algorithm — A. P. Dempster, N. M. Laird, and D. B. Rubin (1977) Journal of the Royal Statistical Society, Series B 39, no. 1: 1–22. Section 3, Lemma 2 with Equation 3.2: the observed-data score equals the conditional expectation of the complete-data score (Fisher's identity, which they do not name)
- paper Distant Supervision for Relation Extraction via Piecewise Convolutional Neural Networks — Daojian Zeng, Kang Liu, Yubo Chen, and Jun Zhao (2015) Proceedings of EMNLP 2015, 1753–62. Section 3.5, Equations 8–9: each bag trains on its single most probable instance
- paper Neural Relation Extraction with Selective Attention over Instances — Yankai Lin, Shiqi Shen, Zhiyuan Liu, Huanbo Luan, and Maosong Sun (2016) Proceedings of ACL 2016, 2124–33. Attention over a bag's sentences down-weights the ones that do not express the relation
- paper Reducing Wrong Labels in Distant Supervision for Relation Extraction — Shingo Takamatsu, Issei Sato, and Hiroshi Nakagawa (2012) Proceedings of ACL 2012, 721–29. A generative model of the labeling process whose hidden variables flag wrong distant labels before training
- paper Matching the Blanks: Distributional Similarity for Relation Learning — Livio Baldini Soares, Nicholas FitzGerald, Jeffrey Ling, and Tom Kwiatkowski (2019) Proceedings of ACL 2019, 2895–905. Section 3.3: the entity-start representation, the final hidden states at the two entity-start marker tokens, concatenated
- paper Constructing Biological Knowledge Bases by Extracting Information from Text Sources — Mark Craven and Johan Kumlien (1999) Proceedings of ISMB-99, 77–86. Weakly labeled training examples made by pairing a database's facts with the abstracts it cites, the precedent Mintz et al. cite
- paper Learning from Positive and Unlabeled Data: A Survey — Jessa Bekker and Jesse Davis (2020) Machine Learning 109, no. 4: 719–60. Names the selected-completely-at-random assumption SCAR and surveys estimators of the label frequency c