TL;DR
Most language tagging systems in 2011 used linear classifiers fed with features that experts had designed for each task. The paper argues for a different route: one neural network that takes raw words, learns a vector for each word, and is trained end to end on each task. Its results were close to the best hand-engineered systems on part-of-speech tagging, chunking, named entity recognition and semantic role labelling. Pretraining the word vectors on about 852 million words of unlabelled text then narrowed most of the remaining gap.
Builds on: Word Embedding, Convolution, Backpropagation, Stochastic Gradient Descent · Leads to: Language Model pretraining and the learned-representation approach to NLP that followed
Why it mattered
Before this paper, a new language task meant a new feature set, often built on the output of other parsers. The paper showed that one architecture could cover four standard benchmarks with almost no task-specific engineering, and that the internal word vectors could be learned from unlabelled text and reused. The released tagger, SENNA, was fast and light enough to run on ordinary hardware, which was part of its influence. The idea that word vectors come from unlabelled data and then initialise supervised models is the pattern later pretrained language models followed, and later word-vector work such as word2vec (Mikolov et al., 2013) became the standard source of such vectors.
The paper is also a clear statement of a philosophy: treat benchmarks as indirect measures of how good the learned representations are, rather than as targets to optimise one at a time.
The problem
Four tasks label words in a sentence. Part-of-speech tagging gives each word a syntactic role. Chunking groups words into phrases such as noun phrases. Named entity recognition marks words that name a person, place or organisation. Semantic role labelling assigns roles such as ARG0 (the agent) and ARG1 (the thing acted on) to the words around a verb.
The best systems on these tasks used linear models over many engineered features. Some of those features came from external parsers, which made the systems slow and hard to combine. The paper's question is whether a model that starts from almost raw words can match them. A useful test is the gap between the current best systems and a plain neural network. The gap is small on the simplest task and large on the most complex one, because the best systems for semantic role labelling use the most engineered features.
How it works
Here is the window approach on one word, traced step by step. The paper uses the same steps for all four tasks, with a sentence-level variant for semantic role labelling.
- Look up a vector for each word. Every word in a dictionary has a row in a matrix . The lookup table returns the row for the word. The paper uses word vectors of size 50 and a dictionary of 100,000 words. Words outside the dictionary map to one special RARE vector.
- Gather a window. For the word to tag, take the vectors of the words in a fixed window around it. The walkthrough uses a window of three words: "the", "cat" and "sat", with "cat" the word to tag. Concatenate their vectors. Take the two-dimensional vectors , and , which gives the six numbers .
- Apply a linear layer and a non-linearity. Multiply the concatenated vector by a weight vector and add a bias. Use one hidden unit with weights on every entry and bias . Its value is . The HardTanh non-linearity clips values to the range from to , so the hidden value becomes . The clipping is cheaper than a true tanh and the paper reports no loss in accuracy from using it.
- Score each tag. Add an output layer with one score per tag. Take the scores and as the outputs for this window.
- Turn scores into probabilities. The softmax gives and . Check: the two numbers sum to 1.
- Train on the gold tag. If the gold tag is NOUN, the word-level loss is . Stochastic gradient descent moves the weights, the word vectors and the layers to raise this probability on the next pass over that window.
Each word is tagged this way. The sentence-level version in the paper replaces step 5 with a score for the whole sequence of tags, which includes transition scores between neighbouring tags.
- HardTanh(x)
- tanh(x), for comparison
flowchart LR W["window of word indices"] --> L["lookup table: one vector per word"] L --> C["concatenate window vectors"] C --> H["linear layer + HardTanh"] H --> S["one score per tag"] S --> P["softmax over tags"]
Worked examples
Use the vectors from the walkthrough, , and , and a window of size 1 centred on "cat".
- Look up the vector for "cat": .
- The window contains one vector, so the concatenated feature has two numbers: .
- Look up the vector for "the" and "sat" for the size-3 window instead: concatenation gives , which is six numbers.
Interpretation: a larger window gives the linear layer more context, and its input grows with the window size times the word-vector size. The paper's window was 5 words for the supervised tasks, so its input had numbers, plus the capital-letter features it adds.
Use the window , weights on each of the six inputs, bias , and the two tag scores from the walkthrough.
- Weighted sum: .
- HardTanh: , so the output is .
- Scores: , .
- Softmax: and , sum , so .
- Loss if the gold tag is NOUN: .
- If the gold tag were VERB, the loss would be , so the gradient is larger for the wrong tag.
Interpretation: the softmax turns scores into probabilities that always sum to 1, and the loss grows as the probability of the gold tag shrinks. Training pushes the gold tag's score up.
Table 8 reports the supervised network with word-level likelihood, with and without embeddings pretrained on unlabelled text. The LM2 column uses the larger language model. The benchmark row is the best published system for each task.
- Chunking (F1): benchmark ; network without pretraining ; network with LM2 embeddings . Gain from pretraining: . Gap left to the benchmark: .
- Named entity recognition (F1): benchmark ; without pretraining ; with LM2 . Gain: . Gap left: .
- Semantic role labelling (F1): benchmark ; without pretraining ; with LM2 . Gain: . Gap left: .
- Part-of-speech tagging (per-word accuracy): benchmark ; without pretraining ; with LM2 . Gain: . Gap left: .
- The sentence-level likelihood with LM2 gives for chunking and for SRL, so for SRL the sentence-level model is about 16 points ahead of the word-level model with the same embeddings.
Interpretation: pretraining helps every task, and the largest gain is on named entity recognition (7.43 points). Semantic role labelling stays furthest from its benchmark, 19.58 points behind even with pretraining.
Try it: using the sentence-level numbers with LM2, what is the gap between the benchmark and the network on named entity recognition, and how does it compare with the gap for chunking? Answer: for NER and for chunking. The two gaps are nearly equal, so the sentence-level model with pretrained embeddings is almost level with the benchmark on both.
Common mistakes and tradeoffs
It is tempting to think that a neural network with raw words needs no linguistic knowledge. In fact the paper keeps two small features on purpose, a lower-cased word and a capitalisation feature, and it replaces numbers with a single token. Those choices reduce the dictionary and carry some information the lower-casing loses.
It is tempting to think that the learned word vectors capture meaning from the labelled data alone. The paper's nearest-neighbour table for the SRL network trained from scratch (Table 6) gives neighbours of "france" such as "persuade" and "faw", which are not semantically related, which is why the paper turns to unlabelled data. The same vectors after language-model pretraining (Table 7) give neighbours such as "austria", "belgium" and "germany" for "france".
It is tempting to think that a sentence-level model is always better. In fact the paper finds that the sentence-level likelihood helps chunking, NER and SRL but has little advantage for POS (96.37 against 96.31 without pretraining). The window model is the simpler choice for POS.
It is tempting to think that the windowed model handles any task. The paper says it fails for SRL, where the tag depends on a verb that may fall outside the window. That is why SRL uses a convolutional sentence model with max pooling over the sentence.
When to use this approach: you have a sequence-labelling task, a fair amount of labelled data and a large unlabelled corpus in the same language, and you want a single model with few engineered features. When not to use it: the labelled data is tiny and no unlabelled text is available, or the task needs structure the model cannot represent without features from a parser. Alternatives include conditional random fields and hidden Markov models with engineered features, which the paper cites as the main earlier approach and which need their own feature design.
The math
For a sentence and a tag path , the network produces a score matrix , and the path score adds transition scores between neighbouring tags. The conditional probability of the gold path is the exponential of its score divided by the sum over all paths. The log-probability is the gold score minus a log-sum over all paths.
Step 1 and 2 in symbols
The lookup table returns the column of a matrix for word . A window of words gives a concatenated vector of length . In the walkthrough and , so the concatenated vector has six entries.
Step 3 in symbols
A linear layer computes , and HardTanh is applied element by element:
In the walkthrough the pre-activation falls in the top case, so HardTanh returns .
Step 5 in symbols
The softmax over the tags is . Its log is . In the walkthrough this gives , which matches the loss in step 6.
Sentence-level form
The path score is , and the log-likelihood of the gold path is . The log-add over all paths is computed with the recursion , followed by . The recursion costs time linear in the sentence length, although the number of paths grows exponentially. Inference replaces the log-add with a max, which is the Viterbi algorithm (see Viterbi Algorithm).
Ranking criterion for unlabelled text
For the language model, each window of real text should score higher than the same window with its centre word replaced by any other dictionary word . The paper minimises
This is a hinge loss over pairs (see Hinge Loss). It needs no normalisation over the dictionary, which is the expensive part of an entropy criterion, and it does not favour frequent phrases over rare but legal ones.
Results
The paper reports three kinds of result: supervised benchmarks, semi-supervised benchmarks and multitask training.
Supervised. Table 4 compares the vanilla network with the benchmark systems. Without unlabelled data the network reaches POS (sentence-level), chunking , NER and SRL , all below the benchmarks of , , and . The paper calls these results behind the benchmarks but in the ballpark of published systems.
Semi-supervised. Table 8 initialises the lookup tables with embeddings from LM1 (window 11, 100 hidden units, trained about four weeks on Wikipedia with a dictionary of 100,000 words) or LM2 (the same model, trained three more weeks on Wikipedia and Reuters with a 130,000-word dictionary). With the sentence-level likelihood and LM2, the scores are POS , chunking , NER and SRL . The worked example above gives the gains. The paper states that a larger language model gave better results, which suggests that more unlabelled text would help further.
Multitask. Section 5 shares the lookup tables and first hidden layer across tasks. Training POS, chunking and NER jointly with the window network gives 97.22, 94.10 and 88.62, against 97.20, 93.63 and 88.67 for the single-task model with LM2 embeddings (Table 9). The gains are small, and NER gets slightly worse.
What the results do not show: the benchmarks are the paper's chosen reference systems, and the paper notes that many of the top CoNLL systems used external labelled data. The hidden-layer sizes were chosen on validation data, and the paper picked the smallest network with reasonable performance rather than the top single run, because of the variance from initialisation. The training times are long: chunking and NER about an hour, POS a few hours and SRL about three days. The paper also reports the time the pretrained language models took, about four weeks and then three more weeks, which is a large cost before any supervised model is trained.
Reading guide
- Section 1 (Introduction). Needs Word Embedding and the idea of a benchmark task. Read for the philosophy: benchmarks as indirect measures of representation quality.
- Section 2 (The Benchmark Tasks). Needs the vocabulary of each task: POS tags, chunks, named entities and PropBank roles. Table 1 and Table 2 give the datasets and the state of the art. Skim the prior-system descriptions unless you want the history.
- Section 3.1 (Transforming Words into Feature Vectors). Needs One-Hot Encoding and Word Embedding. The lookup table is the only trainable part of the first layer.
- Section 3.2 (Extracting Higher Level Features). Needs Convolution and Max Pooling. The window approach is a one-layer case; the sentence approach uses convolution and a max over positions.
- Section 3.3 (Training). Needs Softmax, Maximum Likelihood Estimation and Stochastic Gradient Descent. Work through the sentence-level recursion with Conditional Random Field in mind, since the paper compares the two.
- Section 3.4 (Supervised Benchmark Results). Read Table 4 and Table 5 together with the hyper-parameter list in the text.
- Section 4 (Lots of Unlabeled Data). Needs Language Model and Semi-Supervised Learning. Read the ranking criterion and Table 8. Table 7 gives the neighbour lists that show what pretraining changes.
- Sections 5 and 6 (Multitask and task-specific engineering). Needs Transfer Learning and Support Vector Machine for the comparison points. Optional on first read.
Recap
- A single network with a learned word table can be trained end to end on four tagging tasks, with few engineered features.
- The window approach tags each word from its neighbours; the convolutional sentence approach handles tasks where the tag depends on a verb outside the window.
- The sentence-level likelihood, computed with a linear-time recursion, helps structured tags such as chunks and entities.
- Word vectors learned from a language model on about 852 million unlabelled words make the supervised tasks much better, and the nearest-neighbour lists become semantically meaningful.
- The largest remaining gap is in semantic role labelling, which the paper's own results leave open.
Read next: Language Model for the training objective behind the pretrained vectors, and Structured Prediction for the sequence-level view taken in Section 3.3.
Check yourself
QuestionRecall: why does the paper use a HardTanh layer instead of a plain linear layer stack?Show answer
Without a non-linearity, a stack of linear layers is still one linear function of the input, so it cannot extract non-linear features. HardTanh is a cheap non-linearity that clips values to the range from to , and the paper reports that it does not hurt generalisation compared with the exact tanh.
QuestionCompute: a network gives scores and for two tags, and the gold tag is A. What is the word-level loss ?Show answer
The softmax gives . The loss is .
QuestionWhy does the paper prefer a pairwise ranking criterion to an entropy criterion for the language model?Show answer
An entropy criterion needs the probability of each word given its context, and normalising over a dictionary of about 100,000 words is expensive. The entropy also weights frequent phrases heavily, which leaves little signal for rare but legal ones. The ranking criterion only compares a real window with corrupted windows, so it needs no full normalisation and treats rare legal phrases as important as common ones.
QuestionApplied: a team wants to tag tweets for named entities. They have 2,000 labelled tweets and a large unlabelled tweet corpus. Using the paper's results, which step should they copy first, and what should they expect?Show answer
They should copy the pretraining step first: train word embeddings on the large unlabelled corpus with a language model, then initialise the supervised lookup table with them. The paper shows this gives the largest gain on named entity recognition, moving the word-level network from to F1 on CoNLL 2003. Tweets differ from the Reuters and Wikipedia text the paper used, so the team should expect a smaller gain than the paper's and should check on held-out tweets.
Sources
- Collobert, R., Weston, J., Bottou, L., Karlen, M., Kavukcuoglu, K. and Kuksa, P. (2011). Natural Language Processing (almost) from Scratch. arXiv:1103.0398. https://arxiv.org/abs/1103.0398
- Mikolov, T., Chen, K., Corrado, G. and Dean, J. (2013). Efficient Estimation of Word Representations in Vector Space. arXiv:1301.3781. https://arxiv.org/abs/1301.3781