A Structural Probe for Finding Syntax in Word Representations
Hewitt & Manning, 2019, A Structural Probe for Finding Syntax in Word Representations (Proceedings of the 2019 Conference of the North American Chapter of ACL: Human Language Technologies (NAACL-HLT 2019))
Subscriber deck — free during early access
17 cards
1 Introduction
- What question does the structural probe answer that earlier syntactic probes didn’t?Whether entire syntax trees are embedded in a model’s word representations: earlier probes tested pieces of syntactic knowledge (like POS or labels of given structures) but not whether whole parse trees are represented.
- Hewitt & Manning, 2019, A Structural Probe for Finding Syntax in Word Representations (Proceedings of the 2019 Conference of the North American Chapter of ACL: Human Language Technologies (NAACL-HLT 2019)), §1, p. 4129
- What is the structural probe hypothesis?That there is a linear transformation of the representation space under which squared L2 distance between two words’ vectors equals the number of edges between them in the parse tree, and squared L2 norm equals a word’s depth in the tree, even though the model was never trained on trees.
- Hewitt & Manning, 2019, A Structural Probe for Finding Syntax in Word Representations (Proceedings of the 2019 Conference of the North American Chapter of ACL: Human Language Technologies (NAACL-HLT 2019)), §1, p. 4129
- What did the structural probe find for ELMo and BERT?Such transformations exist for ELMo and BERT but not for baselines, and in a low-rank space: entire dependency trees are embedded implicitly in deep models’ vector geometry, analogous to word analogies being encoded as vector offsets.
- Hewitt & Manning, 2019, A Structural Probe for Finding Syntax in Word Representations (Proceedings of the 2019 Conference of the North American Chapter of ACL: Human Language Technologies (NAACL-HLT 2019)), §1, p. 4129
2 Methods
- Why do tree distances and depths capture a parse tree?Words at tree distance 1 are neighbours, which recovers the tree’s edges, and of two neighbours the one with greater depth is the child, which recovers edge direction. Distances also explain hierarchical behaviour, e.g. subject–verb agreement over attractor nouns: the verb is closer in the tree to its subject than to the attractors.
- Hewitt & Manning, 2019, A Structural Probe for Finding Syntax in Word Representations (Proceedings of the 2019 Conference of the North American Chapter of ACL: Human Language Technologies (NAACL-HLT 2019)), §2, pp. 4129–4130
- In the tree “the dog chased a cat” (chased is the root; dog and cat depend on chased; the on dog; a on cat), what are \(d(\textit{the}, \textit{cat})\) and the depths of the and chased?\(d(\textit{the}, \textit{cat}) = 3\) (the → dog → chased → cat). Depth counts edges to the root: \(\|\textit{chased}\| = 0\), \(\|\textit{the}\| = 2\).
- Hewitt & Manning, 2019, A Structural Probe for Finding Syntax in Word Representations (Proceedings of the 2019 Conference of the North American Chapter of ACL: Human Language Technologies (NAACL-HLT 2019)), §2, pp. 4129–4130
2.1 The structural probe
- Define the structural probe’s distance.For a linear map \(B \in \mathbb{R}^{k \times m}\) (equivalently the inner product with \(A = B^\top B\)), \(d_B(h_i, h_j)^2 = (B(h_i - h_j))^\top (B(h_i - h_j))\). \(B\) is trained so that these squared distances match tree distances for all word pairs.
- Hewitt & Manning, 2019, A Structural Probe for Finding Syntax in Word Representations (Proceedings of the 2019 Conference of the North American Chapter of ACL: Human Language Technologies (NAACL-HLT 2019)), §2.1, p. 4130
- What loss trains the structural distance probe?\(\min_B \sum_\ell \frac{1}{|s^\ell|^2} \sum_{i,j} \big| d_{T^\ell}(w_i^\ell, w_j^\ell) - d_B(h_i^\ell, h_j^\ell)^2 \big|\), the L1 difference between tree distance and predicted squared distance over all word pairs, normalized by the number of pairs per sentence.
- Hewitt & Manning, 2019, A Structural Probe for Finding Syntax in Word Representations (Proceedings of the 2019 Conference of the North American Chapter of ACL: Human Language Technologies (NAACL-HLT 2019)), §2.1, p. 4130
- Why did Hewitt and Manning use squared distances?Approximating tree distances and depths with squared vector distances and norms consistently worked better, and a metric and its square encode the same trees.
- Hewitt & Manning, 2019, A Structural Probe for Finding Syntax in Word Representations (Proceedings of the 2019 Conference of the North American Chapter of ACL: Human Language Technologies (NAACL-HLT 2019)), §2.1, p. 4130
2.2 Properties of the structural probe
- Why is the structural probe a strong claim about a representation space?It asserts that one inner product on the space makes squared distance, a global property, encode the syntactic distance between every pair of words, not just which word heads which. Probing distance rather than headedness also avoids arbitrary headedness conventions (PPs, determiners, auxiliaries).
- Hewitt & Manning, 2019, A Structural Probe for Finding Syntax in Word Representations (Proceedings of the 2019 Conference of the North American Chapter of ACL: Human Language Technologies (NAACL-HLT 2019)), §2.2, p. 4130
2.3 Tree depth structural probes
- How does the depth probe work?It trains \(B\) so the squared norm \(\|h_i\|_B^2 = (B h_i)^\top (B h_i)\) recreates each word’s depth (edges to the root), imposing a total order on the words of a sentence.
- Hewitt & Manning, 2019, A Structural Probe for Finding Syntax in Word Representations (Proceedings of the 2019 Conference of the North American Chapter of ACL: Human Language Technologies (NAACL-HLT 2019)), §2.3, pp. 4130–4131
3 Experiments
- Which baselines did Hewitt and Manning compare ELMo and BERT against?LINEAR (a left-to-right chain), ELMo0 (non-contextual character embeddings, no position information), DECAY0 (exponentially distance-weighted averages of ELMo0 vectors), and PROJ0 (ELMo0 contextualized by an untrained random BiLSTM of ELMo’s size): baselines with useful features that shouldn’t be able to parse.
- Hewitt & Manning, 2019, A Structural Probe for Finding Syntax in Word Representations (Proceedings of the 2019 Conference of the North American Chapter of ACL: Human Language Technologies (NAACL-HLT 2019)), §3, p. 4131
3.1 Tree distance evaluation metrics
- How is the distance probe evaluated?Build the minimum spanning tree of predicted distances and score it by undirected unlabeled attachment score (UUAS) against the gold tree; also compute the Spearman correlation between true and predicted distances per word, averaged over sentences of each length and then over lengths 5–50 (DSpr.).
- Hewitt & Manning, 2019, A Structural Probe for Finding Syntax in Word Representations (Proceedings of the 2019 Conference of the North American Chapter of ACL: Human Language Technologies (NAACL-HLT 2019)), §3.1, pp. 4131–4132
3.2 Tree depth evaluation metrics
- How is the depth probe evaluated?Norm Spearman (NSpr.): the Spearman correlation between true and predicted depth orderings, averaged within and then across sentence lengths 5–50; and root%: how often the least-deep predicted word is the true root.
- Hewitt & Manning, 2019, A Structural Probe for Finding Syntax in Word Representations (Proceedings of the 2019 Conference of the North American Chapter of ACL: Human Language Technologies (NAACL-HLT 2019)), §3.2, p. 4132
4 Results
- How did ELMo and BERT score with the structural probe compared with baselines?UUAS: LINEAR 48.9, best baseline PROJ0 59.8; ELMo layer 1 77.0, BERT-base layer 7 79.8, BERT-large layer 15 82.5. Depth root%: PROJ0 64.4 vs BERT-large layer 16 90.1. BERT-large beat BERT-base, which beat ELMo, with clear differences between layers.
- Hewitt & Manning, 2019, A Structural Probe for Finding Syntax in Word Representations (Proceedings of the 2019 Conference of the North American Chapter of ACL: Human Language Technologies (NAACL-HLT 2019)), §4, p. 4132
- How do we know the structural probe doesn’t just “learn to parse” any informative representation?Non-contextual baselines (ELMo0, DECAY0) barely beat a linear chain, and PROJ0, with all of ELMo’s capacity but no training, improved only by simple deviations from linearity; the probe is linear and constrained, unlike parser-based probes.
- Hewitt & Manning, 2019, A Structural Probe for Finding Syntax in Word Representations (Proceedings of the 2019 Conference of the North American Chapter of ACL: Human Language Technologies (NAACL-HLT 2019)), §4, p. 4132
4.1 Analysis of linear transformation rank
- How many dimensions does syntax need in ELMo and BERT, according to the structural probe?Surprisingly few: increasing the probe’s rank \(k\) beyond 64 or 128 gave no further gains in parsing accuracy, and all three models needed roughly the same rank.
- Hewitt & Manning, 2019, A Structural Probe for Finding Syntax in Word Representations (Proceedings of the 2019 Conference of the North American Chapter of ACL: Human Language Technologies (NAACL-HLT 2019)), §4.1, p. 4133
5 Discussion & Conclusion
- What are the structural probe’s limits as a test of syntax?A more complex probe (e.g. a bilinear dependency parser) would surely parse better; the structural probe tests a deliberately strict notion, that all word pairs know their syntactic distance as a global property of the space. Other probes trade off complexity, task and hypothesis differently.
- Hewitt & Manning, 2019, A Structural Probe for Finding Syntax in Word Representations (Proceedings of the 2019 Conference of the North American Chapter of ACL: Human Language Technologies (NAACL-HLT 2019)), §5, p. 4133
Source
- John Hewitt and Christopher D. Manning. 2019. A Structural Probe for Finding Syntax in Word Representations. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (NAACL-HLT 2019), pp. 4129–4138. License: CC BY 4.0. Flashcards adapted from this work. doi:10.18653/v1/N19-1419 https://aclanthology.org/N19-1419/