On Parsing as Tagging
Paper · 2022 · Afra Amini and Ryan Cotterell
Summary
A constituency parser works out which words belong together and how those groups fit inside larger ones. In “She enjoys reading papers,” for example, “reading papers” forms a group inside “enjoys reading papers.” One way to predict that structure is to assign tags to positions in the sentence and then assemble the tree described by those tags. That choice creates a problem of its own. The parser needs an encoding that preserves the whole tree and puts the information needed for each prediction where the predictor can readily use it. Amini and Cotterell compare ways of meeting those requirements in constituency parsing.
The authors divide the task into linearization, learning, and decoding. Linearization writes the tree as a sequence. Learning assigns scores to the tags in that sequence, and decoding finds a high-scoring sequence that forms a valid tree. The paper uses this division to explain tetratagging, an earlier method that lists the internal nodes of a binary tree between its word positions. It shows that the same tags can be recovered from the actions of an ordinary bottom-up shift–reduce parser after transforming the grammar. A separate choice, scoring each tag independently of the other predicted tags, lets the predictor score all positions in parallel.
The authors measure deviation, the distance between a word and the position assigned its shift tag, the instruction that introduces that word into the parse. With the paper’s assignment of tag slots to words, in-order traversal guarantees zero deviation. Pre-order and post-order traversal can move a shift tag a distance that grows with sentence length. On the English Wall Street Journal test set, the exact decoder with independent tag scores reaches an FMeasure of 95.15 with in-order traversal, 94.56 with pre-order traversal, and 89.23 with post-order traversal. Giving the scorer access to dependencies between successive tags changes accuracy only slightly in the English comparisons.
The multilingual results broadly favor in-order traversal, with an important exception. On the Korean SPMRL test split, post-order reaches 86.64 FMeasure, above both other traversal orders. Across the multilingual comparisons, the paper reports a Pearson correlation of −0.77 between mean deviation and FMeasure. The paper also finds that the traversal changes how much stack space exact decoding needs. A beam can save search time when that requirement is high, but its cost in accuracy varies with the encoding. Together, these results show how the order used to represent a tree affects both the learning problem and the search needed to recover a tree.
Deep dive: On Parsing as Tagging
On Parsing as Tagging explains how constituency trees become tag sequences and why keeping tags aligned with words can improve parsing accuracy. · about 36 minutes to read
The problem and its context
From grammatical structure to a prediction problem
A sentence supplies a sequence of words. A constituency analysis supplies the nesting that the sequence leaves implicit. The leaves of the analysis follow the original word order, while nodes above them identify groups and assign grammatical categories. Two candidate trees can therefore yield exactly the same words. They can differ in the boundary of a group, the category assigned to it, or the group in which it is contained. Given a sentence, a statistical parser needs a way to represent these alternatives, score them, and choose among them.
The paper starts from a tradition of adapting formal parsing algorithms to that task. A grammar describes which productions can form a derivation, and weights allow the parser to prefer some derivations over others. Among the methods the authors discuss, shift–reduce parsing makes a useful point of comparison because it represents a derivation through a sequence of actions. A shift handles a word and a reduce handles a grammatical combination. The parser keeps track of unfinished work on a stack. The precise effect of an action on that stack depends on how the parser visits the tree. In a bottom-up traversal it can combine material already processed, while in a top-down traversal it can open a structure whose children still need to be visited.
That approach had already been applied to constituency parsing, as illustrated by A Classifier-Based Parser with Linear Run-Time Complexity and Fast and Accurate Shift-Reduce Constituent Parsing. The paper also gives examples from dependency parsing, where the structure links individual words to their heads. Its examples include Statistical Dependency Analysis with Support Vector Machines and Incrementality in Deterministic Dependency Parsing. The range of examples establishes the background for the comparison. A sequence of actions had long been a way to describe how a parser constructs structure.
An action sequence also suggests another way to organize prediction. If the actions can be written as tags attached to input positions, the scorer can use contextual representations of the sentence to make predictions at those positions. The decoder can then enforce the conditions required for a tree. A transition-based parser frequently incorporates legality into the action choices it makes from each state. A tagger can instead give scores to sequences that include impossible trees, then use the search procedure to rule those sequences out. The distinction concerns where the system imposes the constraints, and it matters because it changes what information must be carried during scoring.
Why encoding and alignment are separate decisions
In earlier work surveyed by the authors, some dependency taggers encoded a word’s relative position with respect to its head. That gives a natural place to put the tag. Its information is about a particular word, so the tag can be assigned to that word, even if its head is far away. The resulting predictions can still violate structural requirements when taken together. The paper describes the use of a tree constraint in Seq2seq Dependency Parsing and notes a comparison of encodings in Viable Dependency Parsing as Sequence Labeling.
Constituency trees present a different placement problem. A word supplies a natural position for a leaf, but an internal node can cover a group of words. Several internal nodes can also share one boundary. An encoding has to decide both how to describe those nodes and where their tags will be predicted. The earlier constituency encoding by Gómez-Rodríguez and Vilares used in-order traversal and recorded information about nonterminals and depth. Because depth was part of the tag, the possible inventory grew with the range of depths. Tetratagging retained an in-order treatment of the tree and used four structural tag types, distinguishing word events from internal-node events and recording the side of the parent on which each node occurs.
The paper also discusses a general conversion from transition sequences to tags that gathers the reduce actions associated with each shift into a single tag. This gives a tag at every word and ties that tag to the correct shift. Its cost is a potentially exponential tag inventory, since a single prediction can stand for a whole run of reductions. The number of prediction positions alone is therefore an incomplete measure of how economical a representation is. A short output sequence can transfer complexity into the set of values the scorer must distinguish. Tetratagging offers a useful comparison because it gives word-synchronous placement while retaining a small set of structural types.
The order in which a tree is visited had also been studied within transition-based constituency parsing, including in In-Order Transition-based Constituent Parsing. Amini and Cotterell bring traversal into a comparison that holds other parts of a tagger fixed. This makes it possible to ask whether the order matters when predictions are assigned to word positions, and to describe the same encoding both as a traversal of the original tree and as the result of actions on a transformed tree. The practical concern is that a change in traversal may look like a bookkeeping choice during annotation while changing the supervision that the predictor receives at each word.
The method, step by step
Preparing a tree and giving it a score
The pipeline starts with a sentence and its reference tree during training. The tree becomes a sequence of targets, and each target gets a position at which a scorer can predict it. At inference, the sentence supplies those positions. The scorer supplies candidate tag probabilities, and a constrained search recovers a candidate tree. The tree representation, position assignment, and search rule have to agree about what each tag means.
From reference trees to scored and decoded parses
The steps in order.
The formal starting point is a weighted grammar in Chomsky normal form, a restricted kind of context-free grammar. The paper uses the same letter for a set of categories and for sentence length. The notation below uses 𝒩 for the former so that the two are easy to distinguish.
G = ⟨𝒩, S, Σ, R⟩
Here G denotes the grammar. The angle brackets group its components. The finite set 𝒩 contains the nonterminal symbols, which label grammatical categories. S is the distinguished starting category in 𝒩. The alphabet Σ contains terminal symbols, which are the words at the leaves in this setup. R is the set of productions, each with a non-negative weight. The equality specifies the components that define G.
X → Y Z
The arrow indicates a production. X is the category being expanded, and Y and Z are its ordered left and right children. All of them belong to 𝒩. The binary rule creates a branch at which the two child subtrees have separate yields.
X → x
Here X is a category in 𝒩 and x is a terminal in Σ. The arrow now says that X yields a word. The paper assumes a nonempty input, so its grammar setup needs no start rule for an empty sentence.
w = w₁ w₂ ⋯ wₙ
Here w is the input sentence, and the subscripts mark word positions in display order. In this display, ₙ marks the last position, whose index is N, the sentence length. Each word belongs to Σ, and the ellipsis stands for any intervening words. The leaves of an ordered derivation tree for w have these labels in the same order. The tree may make different grammatical groupings, while its yield is fixed by w.
The authors use ρ to read the label of a node and π to read the production made at an interior node. Reading the production means using both the node’s own label and the labels of its children. At a binary branch that gives a parent and a pair of grammatical categories. At a node immediately above a word it gives a category and the terminal it produces. This supplies a way to attach a weight to each interior node by looking up the production it uses.
p(d_w | w) ∝ ∏_{ξ ∈ d_w} score(π(ξ))
Here d_w is a derivation tree with yield w, and p(d_w | w) is its probability for that sentence. The vertical bar indicates conditioning, and ∝ means proportional to. The product ∏ ranges over the interior nodes ξ of d_w, as indicated by ξ ∈ d_w. The function π returns the production at ξ, and score returns that production’s weight. The corresponding probability divides this product by the total weight of the candidate derivations for w. At least one candidate must have positive weight for that normalization to be possible.
This rule-level expression makes the later approximations easier to see. A binary production can receive a score specific to its parent and both children. A representation in which each tag records only its own category and side cannot directly set an arbitrary score for every such combination. The authors use the weighted grammar as a reference point for explaining which interactions the different tagging schemes retain.
The annotated trees also require preparation before the binary encoding can be applied. The authors concatenate category labels along chains of unary rules, where a parent has a single grammatical child. They binarize the resulting trees with NLTK. A position at the bottom of the binary structure corresponds to a word and its part of speech. The description of the traversal encodings assumes that part-of-speech tags are given. The authors explain that a setting without those tags would need to include the identity of the shifted category in the tag for the word.
Writing a tree as a sequence
Linearization turns a tree into a sequence with enough information to reconstruct it. The property the authors require is injectivity. Two different trees for the same sentence must be distinguishable by their tag sequences, and every tree in the domain must have an encoding. This permits the space of candidate tag strings to be larger than the space of valid representations.
Φ_w : D_w → T^M
Here Φ_w is the linearizer for w, and the colon introduces its domain and codomain. D_w is the set of derivation trees yielding w. T is the tag inventory, and T^M is the set of strings of length M made from that inventory. The arrow points from the tree space to the tag space. The paper requires M to be O(N), where O describes an upper bound on growth and N is the sentence length. The valid strings form a subset T_w of T^M, namely the encodings that can be inverted to recover a tree for w.
The three traversals compared in the paper use the same basic descriptions for the nodes they visit. At a word position, a SHIFT tag distinguishes a left child from a right child. At an internal binary node, a REDUCE tag carries the grammatical category and the side on which the node occurs. SHIFT and REDUCE name event types. Their order and the way they change the stack depend on the traversal. The four distinctions in tetratagging refer to the structural types. The category of an internal node is also part of what its tag must convey in the labeled representation.
The length of the sequence follows from the binary structure. Each word contributes a shift. Each binary branch contributes a reduce. A binary tree with N word positions has N − 1 binary branches after taking account of the word-level treatment just described.
M = 2N − 1
Here M is the number of tags, N is the number of words, and the right-hand side counts N shifts together with N − 1 reductions. The multiplication by 2 and subtraction of 1 give the resulting length. The count holds for the pre-order, post-order, and in-order encodings the authors compare. This shared length will let them assign the same capacity to each word under each traversal.
Pre-order visits a parent before either child and then visits the left subtree before the right subtree. In the example “She enjoys reading papers,” the top-down parser first records the sentence-level production. It then reaches the word “She,” before opening the verb phrase that contains “enjoys.” Inside that phrase it opens a smaller verb phrase for “reading papers.” The traversal therefore puts some structural decisions before the words to which they will ultimately refer. When it reaches a lexical production, the corresponding shift handles that word.
Post-order visits the left and right subtrees before their parent. The bottom-up parser for the same example shifts the words in sentence order. It has to see “reading” and “papers” before recording their verb phrase. It can then record the larger phrase and the sentence-level branch. In this example, several reductions occur together at the end. The difference between these orders is visible even though they visit exactly the same nodes and the word shifts stay in the same relative order. One traversal can accumulate structural tags before a shift, and the other can accumulate them after it.
In-order visits the left subtree, then the parent, then the right subtree. In the example, the sentence-level node is visited after “She” and before “enjoys.” The outer verb phrase occurs between “enjoys” and “reading,” while the inner verb phrase occurs between “reading” and “papers.” Each internal-node visit thus falls in a gap between adjacent words. The sides encoded on the tags identify how the nodes fit into the nesting. A decoder can use the structural types to determine whether it can legally continue at each gap and then use the labels when reconstructing the tree.
Obtaining in-order tags from shift–reduce actions
An in-order tree traversal gives a direct definition of tetratagging. The authors also derive its tag sequence from a bottom-up traversal by changing the representation that the bottom-up parser sees. They apply a right-corner transformation to the tree. In this representation, the parser encounters productions with composite categories that carry information about a larger constituent and a category associated with completing it. The transformed derivation can include an empty symbol that belongs to the transformation. That symbol contributes no input word.
The result is a correspondence between a bottom-up action sequence on the transformed tree and the in-order tag sequence of the original tree. The authors define an action-wise map and a merge procedure. The map distinguishes a lexical shift and the reduction shapes introduced by the transformation. The merge reads the mapped string in order and combines the designated adjacent tag types. The combination matters because an intermediate action boundary in the transformed derivation may belong inside a single tetratag in the original representation.
Φ_w^in(d_w) = merge(map(a_w^post-rc))
Here w is the sentence and d_w is its original derivation tree. Φ_w^in is the in-order linearizer for w. The symbol a_w^post-rc denotes the action sequence given by bottom-up, or post-order, shift–reduce parsing of the right-corner transformed tree. The function map substitutes a tag for each action. The outer function merge combines the specified adjacent outputs. Parentheses indicate the input of each function, and the equality says that both routes return the same sequence.
The appendix proves the equality by examining the tag group for a word. A group starts with a word tag and, unless it is the final word’s group, includes the following internal-node tag. The proof separates five possible configurations of the word in the original tree. For each configuration, it follows the corresponding portion of the transformed tree, writes the bottom-up actions, and applies the map and merge. Each case reproduces the group obtained from a direct in-order traversal. Checking the groups gives equality for the full sequence. The authors also report checking the resulting sequences against the original tetratags in their implementation.
The same construction has a top-down counterpart. A left-corner transformation changes the tree used by the top-down parser, and a corresponding map and merge recover the original in-order tags.
Φ_w^in(d_w) = merge(map(a_w^pre-lc))
Here Φ_w^in, d_w, and w have the same meanings as in the previous equation. The action sequence a_w^pre-lc comes from pre-order, or top-down, shift–reduce parsing of the left-corner transformed tree. The functions map and merge now refer to the versions for that transformation. The equality again concerns the resulting tag sequence. The experimental in-order system uses the right-corner construction.
The transformation and the independence assumption play different roles. The construction explains where the in-order sequence comes from. Independent tag scoring makes that sequence suitable for parallel prediction. The equivalence between action and tag sequences is a statement about representing a tree. It does not require that every way of scoring actions on a transformed tree give the same tree probabilities as the tagger.
Assigning tag slots to words
After linearization, the sentence and tag sequence still have different lengths. The authors define an alignment that assigns at most K tags to any word. The index of a tag in the original traversal and the word position that supplies its contextual representation are therefore distinct. The notation for the alignment makes both the word and the slot explicit.
Θ_K(w, t) = (t₁₁, …, t₁K, …, t_N₁, …, t_NK)
Here Θ_K is the alignment function with capacity K, w is the sentence, and t is the tag sequence. Each t_nk is the tag assigned to slot k at word position n. The displayed list groups slots by word, from the first position to N, and the ellipses stand for the intervening slots and groups. The notation allows a word to have fewer than K assigned tags. The parentheses delimit the output of the alignment.
The paper uses paired alignment. It assigns the first pair of tags to the first word, the next pair to the next word, and continues in that manner. The last word gets the remaining single tag. This arrangement is a consequence of the shared sequence length, and can be applied to any of the compared traversals without consulting the tree again. Whether the shift in a given pair introduces the word that receives that pair depends on the traversal.
deviation(w_n) = |n − l| when t_lk = SHIFT(w_n)
Here w_n is the word at position n. The tag t_lk is assigned to slot k of the word at position l. SHIFT(w_n) is the action that introduces w_n into the stack. The equality after “when” identifies the slot containing that action. The vertical bars take the absolute value of the difference, so a shift displaced to either side contributes a non-negative distance. The sequence is shift-aligned if this distance is zero for every word.
For in-order traversal, visiting an internal binary node separates the last word in its left subtree from the first word in its right subtree. Within each subtree the same property applies recursively. Accordingly, the traversal alternates shifts and reductions and ends with a shift. The shifts are in the same order as the words. Pairing consecutive tags therefore always puts the shift for a word in that word’s own group. This gives zero maximum deviation for any binary tree under the paired alignment, regardless of its nesting.
A left-branching tree can make pre-order behave very differently. The traversal can go through the internal ancestors of the first word before reaching that word. All those reductions occupy early tag slots. They can move the first shift into a pair assigned much farther along the sentence. In the extreme case used in the proof, the first word has the maximum displacement.
⌊N / 2⌋
Here N is the sentence length, the slash indicates division, and the floor brackets take the greatest integer at or below the resulting value. The expression is the maximum deviation attained by the example in the proof for pre-order. The paper gives an O(N) worst-case bound for both pre-order and post-order under paired alignment. The post-order proof uses an extreme right-branching tree. In both cases, linear growth describes a possible worst case. A corpus can contain trees with much smaller deviation.
Deviation measures a particular kind of locality. It concerns the word tag and the input position from which that tag is scored. A perfectly aligned shift says nothing by itself about how far the word is from another word in its constituent, how broad a span an internal tag describes, or how many decisions are needed to recover the tree. Its value is that the quantity can be calculated from a reference tree and an alignment before training. The authors can then test whether the resulting placement of supervision is associated with accuracy.
Learning scores with and without tag dependencies
For each word, the learner uses a representation from BERT, computed in the context of the full sentence. If a word occupies multiple sub-word units, its last unit supplies the final-layer representation for the tag projections. Each slot has its own projection matrix, and a softmax converts that slot’s projection into a distribution over tags. During fine-tuning, the reference tree provides the correct tag for each occupied slot.
The authors relate these predictions to the binary production score by considering what is kept together when that score is approximated. The independent approximation retains separate contributions for the left and right children.
score(X → Y Z) = score(• → Y •) × score(• → • Z)
Here X is the parent, while Y and Z are the left and right nonterminal children. The arrows show the production and the partial production descriptions used in scoring. The dots • mark positions whose identities are ignored by that factor. The first factor retains Y and its left-child role, and the second retains Z and its right-child role. The multiplication sign combines the two scores. The equality defines the approximation. This factorization is available with all three traversal orders because each encodes the child’s side.
The pre-order traversal gives the scorer another option. It places a parent immediately before the root of its left subtree. A first-order dependence between consecutive tags can thus retain the association of those two categories.
score(X → Y Z) = score(X → Y •)
The function score again assigns a weight, X is the parent, and Y and Z are its left and right children. The arrow indicates the production being scored. On the right, • ignores the identity of Z. The equality defines the left-dependent approximation, which keeps X and Y together in the score. The immediate adjacency that makes this possible follows from the pre-order traversal.
In post-order, the right child is placed immediately before its parent. The corresponding approximation retains their association.
score(X → Y Z) = score(X → • Z)
Here the production arrow, parent X, and children Y and Z retain their meanings. The dot • ignores Y on the right-hand side. This equality defines the right-dependent approximation. The score depends on X and Z, consistent with the adjacency available in post-order.
These are alternatives to scoring the full production, with different information available to them. The dependent forms can express an interaction between a parent and one child that the independent form omits. Their adjacency also identifies what a first-order conditional random field, or CRF, can use. A CRF can give different scores to successive pairs of tags. The paper compares that approach with a bidirectional long short-term memory network, or BiLSTM, added as an alternative way to introduce dependencies in the scorer.
Under independence, the paper writes the probability of the target string as a product of its slot probabilities. The equation below uses Ω to denote the occupied slots, so it applies directly to paired alignment with a single tag at the final word.
p(t | w) = ∏_{(n,k) ∈ Ω} softmax(W_k · bert(w_n | w))_{t_nk}
Here t is the target tag string obtained from the reference tree, w is the sentence, and p(t | w) is the sequence probability conditional on the sentence. The product ∏ ranges over the pairs (n,k) in Ω, the set of occupied word and slot indices. The index n picks word w_n, and k picks a slot assigned to it. The expression bert(w_n | w) returns the contextual vector for that word from the encoder’s last layer. W_k is the projection matrix for slot k, and the centered dot denotes its application to the vector. The function softmax normalizes the projected scores over the tag inventory. The subscript t_nk selects the probability of the correct tag at that word and slot. The equality gives the likelihood maximized during training.
Independence here is conditional on the sentence. The encoder can represent a word using information from other words, even though the scoring equation has no dependence on the other predicted tags. The scorer can therefore use evidence about distant words without first generating any output tags. What it gives up is the ability to adjust a slot’s score directly in response to the tag chosen at another slot. The paper distinguishes this expressiveness cost from the gain in parallelism that follows from having the input representations available together.
Searching for a valid tree
The highest-scoring tag at each position can produce a string that fails to form a tree. A reduction might require a stack configuration that has not been reached, or a sequence might terminate with unfinished work. The decoder searches among valid representations for the best one according to the scorer.
t* = argmax_{t ∈ T_w} p(t | w)
Here t* is a highest-scoring valid tag string for w. The operator argmax selects a string t that maximizes the expression to its right. The membership symbol ∈ restricts t to T_w, the set of tag strings that represent derivations for w. The term p(t | w) is the conditional score expressed as a probability. The equality defines the decoder’s target. Once a valid string is chosen, the linearizer’s injectivity gives the tree encoded by that string.
The exact decoder uses dynamic programming. The paper represents its search as a weighted directed acyclic graph. An edge emits a tag and updates the state, and following an edge always advances the number of tags processed. With independent scores, the paper’s construction tracks the stack height and the position in the string, with admissible tag transitions set by the traversal. The decoder does not need to carry a separate path for every arrangement of categories deeper in the stack. That compression relies on the scoring assumptions and the validity conditions of these encodings.
In the in-order graph, the stack has height 1 after the required first shift. Odd positions are for shift tags and even positions are for reduce tags. The graph admits only the transitions appropriate to the current position and stack height. The accepted endpoint has stack height 1 at the end of the tag sequence. In pre-order, a reduction opens a branch and increases the size of the stack of obligations. The next position must process the branch’s left child. A shift leads instead to processing a right sibling. The paper uses the resulting restrictions on tag types and stack height to define the pre-order graph and gives the corresponding graph for post-order. These are different legality graphs even though all three searches have the same fixed output length.
A compact way to express the update is to collect the admissible edges that lead into a destination state. The paper’s algorithm separates the shift and reduce candidates and takes the larger of their best scores.
W[v] = max_{(u,t) ∈ In(v)} (W[u] + log score(t))
Here W is the dynamic-programming chart. Its entry W[v] is the best cumulative log score for a path to state v. The state u is the predecessor and t is the tag emitted on the edge from u to v. The set In(v) contains the allowed predecessor and tag pairs for v, and ∈ restricts the maximum to those pairs. The function max takes the highest candidate value. The plus sign adds the log of the tag score to the best score already stored at u, and log is the logarithm. The tag score is evaluated at the current position. Using log scores turns the product of edge scores into a sum along the path.
When a score depends on the previous tag, two prefixes with the same length and stack height can lead to different continuation scores. The dependent dynamic program keeps the last tag in its state. Its edge contribution is the log score of the previous and new tags together. It can still merge prefixes that agree on the information needed by future decisions. Prefixes ending in different tags must remain separate until the search has accounted for that dependence.
O(dN|𝒩|)
This is the paper’s decoding time bound for independent scores. O describes an upper bound on growth. The quantity d is the maximum stack depth considered by the decoder, N is the sentence length, and |𝒩| is the number of nonterminal symbols. Juxtaposition means multiplication. The paper expresses the size of the tag inventory in terms of |𝒩| because the structural distinctions are paired with grammatical categories. The notation d here counts stack levels, whereas d_w earlier denoted a derivation tree.
O(dN|𝒩|²)
This is the corresponding bound for the first-order left- or right-dependent scoring case. The symbols O, d, N, and |𝒩| keep their previous meanings. The superscript ² squares the category count. The added factor accounts for remembering the previous tag and comparing possible tag pairs during the search. The paper notes that d can reach N in the worst case. Linear growth in the tag sequence length alone therefore does not establish a linear bound in sentence length for all trees.
Beam search offers a different way to limit work. At each position it keeps the h highest-scoring prefixes under consideration and drops the others. Here h is the beam width. Exact dynamic programming can preserve a lower-scoring prefix because it leads to a state whose future options differ. The beam can discard that prefix before those options become relevant. Its advantage is that the number of prefixes it advances is limited by h even if the exact search would consider a broad range of stack heights.
O(h log h N|𝒩|)
This is the beam-search time bound given in the paper. The symbol h is the beam width, log h is its logarithm, N is the sentence length, and |𝒩| is the category count. O denotes the growth bound and the adjacent terms are multiplied. The authors also give O(hN|𝒩|) as the bound obtainable with quickselect, where the same symbols apply and the logarithmic factor disappears. These are bounds for decoding once scores are available. The authors compare exact and beam search empirically because the relevant stack depth and the cost of pruning depend on the representation and the trees being parsed.
Experiments and results
Data, evaluation, and training
The English experiments use the Wall Street Journal portion of the Penn Treebank. The multilingual comparison uses the constituency data from the SPMRL 2013/2014 shared tasks. The paper retains the available training, development, and test splits. The tasks supply annotated trees for languages that differ in branching patterns and in the number of sentences available for training. The earlier shared-task overview is Overview of the SPMRL 2013 Shared Task.
| Language | Training sentences | Development sentences | Test sentences |
|---|---|---|---|
| English | 39,832 | 1700 | 2416 |
| Basque | 7577 | 948 | 946 |
| French | 14,759 | 1235 | 2541 |
| German | 40,472 | 5000 | 5000 |
| Hebrew | 5000 | 500 | 716 |
| Hungarian | 8146 | 1051 | 1009 |
| Korean | 23,010 | 2066 | 2287 |
| Polish | 6578 | 821 | 822 |
| Swedish | 5000 | 494 | 666 |
The main metric is FMeasure from the EVALB evaluation script. It combines the precision and recall of the predicted constituents when compared with the reference tree. Precision reflects how many predicted constituents match the reference, and recall reflects how many reference constituents the parser recovers. The score therefore concerns the constituents in the reconstructed parse. A tag can be easy or hard to predict, but its value for the experiment is measured through the tree it helps recover.
For English, the encoder is BERT-LARGE-UNCASED from the Hugging Face Transformers library. The multilingual experiments use BERT-BASE-MULTILINGUAL-CASED. The English traversal comparison keeps the independent scoring setup fixed while changing the linearizer. The learning comparison introduces either the CRF implementation in PyTorch or the BiLSTM scorer. The main BiLSTM has two layers and a hidden size set to the tag inventory size, approximately 150 cells. The authors release the implementation in the rycolab/parsing-as-tagging repository.
The training setup uses a batch size of 32 and samples sentences without replacement within an epoch. The learning rate is 3e-5 with a warmup over 160 training steps, and gradient clipping is set to 1.0. The training run checks development FMeasure 4 times per epoch. A failed improvement triggers a halving of the learning rate. The initial budget is 20 epochs, with termination after 3 consecutive learning-rate reductions. Test measurements use the checkpoint with the best development FMeasure. This makes development accuracy part of the training and selection procedure while leaving the test tree comparisons for the reported results.
The authors set the decoding stack-depth limit using the maximum they observe in the training set. The experiments run on three nodes equipped with NVIDIA GeForce GTX 1080 Ti GPUs, and the reported inference times are measured on a single GPU node. Their throughput metric is sentences per second. The beam comparisons use a beam width of 10. Accuracy and throughput are both measured because a decoding policy can change the selected tree as well as how long the search takes.
English constituency parsing
The clearest comparison uses independent scoring and exact dynamic programming for all traversal orders on the Wall Street Journal test split. The in-order configuration corresponds to the tetratagging setup. The authors use their own implementation and hardware, so the published tetratagging numbers are a separate measurement.
Independent taggers with exact decoding on the WSJ test set, FMeasure
In-order traversal scores highest, with post-order trailing both other traversals.
The numbers
| System or setting | FMeasure |
|---|---|
| Post-order | 89.23 |
| Pre-order | 94.56 |
| In-order (this paper) | 95.15 |
The in-order and pre-order variants are closer to the comparison score of 95.84 FMeasure that the paper cites for the Head-Driven Phrase Structure Grammar Parser on English. That published result provides context for the performance of a pipeline built around tag prediction. The strongest direct comparison within the paper comes from the systems that share the English encoder, training data, and scoring scheme.
Beam search changes the ranking of the stronger English variants. With independent scores, the WSJ test FMeasures under the beam are 91.59 for in-order, 93.57 for pre-order, and 85.38 for post-order. Thus the encoding that leads under exact search has a lower beam result than the pre-order variant at the beam width tested. The paper finds the largest practical decoding speed gains for post-order, where the exact search has to handle a deeper stack. The accuracy cost is substantial in that setting. Which decoder makes sense therefore depends on which linearization the scorer is using and how well the beam retains viable candidate paths.
Test results across languages
The multilingual comparison asks whether the traversal ordering observed in English also appears on the SPMRL test splits. The taggers in this part use independent scoring. The comparison rows in the paper come from Multilingual Constituency Parsing with Self-Attention and Pre-Training and Constituency Parsing with a Self-Attentive Encoder. They provide external benchmarks for the systems the authors run. The traversal variants within a language provide the controlled comparison.
| SPMRL test language | Multilingual self-attention | Self-attentive encoder | In-order tags | Pre-order tags | Post-order tags |
|---|---|---|---|---|---|
| Basque | 91.63 | 89.71 | 89.86 | 87.98 | 81.05 |
| German | 90.20 | 87.69 | 88.34 | 88.18 | 78.07 |
| Hebrew | 92.99 | 90.35 | 91.40 | 89.45 | 64.21 |
| Hungarian | 94.90 | 92.69 | 93.81 | 90.69 | 76.24 |
| Polish | 96.36 | 93.69 | 95.20 | 94.84 | 86.91 |
| Swedish | 88.86 | 84.45 | 86.66 | 84.65 | 58.44 |
All entries in this comparison are FMeasures on the named language’s test split. In-order gives the highest tagging result in each language shown in the table. The margins between pre-order and in-order vary. German has close results for those two encodings, while Hungarian separates them more clearly. Across these rows the stronger published multilingual parser remains ahead. The gap between the tested tagging variants is nonetheless large enough in several languages to make the choice of traversal consequential even before comparing the tagging approach with a different parser architecture.
French and Korean illustrate two different departures from the English order of results. In French, the pre-order and in-order variants are close, and pre-order has the higher FMeasure. The reported self-attention baselines for this SPMRL test split are 87.42 for the multilingual parser and 84.06 for the earlier self-attentive encoder.
Independent traversal variants on the French SPMRL test set, FMeasure
Pre-order and in-order are close, while post-order scores much lower.
The numbers
| System or setting | FMeasure |
|---|---|
| Post-order | 56.97 |
| In-order | 84.54 |
| Pre-order (this paper) | 84.76 |
In Korean, post-order gives the strongest tagging score and also comes close to the earlier self-attentive encoder, whose FMeasure is 86.59 on this split. The published multilingual parser reaches 88.80 FMeasure on the Korean SPMRL test set.
Independent traversal variants on the Korean SPMRL test set, FMeasure
Post-order is the highest-scoring traversal on Korean.
The numbers
| System or setting | FMeasure |
|---|---|
| Pre-order | 81.81 |
| In-order | 84.89 |
| Post-order (this paper) | 86.64 |
This result puts a useful boundary on the comparison. The English ranking describes what happens under one distribution of tree shapes and the settings used for that dataset. In Korean, the order of the variants changes even though they still use the same paired assignment of tags to words within the comparison. To explain why post-order is particularly poor in some languages and remains competitive in Korean, the authors examine the placement of the shifted words and the stack requirements induced by the tree representations.
What the ablations show
Traversal changes the learning target
The main English comparison changes the order in which the nodes are enumerated while keeping the independent scorer and the exact search framework. Determining how well the scorer can learn the resulting targets is more informative here than asking which order describes the trees most compactly. The variants all have the same tag sequence length, and each representation can distinguish the reference trees. The main measured difference is that the score at a word position is sometimes being asked to predict a shift for a more distant word. The ordering also rearranges the internal-node tags and changes the legal transitions used during decoding. The experiment therefore shows the effect of choosing a traversal in the full pipeline. It does not vary deviation while holding every other consequence of traversal fixed.
The multilingual word-level analysis makes the proposed explanation more specific. The authors plot distributions of deviation from a random sample of 5000 sentences. For pre-order, the distribution peaks near zero in most languages they examine. The corresponding post-order distributions show a different pattern for French, Hebrew, and Swedish. The paper reports deviations as large as 30 for some words in those languages. The authors relate this to their tendency towards right-branching. In such a tree, a post-order traversal can reach many words before emitting the internal-node tags that belong above them. Assigning the resulting tag string in pairs can place those early shifts at word positions that precede their own words.
Korean gives a comparison in the other direction. The authors characterize it as left-branching and find that post-order places its word shifts closer to their corresponding input words. That follows the intuition of the traversal. A post-order traversal can close completed material as it works its way along a left-branching structure. It can therefore distribute reductions among shifts, avoiding some of the long runs of shifts that cause paired alignment to drift. This accounts for why the same post-order procedure has different locality profiles across treebanks. It also fits the Korean results, where post-order is the strongest tagging variant even though in-order has the formal shift-alignment guarantee.
The authors report a Pearson correlation of −0.77 between a linearizer’s mean word-level deviation and FMeasure in the per-language analysis, with a p value of 0.0001. The sign means that higher mean displacement tends to accompany lower parse scores in those comparisons. Averaging the word-level distances gives a different view from the theoretical worst-case result. A traversal with a linear worst case can still have many words that align well in a particular treebank. In turn, the negative correlation can coexist with Korean’s post-order result, because a single ordering of all settings by deviation need not reproduce their accuracy ranking.
Adding tag dependencies has a small effect
The scoring comparisons test whether the node relationships recovered by left- and right-dependent scoring improve parsing. For pre-order on the English WSJ test split with exact decoding, the independent score is 94.56 FMeasure, versus 94.47 with the left-dependent CRF and 94.38 with the left-dependent LSTM. Under beam search, the corresponding pre-order results are 93.57, 93.65, and 93.78. Thus the dependent scorers help slightly under the beam and give a slightly lower score in the exact comparison.
For post-order with exact decoding on the same split, the independent variant has 89.23 FMeasure. The right-dependent CRF gives 88.28, and the right-dependent LSTM gives 89.61. The beam figures for post-order are 85.38 with independence, 82.28 with the CRF, and 85.25 with the LSTM. The best exact post-order result comes from the dependent LSTM, but adding dependence does not produce a consistent gain across the scorer and decoder combinations. In particular, the CRF results show that giving the scorer a direct adjacent-tag interaction is insufficient by itself to recover the gap to the better traversal orders.
The authors suggest that BERT already captures useful dependencies between words. The contextual encoder has access to the sentence when it produces every word representation. If the evidence useful for choosing a tag relationship is already available in those vectors, direct access to a neighboring output tag may bring little improvement in the final tree metric. The experiment establishes the small measured effect of these additions under the tested conditions. The proposed explanation about the information retained by the encoder is a hypothesis.
A separate appendix comparison changes the pre-order BiLSTM from two layers to three. It reports recall of 93.76 and 93.93, precision of 94.5 and 94.45, and FMeasure of 93.9 and 94.19, respectively. The depth comparison is reported separately from the main WSJ test comparison and its table does not identify a split. Within that comparison, the deeper recurrent scorer has higher recall and slightly lower precision. The authors describe the overall effect of adding depth as minimal. This comparison concerns the size of the recurrent addition, whereas the CRF and LSTM comparisons concern the choice to introduce tag dependence in the first place.
Stack depth changes the cost of exact search
The English stack analysis asks how large a stack must be allowed before every reference tree in the WSJ test set can be represented. In-order reaches coverage of 1 with a stack of size 6. Post-order requires a stack of size 29 to cover the same test trees. Coverage here measures which reference trees fit under the depth limit. The curve can therefore say something about decoder workload independently of whether the scorer gives the reference tree enough probability to win the search.
For post-order, the measured need for deeper stacks matches the paper’s observation that exact decoding takes longer. The decoder can have many more stack heights to consider at each position, even though it does not need all the categories at those heights as its search state. Keeping a beam of 10 prefixes limits that work. In the post-order comparisons, the authors describe a beam-related drop of between 3 to 6 FMeasure points on WSJ. In the pre-order comparisons, they report a drop of less than 1 point. The raw scores also show a decline for the in-order configuration, so smaller stack requirements alone do not establish that a beam will preserve the path chosen by the exact decoder.
The formal discussion helps explain why the stack effect depends on tree shape. For purely right-branching trees, the right-corner transformation can reduce the required stack size to one, with a mirrored result for the left-corner transformation on purely left-branching trees. The authors note that a corner transformation can increase stack requirements for center-embedded trees. The observed English coverage therefore illustrates the distribution of stack needs in a particular test set. The usefulness of a beam follows from the interaction of that distribution, its pruning policy, and the scorer’s ability to put promising partial analyses near the top early in the search.
Limitations
Limits the authors state
The authors restrict the evaluation to constituency parsing. Their discussion connects the framework to dependency parsing and earlier transition-based work, but the experiments measure trees of nested constituents. A dependency representation has its own alignment choices and its own conditions for structural validity. The English and multilingual rankings therefore cannot be transferred directly to dependency encodings.
The experiments are organized to compare choices within tagging pipelines. The authors cite stronger external scores to put their results in context and leave open the possibility that a larger pretrained encoder would improve performance. The tested BERT configurations support comparisons under the stated conditions. The paper does not establish the best attainable results for each traversal or determine whether changes in encoder capacity would preserve the same margins among them.
The authors also flag the language coverage for branching direction. Korean is the only left-branching language available to them in this study. Its result demonstrates that the English ordering can change in another language, and the deviation analysis supplies an account of why post-order can work well there. Broader claims about left-branching languages would require more examples of that kind. The inclusion of eight languages beyond English gives the paper comparisons across distinct corpora, but it does not give equal evidence about every branching pattern.
Limits visible in the setup
The zero-deviation result is exact for in-order traversal under the paired alignment of binary trees. That is a claim about where a word’s shift tag is placed. It gives no equivalent guarantee about the difficulty of predicting constituent labels, the quality of the contextual evidence at a word, or the overall FMeasure that an encoder and decoder will obtain. The alignment experiments compare complete representations in which tag order, the placement of internal tags, and the space of legal continuations change together. The multilingual correlation supports the proposed role of locality while leaving those other factors in play.
Preprocessing also defines the scope of the comparison. Collapsing unary chains and binarizing the tree give every variant a shared representation with a fixed length. The in-order proof relies on that binary structure. The raw annotations can contain productions that first have to be converted to it. The deviation figures thus describe the encodings of the prepared trees, and different preparation choices could change the distribution of tree shapes the parser sees. The part-of-speech assumption additionally affects what SHIFT tags need to express. Requiring the same predictor to supply those categories would change the tag prediction problem.
The dependent scoring results concern the specific additions tested. A first-order CRF lets adjacent outputs interact, and the BiLSTM provides another scoring mechanism. The comparisons do not exhaust the kinds of dependence a parser could represent. They also measure constituent recovery through FMeasure, which can hide changes in the kinds of constituents correctly recovered if aggregate precision and recall stay close. The experimental conclusion is that the added scoring components have limited effects on the reported measures in these settings.
Exactness in the decoding experiments is relative to the scoring assumptions, legal transitions, and stack bound. The paper’s experimental bound comes from training trees. A valid tree that exceeds an imposed bound falls outside the search conducted with that bound, even when dynamic programming is exact over the paths it considers. Likewise, the beam experiment uses a particular width and inference setup. It establishes a speed and accuracy tradeoff there. It does not map that tradeoff across other beam widths, hardware, or distributions of sentence lengths.
Finally, an external baseline and an internal comparison answer different questions. The published results give a sense of how the tagging variants compare with other constituency parsers. The authors’ runs with the same encoder and scoring setup give more direct evidence for the effect of traversal. The evidence for alignment is strongest when the theoretical guarantee, the measured placement of word tags, and the within-language accuracy comparisons are considered together. The benchmarking scores on their own cannot attribute a gap between independently developed systems to the choice of linearization.
What came after
The later Sequence Labeling for Constituent Parsing: A Comparative Study and Encoding Innovations cites Amini and Cotterell’s work. Its stated scope continues the comparison of sequence encodings for constituent trees and includes new encoding designs. That makes linearization the point of continuity. Amini and Cotterell evaluate how established traversal choices change the targets assigned to word positions, while the later study places the design of the encodings themselves within a comparative investigation.
The citation and the later study’s title establish that connection at the level of the research question. They leave open which particular encodings the later study adopts from Amini and Cotterell, whether it uses their deviation measure, and whether its experiments reproduce the reported rankings. The paper’s continuing relevance to that comparison lies in the distinction it makes between encoding the entire tree and placing the information for each prediction. Both are properties a comparative study of constituency encodings can examine, with separate consequences for the learner and the decoder.
Cite
Cite as Afra Amini and Ryan Cotterell. 2022. On Parsing as Tagging. Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing.
@inproceedings{amini2022parsing,
title = {{On Parsing as Tagging}},
author = {Afra Amini and Ryan Cotterell},
booktitle = {Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing},
year = {2022},
doi = {10.18653/v1/2022.emnlp-main.607},
url = {https://doi.org/10.18653/v1/2022.emnlp-main.607}
}This page in Markdown https://md.research.elamur.ai/free/en/papers/amini-2022-parsing-as-tagging/