End-to-end Sequence Labeling via Bi-directional LSTM-CNNs-CRF

State-of-the-art sequence labeling systems traditionally require large amounts of task-specific knowledge in the form of hand-crafted features and data pre-processing. In this paper, we introduce a novel neutral network architecture that benefits from both word- and character-level representations automatically, by using combination of bidirectional LSTM, CNN and CRF. Our system is truly end-to-end, requiring no feature engineering or data pre-processing, thus making it applicable to a wide range of sequence labeling tasks. We evaluate our system on two data sets for two sequence labeling tasks --- Penn Treebank WSJ corpus for part-of-speech (POS) tagging and CoNLL 2003 corpus for named entity recognition (NER). We obtain state-of-the-art performance on both the two data --- 97.55\% accuracy for POS tagging and 91.21\% F1 for NER.


Introduction
Linguistic sequence labeling, such as part-ofspeech (POS) tagging and named entity recognition (NER), is one of the first stages in deep language understanding and its importance has been well recognized in the natural language processing community.Natural language processing (NLP) systems, like syntactic parsing (Nivre and Scholz, 2004;McDonald et al., 2005;Koo and Collins, 2010;Ma and Zhao, 2012a;Ma and Zhao, 2012b;Chen and Manning, 2014;Ma and Hovy, 2015) and entity coreference resolution (Ng, 2010;Ma et al., 2016), are becoming more sophisticated, in part because of utilizing output information of POS tagging or NER systems.
Most traditional high performance sequence labeling models are linear statistical models, including Hidden Markov Models (HMM) and Conditional Random Fields (CRF) (Ratinov and Roth, 2009;Passos et al., 2014;Luo et al., 2015), which rely heavily on hand-crafted features and taskspecific resources.For example, English POS taggers benefit from carefully designed word spelling features; orthographic features and external resources such as gazetteers are widely used in NER.However, such task-specific knowledge is costly to develop (Ma and Xia, 2014), making sequence labeling models difficult to adapt to new tasks or new domains.
In the past few years, non-linear neural networks with as input distributed word representations, also known as word embeddings, have been broadly applied to NLP problems with great success.Collobert et al. (2011) proposed a simple but effective feed-forward neutral network that independently classifies labels for each word by using contexts within a window with fixed size.Recently, recurrent neural networks (RNN) (Goller and Kuchler, 1996), together with its variants such as long-short term memory (LSTM) (Hochreiter and Schmidhuber, 1997;Gers et al., 2000) and gated recurrent unit (GRU) (Cho et al., 2014), have shown great success in modeling sequential data.Several RNN-based neural network models have been proposed to solve sequence labeling tasks like speech recognition (Graves et al., 2013), POS tagging (Huang et al., 2015) and NER (Chiu and Nichols, 2015;Hu et al., 2016), achieving competitive performance against traditional models.However, even systems that have utilized distributed representations as inputs have used these to augment, rather than replace, hand-crafted features (e.g.word spelling and capitalization patterns).Their performance drops rapidly when the models solely depend on neural embeddings.
In this paper, we propose a neural network architecture for sequence labeling.It is a truly endto-end model requiring no task-specific resources, feature engineering, or data pre-processing beyond pre-trained word embeddings on unlabeled corpora.Thus, our model can be easily applied to a wide range of sequence labeling tasks on different languages and domains.We first use convolutional neural networks (CNNs) (LeCun et al., 1989) to encode character-level information of a word into its character-level representation.Then we combine character-and word-level representations and feed them into bi-directional LSTM (BLSTM) to model context information of each word.On top of BLSTM, we use a sequential CRF to jointly decode labels for the whole sentence.We evaluate our model on two linguistic sequence labeling tasks -POS tagging on Penn Treebank WSJ (Marcus et al., 1993), and NER on English data from the CoNLL 2003 shared task (Tjong Kim Sang and De Meulder, 2003).Our end-to-end model outperforms previous stateof-the-art systems, obtaining 97.55% accuracy for POS tagging and 91.21% F1 for NER.The contributions of this work are (i) proposing a novel neural network architecture for linguistic sequence labeling.(ii) giving empirical evaluations of this model on benchmark data sets for two classic NLP tasks.(iii) achieving state-of-the-art performance with this truly end-to-end system.

Neural Network Architecture
In this section, we describe the components (layers) of our neural network architecture.We introduce the neural layers in our neural network oneby-one from bottom to top.

CNN for Character-level Representation
Previous studies (Santos and Zadrozny, 2014;Chiu and Nichols, 2015) have shown that CNN is an effective approach to extract morphological information (like the prefix or suffix of a word) from characters of words and encode it into neural representations.Figure 1 shows the CNN we use to extract character-level representation of a given word.The CNN is similar to the one in Chiu and Nichols (2015), except that we use only character embeddings as the inputs to CNN, without character type features.A dropout layer (Srivastava et al., 2014) is applied before character embeddings are input to CNN.

LSTM Unit
Recurrent neural networks (RNNs) are a powerful family of connectionist models that capture time dynamics via cycles in the graph.Though, in theory, RNNs are capable to capturing long-distance dependencies, in practice, they fail due to the gradient vanishing/exploding problems (Bengio et al., 1994;Pascanu et al., 2012).
LSTMs (Hochreiter and Schmidhuber, 1997) are variants of RNNs designed to cope with these gradient vanishing problems.Basically, a LSTM unit is composed of three multiplicative gates which control the proportions of information to forget and to pass on to the next time step.Formally, the formulas to update an LSTM unit at time t are: where σ is the element-wise sigmoid function and is the element-wise product.x t is the input vector (e.g.word embedding) at time t, and h t is the hidden state (also called output) vector storing all the useful information at (and before) time t.U i , U f , U c , U o denote the weight matrices of different gates for input x t , and W i , W f , W c , W o are the weight matrices for hidden state h t .b i , b f , b c , b o denote the bias vectors.It should be noted that we do not include peephole connections (Gers et al., 2003) in the our LSTM formulation.

BLSTM
For many sequence labeling tasks it is beneficial to have access to both past (left) and future (right) contexts.However, the LSTM's hidden state h t takes information only from past, knowing nothing about the future.An elegant solution whose effectiveness has been proven by previous work (Dyer et al., 2015) is bi-directional LSTM (BLSTM).The basic idea is to present each sequence forwards and backwards to two separate hidden states to capture past and future information, respectively.Then the two hidden states are concatenated to form the final output.

CRF
For sequence labeling (or general structured prediction) tasks, it is beneficial to consider the correlations between labels in neighborhoods and jointly decode the best chain of labels for a given input sentence.For example, in POS tagging an adjective is more likely to be followed by a noun than a verb, and in NER with standard BIO2 annotation (Tjong Kim Sang and Veenstra, 1999) I-ORG cannot follow I-PER.Therefore, we model label sequence jointly using a conditional random field (CRF) (Lafferty et al., 2001), instead of decoding each label independently.
Formally, we use z = {z 1 , • • • , z n } to represent a generic input sequence where z i is the input vector of the ith word.y = {y 1 , • • • , y n } represents a generic sequence of labels for z.Y(z) denotes the set of possible label sequences for z.The probabilistic model for sequence CRF defines a family of conditional probability p(y|z; W, b) over all possible label sequences y given z with the following form: where ψ i (y , y, z) = exp(W T y ,y z i + b y ,y ) are potential functions, and W T y ,y and b y ,y are the weight vector and bias corresponding to label pair (y , y), respectively.
For CRF training, we use the maximum conditional likelihood estimation.For a training set {(z i , y i )}, the logarithm of the likelihood (a.k.a. the log-likelihood) is given by: Decoding is to search for the label sequence y * with the highest conditional probability: For a sequence CRF model (only interactions between two successive labels are considered), training and decoding can be solved efficiently by adopting the Viterbi algorithm.

BLSTM-CNNs-CRF
Finally, we construct our neural network model by feeding the output vectors of BLSTM into a CRF layer.Figure 3 illustrates the architecture of our network in detail.
For each word, the character-level representation is computed by the CNN in Figure 1 with character embeddings as inputs.Then the character-level representation vector is concatenated with the word embedding vector to feed into the BLSTM network.Finally, the output vectors of BLSTM are fed to the CRF layer to jointly decode the best label sequence.As shown in Figure 3, dropout layers are applied on both the input and output vectors of BLSTM.Experimental results show that using dropout significantly  improve the performance of our model (see Section 4.5 for details).

Network Training
In this section, we provide details about training the neural network.We implement the neural network using the Theano library (Bergstra et al., 2010).The computations for a single model are run on a GeForce GTX TITAN X GPU.Using the settings discussed in this section, the model training requires about 12 hours for POS tagging and 8 hours for NER.

Parameter Initialization
Word Embeddings.We use Stanford's publicly available GloVe 100-dimensional embeddings1 trained on 6 billion words from Wikipedia and web text (Pennington et al., 2014) We also run experiments on two other sets of published embeddings, namely Senna 50dimensional embeddings2 trained on Wikipedia and Reuters RCV-1 corpus (Collobert et al., 2011), and Google's Word2Vec 300-dimensional embeddings3 trained on 100 billion words from Google News (Mikolov et al., 2013).To test the effectiveness of pretrained word embeddings, we experimented with randomly initialized embeddings with 100 dimensions, where embeddings are uniformly sampled from range [− where dim is the dimension of embeddings (He et al., 2015).The performance of different word embeddings is discussed in Section 4.4.Character Embeddings.
Character embeddings are initialized with uniform samples from where we set dim = 30.Weight Matrices and Bias Vectors.Matrix parameters are randomly initialized with uniform samples from [− 6 r+c , + 6 r+c ], where r and c are the number of of rows and columns in the structure (Glorot and Bengio, 2010).Bias vectors are initialized to zero, except the bias b f for the forget gate in LSTM , which is initialized to 1.0 (Jozefowicz et al., 2015).

Optimization Algorithm
Parameter optimization is performed with minibatch stochastic gradient descent (SGD) with batch size 10 and momentum 0.9.We choose an initial learning rate of η 0 (η 0 = 0.01 for POS tagging, and 0.015 for NER, see Section 3.3.),and the learning rate is updated on each epoch of training as η t = η 0 /(1 + ρt), with decay rate ρ = 0.05 and t is the number of epoch completed.To reduce the effects of "gradient exploding", we use a gradient clipping of 5.0 (Pascanu et al., 2012).We explored other more sophisticated optimization algorithms such as AdaDelta (Zeiler, 2012), Adam (Kingma and Ba, 2014) or RMSProp (Dauphin et al., 2015), but none of them meaningfully improve upon SGD with momentum and gradient clipping in our preliminary experiments.Early Stopping.We use early stopping (Giles, 2001;Graves et al., 2013) 1 and 3, we apply dropout on character embeddings before inputting to CNN, and on both the input and output vectors of BLSTM.We fix dropout rate at 0.5 for all dropout layers through all the experiments.We obtain significant improvements on model performance after using dropout (see Section 4.5).

Tuning Hyper-Parameters
Table 1 summarizes the chosen hyper-parameters for all experiments.We tune the hyper-parameters on the development sets by random search.Due to time constrains it is infeasible to do a random search across the full hyper-parameter space.Thus, for the tasks of POS tagging and NER we try to share as many hyper-parameters as possible.
Note that the final hyper-parameters for these two tasks are almost the same, except the initial learning rate.We set the state size of LSTM to 200.Tuning this parameter did not significantly impact the performance of our model.For CNN, we use 30 filters with window length 3.

Data Sets
As mentioned before, we evaluate our neural network model on two sequence labeling tasks: POS tagging and NER.

Dataset WSJ CoNLL2003
Train The corpora statistics are shown in Table 2.We did not perform any pre-processing for data sets, leaving our system truly end-to-end.

Main Results
We first run experiments to dissect the effectiveness of each component (layer) of our neural network architecture by ablation studies.We compare the performance with three baseline systems -BRNN, the bi-direction RNN; BLSTM, the bidirection LSTM, and BLSTM-CNNs, the combination of BLSTM with CNN to model characterlevel information.All these models are run using Stanford's GloVe 100 dimensional word embeddings and the same hyper-parameters as shown in Table 1.According to the results shown in Table 3, BLSTM obtains better performance than BRNN on all evaluation metrics of both the two tasks.BLSTM-CNN models significantly outperform the BLSTM model, showing that characterlevel representations are important for linguistic sequence labeling tasks.This is consistent with  , 2014;Chiu and Nichols, 2015).Finally, by adding CRF layer for joint decoding we achieve significant improvements over BLSTM-CNN models for both POS tagging and NER on all metrics.This demonstrates that jointly decoding label sequences can significantly benefit the final performance of neural network models.and the importance of joint decoding with structured prediction model.

POS Tagging
Comparing with traditional statistical models, our system achieves state-of-the-art accuracy, obtaining 0.05% improvement over the previously best reported results by Søgaard (2011).It should be noted that Huang et al. (2015) also evaluated their BLSTM-CRF model for POS tagging on WSJ corpus.But they used a different splitting of the training/dev/test data sets.Thus, their results are not directly comparable with ours.

NER
Table 5 shows the F1 scores of previous models for NER on the test data set from CoNLL-2003 shared task.For the purpose of comparison, we list their results together with ours.Similar to the observations of POS tagging, our model achieves significant improvements over Senna and the other three neural models, namely the LSTM-CRF proposed by Huang et al. (2015) posed by Chiu and Nichols (2015), and the LSTM-CRF by Lample et al. (2016).Huang et al. (2015) utilized discrete spelling, POS and context features, Chiu and Nichols (2015) used charactertype, capitalization, and lexicon features, and all the three model used some task-specific data preprocessing, while our model does not require any carefully designed features or data pre-processing.
We have to point out that the result (90.77%) reported by Chiu and Nichols (2015) is incomparable with ours, because their final model was trained on the combination of the training and development data sets 4 .To our knowledge, the previous best F1 score (91.20) 5 reported on CoNLL 2003 data set is by the joint NER and entity linking model (Luo et al., 2015).This model many hand-crafted features including stemming and spelling features, POS and chunks tags, WordNet clusters, Brown Clusters, as well as external knowledge bases such as Freebase and Wikipedia.Our end-to-end model slightly improves this model by 0.01%, yielding a state-of-the-art performance.

Word Embeddings
As mentioned in Section 3.1, in order to test the importance of pretrained word embeddings, we performed experiments with different sets of publicly published word embeddings, as well as a random sampling method, to initialize our model.Table 6 gives the performance of three different word embeddings, as well as the randomly sampled one.According to the results in Table 6, models using pretrained word embeddings obtain a significant improvement as opposed to the ones using random embeddings.Comparing the two tasks, NER relies 4 We run experiments using the same setting and get 91.37%F1 score.

POS
For different pretrained embeddings, Stanford's GloVe 100 dimensional embeddings achieve best results on both tasks, about 0.1% better on POS accuracy and 0.9% better on NER F1 score than the Senna 50 dimensional one.This is different from the results reported by Chiu and Nichols (2015), where Senna achieved slightly better performance on NER than other embeddings.Google's Word2Vec 300 dimensional embeddings obtain similar performance with Senna on POS tagging, still slightly behind GloVe.But for NER, the performance on Word2Vec is far behind GloVe and Senna.One possible reason that Word2Vec is not as good as the other two embeddings on NER is because of vocabulary mismatch -Word2Vec embeddings were trained in casesensitive manner, excluding many common symbols such as punctuations and digits.Since we do not use any data pre-processing to deal with such common symbols or rare words, it might be an issue for using Word2Vec.9 illustrates the performance of our model on different subsets of words, together with the baseline LSTM-CNN model for comparison.The largest improvements appear on the OOBV subsets of both the two corpora.This demonstrates that by adding CRF for joint decoding, our model is more powerful on words that are out of both the training and embedding sets.

Related Work
In recent years, several different neural network architectures have been proposed and successfully applied to linguistic sequence labeling such as POS tagging, chunking and NER.Among these neural architectures, the three approaches most similar to our model are the BLSTM-CRF model proposed by Huang et al. (2015), the LSTM-CNNs model by Chiu and Nichols (2015) and the BLSTM-CRF by Lample et al. (2016).Huang et al. (2015) used BLSTM for word-level representations and CRF for jointly label decoding, which is similar to our model.But there are two main differences between their model and ours.First, they did not employ CNNs to model character-level information.Second, they combined their neural network model with handcrafted features to improve their performance, making their model not an end-to-end system.Chiu and Nichols (2015) proposed a hybrid of BLSTM and CNNs to model both character-and word-level representations, which is similar to the first two layers in our model.They evaluated their model on NER and achieved competitive performance.Our model mainly differ from this model by using CRF for joint decoding.Moreover, their model is not truly end-to-end, either, as it utilizes external knowledge such as character-type, capitalization and lexicon features, and some data preprocessing specifically for NER (e.g.replacing all sequences of digits 0-9 with a single "0").Recently, Lample et al. (2016) proposed a BLSTM-CRF model for NER, which utilized BLSTM to model both the character-and word-level information, and use data pre-processing the same as Chiu and Nichols (2015).Instead, we use CNN to model character-level information, achieving better NER performance without using any data preprocessing.
There are several other neural networks previously proposed for sequence labeling.Labeau et al. (2015) proposed a RNN-CNNs model for German POS tagging.This model is similar to the LSTM-CNNs model in Chiu and Nichols (2015), with the difference of using vanila RNN instead of LSTM.Another neural architecture employing CNN to model character-level information is the "CharWNN" architecture (Santos and Zadrozny, 2014) which is inspired by the feed-forward network (Collobert et al., 2011).CharWNN obtained near state-of-the-art accuracy on English POS tagging (see Section 4.3 for details).A similar model has also been applied to Spanish and Portuguese NER (dos Santos et al., 2015) Ling et al. (2015) and Yang et al. (2016) also used BSLTM to compose character embeddings to word's representation, which is similar to Lample et al. (2016).Peng and Dredze (2016) Improved NER for Chinese Social Media with Word Segmentation.

Conclusion
In this paper, we proposed a neural network architecture for sequence labeling.It is a truly end-toend model relying on no task-specific resources, feature engineering or data pre-processing.We achieved state-of-the-art performance on two linguistic sequence labeling tasks, comparing with previously state-of-the-art systems.
There are several potential directions for future work.First, our model can be further improved by exploring multi-task learning approaches to combine more useful and correlated information.For example, we can jointly train a neural network model with both the POS and NER tags to improve the intermediate representations learned in our network.Another interesting direction is to apply our model to data from other domains such as social media (Twitter and Weibo).Since our model does not require any domain-or taskspecific knowledge, it might be effortless to apply it to these domains.

Figure 1 :
Figure 1: The convolution neural network for extracting character-level representations of words.Dashed arrows indicate a dropout layer applied before character embeddings are input to CNN.
Figure 2 gives the basic structure of an LSTM unit.

Figure 3 :
Figure 3: The main architecture of our neural network.The character representation for each word is computed by the CNN in Figure 1.Then the character representation vector is concatenated with the word embedding before feeding into the BLSTM network.Dashed arrows indicate dropout layers applied on both the input and output vectors of BLSTM.

Table 1 :
based on performance on validation sets.The "best" parameters appear at around 50 epochs, according to our experiments.Hyper-parameters for all experiments.Fine Tuning.For each of the embeddings, we fine-tune initial embeddings, modifying them during gradient updates of the neural network model by back-propagating gradients.The effectiveness of this method has been previously explored in sequential and structured prediction problems(Collobert et al., 2011; Peng and Dredze, 2015).
Dropout Training.To mitigate overfitting, we apply the dropout method(Srivastava et al., 2014)to regularize our model.As shown in Figure

Table 3 :
Performance of our model on both the development and test sets of the two tasks, together with three baseline systems.

Table 4 :
POS tagging accuracy of our model on test data from WSJ proportion of PTB, together with top-performance systems.The neural network based models are marked with ‡.

Table 5 :
NER F1 score of our model on test data set from CoNLL-2003.For the purpose of comparison, we also list F1 scores of previous topperformance systems.‡ marks the neural models.

Table 7 :
Results with and without dropout on two tasks (accuracy for POS tagging and F1 for NER).

Table 8 :
Statistics of the partition on each corpus.It lists the number of tokens of each subset for POS tagging and the number of entities for NER.

Table 9 :
Table7compares the results with and without dropout layers for each data set.All other hyperparameters remain the same as in Table1.We observe a essential improvement for both the two tasks.It demonstrates the effectiveness of dropout in reducing overfitting.Comparison of performance on different subsets of words (accuracy for POS and F1 for NER).