Sequence Labeling Parsing by Learning across Representations

We use parsing as sequence labeling as a common framework to learn across constituency and dependency syntactic abstractions.To do so, we cast the problem as multitask learning (MTL). First, we show that adding a parsing paradigm as an auxiliary loss consistently improves the performance on the other paradigm. Secondly, we explore an MTL sequence labeling model that parses both representations, at almost no cost in terms of performance and speed. The results across the board show that on average MTL models with auxiliary losses for constituency parsing outperform single-task ones by 1.05 F1 points, and for dependency parsing by 0.62 UAS points.


Introduction
Constituency (Chomsky, 1956) and dependency grammars (Mel'cuk, 1988;Kübler et al., 2009) are the two main abstractions for representing the syntactic structure of a given sentence, and each of them has its own particularities (Kahane and Mazziotta, 2015). While in constituency parsing the structure of sentences is abstracted as a phrasestructure tree (see Figure 1a), in dependency parsing the tree encodes binary syntactic relations between pairs of words (see Figure 1b).
Despite the potential benefits of learning across representations, there have been few attempts in the literature to do this. Klein and Manning (2003) considered a factored model that provides separate methods for phrase-structure and lexical dependency trees and combined them to obtain optimal parses. With a similar aim, Ren et al. (2013) first compute the n best constituency trees using a probabilistic context-free grammar, convert those into dependency trees using a dependency model, compute a probability score for each of them, and finally rerank the most plausible trees based on both scores. However, these methods are complex and intended for statistical parsers. Instead, we propose a extremely simple framework to learn across constituency and dependency representations.
Contribution (i) We use sequence labeling for constituency (Gómez-Rodríguez and Vilares, 2018) and dependency parsing (Strzyz et al., 2019) combined with multi-task learning (MTL) (Caruana, 1997) to learn across syntactic representations. To do so, we take a parsing paradigm (constituency or dependency parsing) as an auxiliary task to help train a model for the other parsing representation, a simple technique that translates into consistent improvements across the board.
(ii) We also show that a single MTL model following this strategy can robustly produce both constituency and dependency trees, obtaining a performance and speed comparable with previous sequence labeling models for (either) constituency or dependency parsing. The source code is available at https://github.com/ mstrise/seq2label-crossrep 2 Parsing as Sequence Labeling Notation We use w = [w i , ..., w |w| ] to denote an input sentence. We use bold style lower-cased and math style upper-cased characters to refer to vectors and matrices (e.g. x and W).
Sequence labeling is a structured prediction task where each token in the input sentence is mapped to a label . Many NLP tasks suit this setup, including part-of-speech tag-ging, named-entity recognition or chunking (Sang and Buchholz, 2000;Toutanova and Manning, 2000;Tjong Kim Sang and De Meulder, 2003). More recently, syntactic tasks such as constituency parsing and dependency parsing have been successfully reduced to sequence labeling (Spoustová and Spousta, 2010;Li et al., 2018;Gómez-Rodríguez and Vilares, 2018;Strzyz et al., 2019). Such models compute a tree representation of an input sentence using |w| tagging actions.
We will also cast parsing as sequence labeling, to then learn across representations using multitask learning. Two are the main advantages of this approach: (i) it does not require an explicit parsing algorithm nor explicit parsing structures, and (ii) it massively simplifies joint syntactic modeling. We now describe parsing as sequence labeling and the architecture used in this work.
Constituency parsing as tagging Gómez-Rodríguez and Vilares (2018) define a linearization method Φ |w| : T c,|w| → L |w| c to transform a phrase-structure tree into a discrete sequence of labels of the same length as the input sentence. Each label l i ∈ L c is a three tuple (n i , c i , u i ) where: n i is an integer that encodes the number of ancestors in the tree shared between a word w i and its next one w i+1 (computed as relative variation with respect to n i−1 ), c i is the non-terminal symbol shared at the lowest level in common between said pair of words, and u i (optional) is a leaf unary chain that connects c i to w i . Figure 1a illustrates the encoding with an example. 1 Dependency parsing as tagging Strzyz et al. (2019) also propose a linearization method Π |w| : T d,|w| → L |w| d to transform a dependency tree into a discrete sequence of labels. Each label r i ∈ L d is also represented as a three tuple (o i , p i , d i ). If o i > 0, w i 's head is the o i th closest word with PoS tag p i to the right of w i . If o i < 0, the head is the −o i th closest word to the left of w i that has as a PoS tag p i . The element d i represents the syntactic relation between the head and the dependent terms. Figure 1b depictures it with an example.
Tagging with LSTMs We use bidirectional LSTMs (BILSTMs) to train our models (Hochreiter and Schmidhuber, 1997;Schuster and Paliwal, 1997). Briefly, let LSTM → (x) be an abstrac-1 In this work we do not use the dual encoding by , which combines the relative encoding with a top-down absolute scale to represent certain relations. tion of a LSTM that processes the input from left to right, and let LSTM ← (x) be another LSTM processing the input in the opposite direction, the output h i of a BILSTM at a timestep i is computed as: Then, h i is further processed by a feed-forward layer to compute the output label, i.e. P ( . To optimize the model, we minimize the categorical cross-entropy loss, i.e. L = − log(P (y|h i )). In Appendix A we detail additional hyperpameters of the network. In this work we use NCRFpp (Yang and Zhang, 2018) as our sequence labeling framework.

Learning across representations
To learn across representations we cast the problem as multi-task learning. MTL enables learning many tasks jointly, encapsulating them in a single model and leveraging their shared representation (Caruana, 1997;Ruder, 2017). In particular, we will use a hard-sharing architecture: the sentence is first processed by stacked BILSTMs shared across all tasks, with a task-dependent feed-forward network on the top of it, to compute each task's outputs. In particular, to benefit from a specific parsing abstraction we will be using the concept of auxiliary tasks (Plank et al., 2016;Bingel and Søgaard, 2017;Coavoux and Crabbé, 2017), where tasks are learned together with the main task in the MTL setup even if they are not of actual interest by themselves, as they might help to find out hidden patterns in the data and lead to better generalization of the model. 2 For instance, Hershcovich et al. (2018) have shown that semantic parsing benefits from that approach. The input is the same for both types of parsing and the same number of timesteps are required to compute a tree (equal to the length of the sentence), which simplifies the joint modeling. In this work, we focus on parallel data (we train on the same sentences labeled for both constituency and dependency abstractions). In the future, we plan to explore the idea of exploiting joint training over disjoint treebanks (Barrett et al., 2018).

Baselines and models
We test different sequence labeling parsers to determine whether there are any benefits in learning across representations. We compare: (i) a single-task model for constituency parsing and another one for dependency parsing, (ii) a multi-task model for constituency parsing (and another for dependency parsing) where each element of the 3tuple is predicted as a partial label in a separate subtask instead of as a whole, (iii) different MTL models where the partial labels from a specific parsing abstraction are used as auxiliary tasks for the other one, and (iv) an MTL model that learns to produce both abstractions as main tasks.
Single-paradigm, single-task models (S-S) For constituency parsing, we use the single-task model by Gómez-Rodríguez and Vilares (2018). The input is the raw sentence and the output for each token a single label of the form l i =(n i , c i , u i ). For dependency parsing we use the model by Strzyz et al. (2019) to predict a single dependency label of the form r i =(o i , p i , d i ) for each token.
Single-paradigm, multi-task models (S-MTL) For constituency parsing, instead of predicting a single label output of the form (n i , c i , u i ), we generate three partial and separate labels n i , c i and u i through three task-dependent feed-forward networks on the top of the stacked BILSTMs. This is similar to . For dependency parsing, we propose in this work a MTL version too. We observed in preliminary experiments, as shown in Table 1, that casting the problem as 3task learning led to worse results. Instead, we cast it as a 2-task learning problem, where the first task consists in predicting the head of a word w i , i.e. 2 Auxiliary losses are usually given less importance during the training process. predicting the tuple (o i , p i ), and the second task predicts the type of the relation (d i ). The loss is here computed as L= t L t , where L t is the partial loss coming from the subtask t.
Double-paradigm, multi-task models with auxiliary losses (D-MTL-AUX) We predict the partial labels from one of the parsing abstractions as main tasks. The partial labels from the other parsing paradigm are used as auxiliary tasks. The loss is computed as L= t L t + a β a L a , where L a is an auxiliary loss and β a its specific weighting factor. Figure 2 shows the architecture used in this and the following multi-paradigm model.

Double paradigm, multi-task models (D-MTL)
All tasks are learned as main tasks instead.

Data
In the following experiments we use two parallel datasets that provide syntactic analyses for both dependency and constituency parsing.   PTB For the evaluation on English language we use the English Penn Treebank (Marcus et al., 1993), transformed into Stanford dependencies (De Marneffe et al., 2006) with the predicted PoS tags as in Dyer et al. (2016).
SPMRL We also use the SPMRL datasets, a collection of parallel dependency and constituency treebanks for morphologically rich languages (Seddah et al., 2014). In this case, we use the predicted PoS tags provided by the organizers. We observed some differences between the constituency and dependency predicted input features provided with the corpora. For experiments where dependency parsing is the main task, we use the input from the dependency file, and the converse for constituency, for comparability with other work. D-MTL models were trained twice (one for each input), and dependency and constituent scores are reported on the model trained on the corresponding input.
Metrics We use bracketing F-score from the original EVALB and EVAL SPMRL official scripts to evaluate constituency trees. For dependency parsing, we rely on LAS and UAS scores where punctuation is excluded in order to provide a homogeneous setup for PTB and SPMRL.

Results
Table 2 compares single-paradigm models against their double-paradigm MTL versions. On average, MTL models with auxiliary losses achieve the best performance for both parsing abstractions. They gain 1.05 F1 points on average in comparison with the single model for constituency parsing, and 0.62 UAS and 0.15 LAS points for dependency parsing. In comparison to the single-paradigm MTL models, the average gain is smaller: 0.05 F1 points for constituency parsing, and 0.09 UAS and 0.21 LAS points for dependency parsing. MTL models that use auxiliary tasks (D-MTL-AUX) consistently outperform the single-task models (S-S) in all datasets, both for constituency parsing and for dependency parsing in terms of UAS. However, this does not extend to LAS. This different behavior between UAS and LAS seems to be originated by the fact that 2-task dependency parsing models, which are the basis for the corresponding auxiliary task and MTL models, improve UAS but not LAS with respect to single-task dependency parsing models. The reason might be that    the single-task setup excludes unlikely combinations of dependency labels with PoS tags or dependency directions that are not found in the training set, while in the 2-task setup, both components are treated separately, which may be having a negative influence on dependency labeling accuracy. In general, one can observe different range of gains of the models across languages. In terms of UAS, the differences between single-task and MTL models span between 1.22 (Basque) and −0.14 (Hebrew); for LAS, 0.81 and −1.35 (both for Hebrew); and for F1, 3.06 (Hebrew) and −0.25 (Korean). Since the sequence labeling encoding used for dependency parsing heavily relies on PoS tags, the result for a given language can be dependent on the degree of the granularity of its PoS tags.
In addition, Table 3 provides a comparison of the D-MTL-AUX models for dependency and constituency parsing against existing models on the PTB test set. Tables 4 and 5 shows the results for various existing models on the SPMRL test sets. 3 Table 6 shows the speeds (sentences/second) on a single core of a CPU 4 . The D-MTL setup comes at almost no added computational cost, so the very good speed-accuracy tradeoff already provided by the single-task models is improved.

Conclusion
We have described a framework to leverage the complementary nature of constituency and dependency parsing. It combines multi-task learning, auxiliary tasks, and sequence labeling parsing, so that constituency and dependency parsing can benefit each other through learning across their representations. We have shown that MTL models with auxiliary losses outperform single-task models, and MTL models that treat both constituency and dependency parsing as main tasks obtain strong results, coming almost at no cost in terms of speed. Source code will be released upon acceptance.

Acknowlegments
This work has received funding from the European Research Council (ERC), under the European Union's Horizon 2020 research and innovation programme (FASTPARSE, grant agreement No 714150), from the ANSWER-ASAP project (TIN2017-85160-C2-1-R) from MINECO, and from Xunta de Galicia (ED431B 2017/01). features). Also, there are not many recent results for dependency parsing on the SPMRL datasets, probably due to the popularity of UD corpora. For comparison, we have included punctuation for this evaluation. 4 Intel Core i7-7700 CPU 4.2 GHz.

A Model parameters
The models were trained up to 150 iterations and optimized with Stochastic Gradient Descent (SGD) with a batch size of 8. The best model for constituency parsing was chosen with the highest achieved F1 score on the development set during the training and for dependency parsing with the highest LAS score. The best double paradigm, multi-task model was chosen based on the highest harmonic mean among LAS and F1 scores. Type of MTL model Weighting factor for each task 2-task D 1 3-task C 1 D with auxiliary task C D: 1 and C: 0.2 C with auxiliary task D C: 1 and D: 0.1 Multi-task C and D 1