We propose a general framework for performing cross-context lexical analysis; that is, analyzing similarities and differences in term meaning and representation with respect to different, potentially overlapping partitions of a text collection. We apply our framework to three different tasks: semantic change detection (discovering words whose meanings changed over time), comparative lexical analysis over context (finding context-sensitive and context-insensitive terms), and word representation comparison (investigating randomness inherent in word embeddings).
We apply our framework to three different tasks: semantic change detection (discovering words whose meanings changed over time), comparative lexical analysis over context (finding context-sensitive and context-insensitive terms), and word representation comparison (investigating randomness inherent in word embeddings).
1 Introduction
Natural language is almost always used in a particular context (e.g., a particular time, location, or purpose), and thus the interpretation of a sentence, phrase, or word inherently depends on this context. Indeed, the whole subject area of pragmatics studies the ways in which context contributes meaning1. In this paper, we are interested in analyzing the variations of term meaning in different–but comparable–contexts and propose a general framework for performing cross-context lexical analysis (CCLA). We use CCLA to generally refer to any analysis of term meaning or term representation in different contexts, especially for understanding the differences and similarities in multiple contexts.
Due to the generality of the notion of context, CCLA can be useful in many ways. For example, when context is defined as the time period a piece of text is written, CCLA allows us to compare the
1https://en.wikipedia.org/wiki/ Pragmatics
meaning of a word in different periods and reveal how a word may have evolved over time (Hamilton et al., 2016). If context is defined as location, it would allow us to study variations in the meaning of a word over different locations, potentially revealing influences of some locations on others (Kulkarni et al., 2016).
In general, we can use any associated attribute values of text data—including metadata—as context to form a partition. For example, the institution of a research article’s author can be used as a “context variable” to partition the articles based on institutions or regions in the world of their authors.
Any meaningful partitioning of text data may also be regarded as implicitly defining a context value for each partition; sentiment analysis may allow us to define a sentiment context so positive and negative sentences would be regarded as belonging to different categories.
We can characterize any term in a specific context by its similarity to other terms in corresponding contexts. The similarity can be computed in many ways, including (e.g.) with word embeddings. This gives us a context-specific “term similarity profile” for every term. These profiles for the same term computed from different contexts can be compared to analyze the variations of term meaning across contexts.
Traditionally, such cross-contextual analysis has been done on a “topic-level” basis (Zhai et al., 2004; Mei and Zhai, 2006). However, this is limiting because only word co-occurrence data can be used to estimate the model. Thus, including distributional similarity metrics (or any other representation) is not built-in, and it is not obvious how to include it in a probabilistic model in an easily-interchangeable way. Lastly, relying solely on word co-occurrence statistics (which are often unigrams) misses opportunities to examine context windows of adjacent terms, which could be
2
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
useful for capturing word sense or ambiguity. CCLA can be used to perform analysis in three distinct ways: (1) a term focused approach, where the empha-
sis is placed on mining the terms themselves with respect to the collection of contexts. For example, we could detect words whose meanings have shifted over time (which we explore in section 3), or compare dialects of the same language across different regions; (2) a score focused approach, where the emphasis is placed on defining a scoring function over terms that can detect context-sensitive (representative) or context-insensitive (shared) terms (which we explore in section 4). This can be useful as a component in downstream tasks such as feature selection, transfer learning, and information retrieval; and (3) an annotation focused approach, where the emphasis is placed on understanding how the annotations for words change as a function of the context used to derive the annotation. We explore this in section 5, where we analyze the stability of two well-known word embedding methods. These focuses often intermix and overlap. This paper is organized in the following manner. Section 2 formalizes cross-context lexical analysis. Sections 3-5 investigate concrete applications of CCLA and illustrate each of the three focuses described above. Section 6 shows related work and section 7 concludes the paper.
All source code from this work is made publicly available online2. All datasets used in our experiments are also freely and publicly available.
2 A Framework for Cross-Context Lexical Analysis
We now formally define the framework for crosscontext lexical analysis. Critical to CCLA is the idea of a context view. We define a context view as a tupleCi = (Vi, fi), where Vi is a set of unique terms w ∈ Vi and fi : Vi → A is an annotation function that maps words from the vocabulary set Vi to some shared analysis space A. Potential annotations could be term probabilities (A = [0, 1]) or word vectors (A = Rd), depending on the eventual goal. Different contexts Ci and Cj may share word tokens, but each word’s annotation is specific to its context. That is, the term w = amazing
2url redacted for anonymous submission
may occur in both Vi and Vj , but fi(w) is not necessarily equal to fj(w). This allows us to compare the usage of the token amazing respective to each context. We refer to the set of all contexts as C.
The vocabularies for each context come from a backing set of text documents D. This may be a corpus in the conventional notion—like the IMDB movie reviews (Maas et al., 2011)—or it may be a collection of such corpora. Due to this flexible nature of context views, it is not a requirement that all contexts partition D; contexts may even overlap. Take the sentiment analysis dataset collection as an example: imagine that D contains documents from both IMDB and Yelp3. If we set A = Rd, we could define the contexts that comprise C over D in the following way: let CY ELP = (VY ELP , fY ELP ), where VY ELP is all the terms that occur in the Yelp business reviews and fY ELP (w) yields a d-dimensional word vector for w learned on the Yelp dataset; similarly let CIMDB have VIMDB as all of the terms that occur in IMDB and fIMDB(w) yield a d-dimensional word vector for w learned on IMDB; CPOS and CNEG can be defined similarly, with vocabularies and word vectors coming from only the positive and negative reviews across both datasets, respectively. We could add a background context CALL with a vocabulary consisting of all terms used across both datasets and with word vectors learned on the union of both datasets.
The comparison operator Φ takes multiple contexts and outputs a list of (word, score) tuples for each term in the shared vocabulary:
Φ(Cj , . . . , Ck)
= 〈 (w, φ(w,Cj , . . . , Ck) | w ∈
k⋂ i=j Vi
〉
where the scoring function φ is user-defined and task-specific. For example, if our task is to identify words used similarly across contexts, our scoring function can be specified to give high scores to terms whose usage is similar across the contexts.
The scored terms returned from Φ are able to be processed by operators such as head (return the highest-scored terms), tail (return the lowestscored terms), and average (return the average scores of all the terms).
3https://www.yelp.com/dataset_ challenge
3
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
As an example application, we can use disjoint temporal segments as our context views in a term-focused task. Let C1 be the initial time period context and let C2 be the final time period context. We wish to discover w ∈ V1 ∩ V2 that underwent semantic change. We define a φ such that a given term with similar annotations across C1 and C2 will have a higher score, and a given term with different annotations across C1 and C2 will have a lower score. Thus, when we run head(Φ(C1, C2)) the result is the terms that changed the least; tail(Φ(C1, C2)) will show the terms that changed the most, i.e., underwent semantic change. We discuss this particular application scenario in more depth in the next section.
3 Analysis of Semantic Change
The evolution of word usage is a well-studied area in linguistics. Also known as semantic change or diachronic analysis, it has received attention in the NLP community, most recently by Kim et al. (2014), Kulkarni et al. (2015), and Hamilton et al. (2016). All three methods are based on word embedding similarity, and learn separate embeddings for distinct time periods. For a brief outline of each method, see section 6. With these techniques, we can discover how words such as awful change meaning over time. In the 1850s, it meant solemn or majestic, whereas in the 1900s it meant terrible or horrible (Hamilton et al., 2016). Detecting and analyzing these semantic shifts allows us to learn about the culture and evolution of language.
We next formalize the problem in the CCLA framework and compare our findings to previous results.
3.1 CCLA Formulation
In this task, we will use disjoint temporal segments as our context views in a term-focused task. Let C1 be the initial time period context and let C2 be the final time period context. We wish to discover w ∈ V1 ∩ V2 that underwent semantic change.
We define the following scoring function:
φ(w,C1, C2) = cos(NN(w,C1), NN(w,C2))
where NN finds the top-k nearest neighbors of w in Ci (and their corresponding similarities) by using its d-dimensional word vector annotation fi(w) ∈ Rd. Since the word vectors are normalized to unit length, the nearest neighbors are calculated using a dot product.
Essentially, φ measures how similar the usage of a particular w is across the two contexts. Thus, to find words whose usage changed the most (i.e., underwent semantic change), we find the w’s with the least similar usage: tail(Φ(C1, C2)). To find the most stable words (i.e., those whose meaning changed the least), we would instead use head.
3.2 Experiments
We compare our method to Hamilton et al. (2016) and use the COHA corpus (Davies, 2010) to contrast word usage in English fiction between C1 = 1900 and C2 = 1990. For word annotations, we used PPMI, SVD, and SGNS (skipgram with negative sampling from Mikolov et al. (2013b)) word vectors released by Hamilton et al. (2016). We set k = 500 in the nearest-neighbor scoring function to capture a fair amount of similar words while reducing noise farther down in the neighbor lists.
Table 1 compares the results using the CCLA framework with the semantic change detection described in Hamilton et al. (2016). As with the previous work, we found SVD and SGNS to outperform PPMI. Interestingly, SVD appears to be slightly ahead of SGNS, in contrast to the previous results. Despite this, it has been shown that SVD may be superior to SGNS in some evaluation cases (Levy et al., 2015). Some detected words are shared with those found in Hamilton et al. (headed, gay) and some words were detected by multiple methods with CCLA (figured, gay, handling, compound).
Table 2 shows the nearest-neighbor lists for the words detected to have changed the most by SVD and SGNS. We see that plane shifted from meaning a type of inclined or flat surface to a shortened form of airplane. The term figured changed meaning from describing one’s figure (body) to an act of making a decision.
Words that changed the least (i.e., were the most similar) from 1900 to 1990 were noncontent words such as never, not, eight, six, and twenty. These are produced when using head(Φ(C1, C2)).
4 Comparative Lexical Analysis over Context
A context-aware lexical analysis allows us to discover both context-sensitive and contextinsensitive terms. Context-sensitive terms are those that may be used to represent their respec-
4
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
Vectors Method Top 10 words that changed from 1900s to 1990s PPMI Hamilton et al. know, got, would, decided, think, stop, remember, started, must, wanted CCLA gay, favorite, arrangement, please, which, handling, random, distributed, available, otherwise SVD Hamilton et al. harry, headed, calls, gay, wherever, male, actually, special, cover, naturally CCLA handling, plane, headed, gay, figured, compound, kid, random, reverse, division SGNS Hamilton et al. wanting, gay, check, starting, major, actually, touching, harry, headed, romance CCLA figured, guy, random, gay, chick, compound, notices, checking, perspective, handling
Table 1: Comparing methods to find the most-changed words between 1900 and 1990. Each method operates on a type of word representation (PPMI, SVD, or SGNS). We follow the conventions of Hamilton et al. (2016) in bolding terms the authors agree to be clearly correct after consulting a dictionary, underlining borderline cases, and leaving incorrect terms unmarked.
Word Vectors Nearest-neighbors in 1900s Nearest-neighbors in 1990s handling SVD ribbon, threads, buttons, silk, yellow delivery, enclosed, send, additional, tax plane SVD level, higher, above, horizon, beneath train, pilot, engines, jet, flight figured SGNS thread, lace, rip, lined, stockings figure, find, thought, pointed, remember guy SGNS jane, grey, thomas, chester, roger tough, person, kid, fellow, man
Table 2: Example words that changed dramatically during the 20th century. The examples were chosen from the top-20 mostchanged lists from words in Table 1.
tive context. For example, excellent and great could represent a positive sentiment context and bad and horrible could represent negative sentiment contexts. Context-insensitive terms are those that do not change across contexts, such as stop words. Intelligently assigning scores to these word types will allow us to rank words per context, and even allow us to discover ambiguous words (those whose meaning changes between contexts). Topic models have been used to address some of these issues, and we discuss their differences and limitations in more depth in section 6. Tan et al. (2015) investigated finding ambiguous terms between two corpora, but not in a general contextual text mining framework. In the next sections, we will show how to address these goals with CCLA.
4.1 CCLA Formulation
First, we will find ambiguous—or, “contextsensitive”— words between two disjoint contexts in a score-focused manner. We ask the following question: which words’ surroundings change the most between C1 and C2? In semantic change detection, C1 and C2 were time periods. Here, we will use contexts from the same time, but with different metadata attributes. Concretely, imagine D is a sentiment analysis dataset. If we let C1 = (V1, f1) where V1 is the set of all words used in positive documents and f1(w) is a d-dimensional word vector learned from only the positive documents, and similarly for C2 with the negative documents, we can discover (1) which words are the most stable between sentiments and (2) which words change the most (i.e., are ambiguous) between sentiments.
We will use the exact same φ as in section 3:
φ(w,C1, C2) = cos(NN(w,C1), NN(w,C2))
Now, using head(Φ(C1, C2)) we retrieve stable words between sentiment polarities and using tail we discover ambiguous words.
Second, we want to find words that are representative of their context. In the sentiment analysis example, we hope to find words like amazing in C1 and terrible in C2. To accomplish this, we design a second scoring function Φ′ which uses the previous Φ. We include a third “background” context CB that covers all the documents in D. To find representative words in C1 (i.e., positive words), we use head(Φ′(C1, CB)), where
φ′(C1, CB) = φ(C1, CB)− φ(C1, C2).
The first term compares word contexts in C1 with the background. Recall that φ gives a high score if the word shares similar neighbors and a low score if the word has different neighbors. A high score may result from two situations: (1) the word’s usage is the same in both contexts (e.g., a stop word), or (2) the word’s usage is primarily in C1, so when combined with CB , its usage doesn’t change.
To filter out the stop words from φ(C1, CB) we subtract φ(C1, C2), since the second term assigns high scores to stable words—stop words. This leaves terms that represent C1 well. Naturally, the same may be done to find words specific to C2.
4.2 Experiments
We perform a few different experiments on two popular sentiment analysis datasets, IMDB movie
5
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
IMDB Pos shift, magnificent, lovingly, observed, heartbreaking, determination, marvelous, tightly, globe, superbly Neg travesty, drivel, utter, inane, pile, abysmal, unfunny, idiotic, nonsensical, wretched Amb loggia, krigie, morton, clifford, griffin, chad, epps, deluise, perkins, ana Yelp Pos trails, gem, heavenly, freshest, wonderfully, gifts, tastings, hike, scrumptious, explore Neg zero, tasteless, edible, flavorless, apology, shitty, lousy, irritated, clerk, error Amb behavior, planner, advertising, reaching, silverware, arrogant, avoiding, gratuity, collections, cc
Table 3: Using embedding annotation similarity to discover the top positive, negative, and ambiguous terms for IMDB and Yelp. Each corpus treated independently as a separate CCLA problem.
Word Positive phrases Negative phrases loggia loggia is wonderful as tony’s boss loggia played his character so lamely watching o’connor and loggia [...] is pure poetry loggia is about as heroic as a bored businessman. loggia i always enjoyed watching in just seeing him yell ridiculous attempt at a hispanic accent. (sorry loggia.) krige great cast with alice krige and brian krause usually excellent alice krige is wasted in this one alice krige plays the borg queen again fantastically alice krige seems to shoulder the film, played by beautiful and talented alice krige. krige gave the only convincing performance morton love’s rebound with socialite anne morton (ruth roman) thriller from directors rocky morton and annabel cannavale, rory culkin, joe morton, sandra oh, john morton is too strong an actress to be relegated and morton selden (as oberon’s grandfather) is a poor replacement for bob morton’s charismatic clifford is a fledgling playwright named clifford anderson dumps louque for his mate clifford grayson old student named clifford anderson (christopher reeve) her love for his pal, clifford greyson (robert noland) impressed with christopher reeve as clifford anderson. his companion clifford grayson. what a yawn-fest griffin and co-stars griffin dunn (‘after hours’) how did lee and griffin become such deep friends send his younger brother (griffin dunne) to law school put together by the hack griffin jay who wrote griffin dunne is very well cast as the man his awful behavior, peter griffin has no excuse.
Table 4: Usage of the five most ambiguous words (all actors and actresses) in the IMDB dataset. In some cases, the same person is discussed in different ways; in others, people share the same name, leading to ambiguity.
reviews and the Yelp academic dataset. For all experiments, we used 300-dimensional word vectors as term annotations that were learned by GloVe (Global Vectors by Pennington et al. (2014)) with the following untuned parameters: window size = 15, max iterations = 25, and a minimum term count of 10 in each corpus.
Table 3 shows two separate CCLA experiments. In each case, we set C1 = terms from positive documents, C2 = terms from negative documents, and CB = terms from the entire dataset. As in section 3, we set k = 500 for the nearest-neighbor lists. We use Φ to discover ambiguous words and Φ′ to find representative words.
As expected, words such as travesty describe negative tones: “a hopelessly miscast, misdirected travesty of actors.” At first glance, shift may seem a strange choice for positive feelings, but when examined in context, it makes sense: “display her native rhythm and ability to shift tempo in the lavish production” and “a 180-degree shift from the idealistic rhetoric portrayed in [other] offerings.”
Ambiguous words offer hints at sentiment targets. In IMDB, the most ambiguous terms are all names of actors and actresses. Table 4 shows example sentences where these words are used. In Yelp, the ambiguous terms are more varied; staff behavior could be good or bad and silverware
could be clean or dirty. Credit cards (“CC”) may or may not be accepted.
Table 5 compares different context views that span both IMDB and Yelp. The “Shared” row sets C1 = all words in positive documents, C2 = all words in negative documents, and CB = words across all documents in both datasets.
The “Pos only” and “Neg only” rows splitCi by positive and negative documents across both corpora. Ambiguous words in these two rows refer to distinguishing terms between all positive documents based on the corpus or all negative documents based on the corpus.
For example, we can learn the following from this analysis: (1) magnificent is used similarly in both datasets for positive sentiment; (2) unparalleled is used differently in terms of positive and negative sentiment in both datasets; (3) disturbing can be a positive word to describe movies4, but is not a positive way to describe businesses; (4) helpful can be a positive word to describe businesses, but is not a positive way to describe movies; (5) overzealous is a negative word in both datasets, but used differently in IMDB vs. Yelp.
When comparing across corpora, we have
4“This movie is both disturbing and extremely deep” “. . .very compelling, even disturbing, a chill ran down my spine.”
6
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
Shared Pos magnificent, marvelous, breathtaking, heavenly, understated, splendid, exquisite, timeless Neg unfunny, incoherent, unimaginative, inane, abysmal, horrid, moronic, atrocious, nonsensical, idiotic Amb unparalleled, panoramic, unmatched, daunting, tantalizing, aligned, soft, hardworking, descriptive, serene Pos IMDB disturbing, effective, political, engaging, brutal, dramatic, touching, powerful, striking, shocking Yelp helpful, whipped, flaky, polite, generous, fluffy, prompt, quaint, trendy, efficient Amb orthodox, gargantuan, accented, mirrored, copious, pungent, textured, sweltering, conscientious, kooky Neg IMDB corny, contrived, unbelievable, unoriginal, convincing, wealthy, inept, graphic, scary, predictable Yelp watery, rubbery, polite, surly, oily, mushy, sticky, helpful, drenched, crusty Amb overzealous, ravenous, functional, desolate, impersonal, squashed, callous, grubby, sturdy, blah
Table 5: Using embedding annotations to compare term contexts between IMDB and Yelp. Cross-corpus lists show words that are used similarly in both collections. Corpus-specific lists show words that are used differently given a particular collection.
the issue of disjoint vocabulary. For example, “movie” is used much more in IMDB reviews than Yelp, even though the term occurs in both. Thus, when comparing positive reviews, “movie” will seem like it’s a positive word for IMDB. To combat this, we filter the lists from each cross-corpus analysis, only keeping adjectives.
Since each word is scored with respect to its context, it is a natural extension to use these scored terms in feature selection or even to estimate word polarity scores. Further, scoring terms based on sensitivity to different contexts can be very useful for domain adaptation and transfer learning since we can treat both the source domain(s) and the target domain as contexts to identify terms semantically “stable” across domains, which are intuitively more generalizable than terms very sensitive to domain variations. We would expect shared positive and negative terms between IMDB and Yelp to aid in other sentiment analysis tasks, where the corpus-specific terms are less helpful. The fact that this works even when there is no labeled data in the target domain results in a completely unsupervised way to received specialized knowledge.
5 Comparing Word Annotations
It is educational so study how annotations drawn from the same data are similar or different. There are many ways to compare embedding methods as annotations using downstream tasks like word analogies or word similarity scoring (Levy et al., 2015). But is there a way to explicitly compare the structure learned by these models? If we have a quantification of this structure, does it give any information about task performance? Levy et al. (2015) consider different word embedding parameters such as adding context vectors (GloVe and SGNS), eigenvalue weighting (SVD), and vector normalization. Other configurations mentioned (but not tested) are number of iterations, vector di-
mensionality, and effect of randomness. As a demonstration of CCLA’s flexibility in choice of context definition, we explore the concept of word embedding stability. We define word embedding stability as a measure of how consistent nearest-neighbor lists are across different runs of the same algorithm. Consistency is an important attribute when replicating results or comparing two methods against one another. Different random seeds may play some role in the quality of the word vectors, and methods that use random sampling (like SGNS) may be affected. Nearestneighbor lists are critical when solving word analogy problems or measuring the similarity between words, so this is the aspect of the word vectors that we will consider while measuring stability.
5.1 CCLA Formulation
In sections 3 and 4, we varied the vocabularies for each context. Now, we will vary the word annotations instead in annotation-focused experiments.
Let C1 and C2 represent the same text data (V1 = V2), but define f1(w) and f2(w) as yielding word vectors learned by the same word embedding method with a different random initialization. We wish to measure how similar the embeddings are for different runs of the same algorithm.
In the CCLA framework, one way to address this situation requires a similarity metric to measure the nearest-neighbors of the two runs. Before, we used cosine similarity with the term annotation dot product scores as term weights. If we want to stress the orders of the lists themselves, we should ignore the weights and use a ranking correlation metric. The flexibility of CCLA allows us to choose the best measure to suit our task. A rank difference near the top of the lists should be more detrimental than a rank difference farther down the list. In other words, heavy bias should be placed on getting similar top terms to match, rather than terms farther down the list. For this
7
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
●
●
● ● ● ●
0 5 10 15 20 25
0. 2
0. 4
0. 6
0. 8
1. 0
Stability: GloVe vs SGNS
Iterations
N D
C G
@ 2
0
● GloVe SGNS
Figure 1: Using NDCG of nearest-neighbor lists to measure the stability of GloVe and SGNS by iteration.
reason, we choose normalized discounted cumulative gain (NDCG) as our measure. Discounted cumulative gain is defined as
DCG@n = n∑
i=1
ri log2(i+ 1)
where each element at rank i has a relevance score ri. Normalized DCG divides DCG by the ideal ranking, i.e. sorting the top n elements by their relevance and taking their DCG.
To measure embedding stability, we consider the two ranked nearest-neighbor lists for w from C1 and C2. Without loss of generality, call C1’s list the ideal ranking and assign the relevance scores n, n − 1, . . . , 1 to the top n items. We then measure NDCG of C2 with respect to C1’s neighbors as a rank correlation metric, defining the function NDCG@n(w,C1, C2). Therefore, stable methods will have a higher average NDCG@n than less stable methods. We can now state φ for embedding stability measurement as
φ(w,C1, C2) = NDCG@n(w,C1, C2)
and overall stability score average(Φ(C1, C2)). Note that we can use this framework to compare embeddings not only from different seeds, but from different algorithms or even dimensions. This measure could be used to see how similarly two or more algorithms perform on the same data.
5.2 Experiments
We measure the stability of both GloVe5 and SGNS6 at various numbers of iterations and test whether stability may be an indicator of task performance. We used 300-dimensional embeddings trained on the IMDB dataset. In both cases, we used a symmetric window of size 8 with the remaining parameters set to their defaults. For the NDCG measure, we set n = 20 to stress performance at the top of the nearest-neighbor lists.
Figure 1 shows the CCLA stability scores from 1 to 25 iterations. Each point on the chart is the average of 10 different random seeds with error bars denoting the standard deviation of the stability scores. SGNS is initially stable, but starts to drop as iterations increase, perhaps indicative of overfitting or model divergence. GloVe’s word vectors are fairly consistent after 10 iterations.
We used standard benchmarks for word analogy solving and word similarity scoring. Google analogies (Mikolov et al., 2013a) and MSR analogies (Mikolov et al., 2013c) are written in the form “a is to b as c is to d” (where d must be determined). The MEN (Bruni et al., 2012) and Rare (Luong et al., 2013) word similarity tests present word pairs with human-assigned similarity scores. This task is evaluated by measuring the embedding similarity scores’ correlation with human judgements via Spearman’s ρ.
Table 6 compares task performance on embeddings with low stability vs. high stability. For SGNS, we used iteration 25 as the low stability point and iteration 5 as the high stability point; for GloVe, we used 5 as low and 10 as high. SGNS outperformed GloVe in all tasks, even at low stability. Thus, comparing stability across methods may not be a viable metric at suggested performance. Despite this, looking within-
5url redacted for anonymous submission 6https://bitbucket.org/yoavgo/
word2vecf
8
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
method, CCLA’s stability measure does seem to indicate that lower-stability runs do underperform the higher-stability runs. This is an especially interesting result for SGNS, since the high stability point is actually at a much lower number of iterations. This suggests that we might use stability as an early-stopping criterion when learning the word representations, potentially saving much compute time while increasing performance.
6 Related Work
Our work spans several areas of research: Detecting semantic change. Hamilton et al. (2016) suggest orthogonal Procrustes to align word embedding spaces learned from different time periods, in contrast to per-word heuristics for the alignment (Kulkarni et al., 2015). Kim et al. (2014) start at time period t and learn embeddings. They initialize time period t + 1 with those from t, and measure which words’ cosine similarities changed the most. Unlike the previous two works, this does not produce a mapping function. We propose an approach that does not require embedding matrix alignment and thus does not require an optimization algorithm; we utilize withinperiod word similarities to create word representations that are comparable across time. This also removes the constraint of incrementally retraining the embeddings each time step; instead of learning 10 embeddings to compare between t1 and t10, we learn two and directly compare them with CCLA.
Contextual text mining. Topic models have been extended to support analysis of topic variations over different contexts in many ways. In CPLSA (Mei and Zhai, 2006), a generalized form of Zhai et al. (2004), context is incorporated into a topic model as explicit variables. A flexible way to incorporate arbitrary features into a topic model, Dirichlet-multinomial regression, was proposed by Mimno and McCallum (2008). Related recent work is the differential topic model (Chen et al., 2015). There are many topic models for supporting topic analysis in association with specific context such as time and location (e.g., Mei et al. (2006); Yuan et al. (2013)). A common idea in all these and other methods is to model the association of context and topics as word distributions, facilitating cross-context topic analysis, but cannot easily support cross-context lexical analysis, which is our main goal. An important difference between our work and these contextual topic mod-
els is that our approach does not make parametric assumptions in modeling text (which are generally needed in topic models) and is very flexible, allowing it to easily work with any context and contextspecific word annotations.
Word embedding evaluation. Word embeddings like SGNS (Mikolov et al., 2013b)) and GloVe (Pennington et al., 2014) have become standard repertoire in text mining and NLP. Some work has been done examining the methods and parameters themselves (Levy and Goldberg, 2014; Levy et al., 2015). Faruqui et al. (2016) find issues with using word similarity as evaluation for embeddings, and suggest only to consider downstream task performance. Our method is able to compare the embedding spaces themselves, which may be a useful alternative to premade similarity datasets or the less direct application tasks.
7 Conclusions
We propose a general way to perform crosscontext lexical analysis to accommodate any notion of context, any similarity function, and any type of word annotation. This enables many new applications all under the same framework (e.g. development of a common toolkit to support all applications), including analysis of semantic change, comparative analysis of meaning over context, and word embedding stability evaluation.
CCLA opens up interesting new directions for further study, especially in additional applications. One use is to investigate framing bias on political viewpoints. Another is a more fine-grained comparative analysis over specific products as opposed to movies or businesses. Term scoring can be further taken advantage of in sentiment valence prediction. Pablos et al. (2016) use word vector similarity to create sentiment valence scores per term, but they only consider similarity with a manually-chosen positive and negative word. Word sense disambiguation is another unvisited technique, and CCLA’s notion of context could help determine which words have multiple senses. Using CCLA as a tool in a larger system is desirable, such as learning to automatically partition a corpus to maximize word differences, or using it for event detection when tones shift from a monitored stream. We want to investigate embedding comparisons further using larger training data and automatically determine an optimal dimensionality or window size given new scoring functions.
9
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899

- Strengths: A nice, solid piece of work that builds on previous studies in a productive way. Well-written and clear.   - Weaknesses:   Very few--possibly avoid some relatively  empty  statements:  191 : For example, if our task is to identify words used similarly across contexts, our scoring function can be specified to give high scores to terms whose usage is similar across the contexts.  537 : It is educational to study how annotations drawn from the same data are similar or different.  - General Discussion: In the first sections I was not sure that much was being done that was new or interesting, as the methods seemed very reminiscent of previous methods used over the past 25 years to measure similarity, albeit with a few new statistical twists, but conceptually in the same vein. Section 5, however, describes an interesting and valuable piece of work that will be useful for future studies on the topic. In retrospect, the background provided in sections 2-4 is useful, if not necessary, to support the experiments in section 5.   In short, the work and results described will be useful to others working in this area, and the paper is worthy of presentation at ACL.  Minor comments:  Word, punctuation missing? 264 : For word annotations, we used PPMI, SVD, and SGNS (skipgram with negative sampling from Mikolov et al. (2013b)) word vectors released by Hamilton et al. (2016).  Unclear what  multiple methods  refers to : 278 : some words were detected by multiple methods with CCLA


LSTMEMBED: a Lexical and SemanTic Model of Embeddings with a bidirectional LSTM
The Long Short-Term Memory (LSTM) architecture for recurrent neural networks has become the state-of-the-art model for a range of different Natural Language Processing (NLP) tasks, especially in language modeling and sequence to sequence learning. In this paper we leverage a bidirectional LSTM while at the same time taking advantage of other semantic resources in order to create a vector space model for words and senses that outperforms most popular algorithms for learning embeddings. We evaluate our approach on the most well-known benchmarks on vector space representations.
1 Introduction
Recurrent neural networks (RNNs) with Long Short-Term Memory (LSTMs) have recently gained considerable popularity. Introduced by Hochreiter and Schmidhuber (1997), LSTMs are a special kind of RNN capable of learning long-term dependencies on problems related with sequential data. RNNs, and particularly LSTMs have been working extremely well on a large variety of problems in NLP, such as machine translation (Cho et al., 2014), lexical substitution (Melamud et al., 2016), word sense disambiguation, (Kågebäck and Salomonsson, 2016; Yuan et al., 2016), syntactic parsing (Dyer et al., 2015), among others.
Embeddings represent lexical and semantic items in a low-dimensional continuous space. The resulting vectors capture useful syntactic and semantic information, such as regularities in language, where relationships are characterized by a relation-specific vector offset. Recent approaches, such as word2vec (Mikolov et al., 2013), and GloVe (Pennington et al., 2014) are efficient for
learning embeddings, but they do not take into account word ordering. Vice versa, RNNs take order into account but they are not competitive in terms of speed or quality (Mikolov et al., 2010; Mikolov and Zweig, 2012; Mesnil et al., 2013).
The recently celebrated LSTMs appear to be perfect for learning sequence representations, like phrases (Hill et al., 2016) and contexts (Melamud et al., 2016). However, when dealing with large vocabularies, LSTMs involve time-intensive matrix-matrix multiplications, making them prohibitively expensive. This issue was addressed by Jean et al. (2015), who proposed an approximate training algorithm based on sampling, and Zoph et al. (2016), who introduced an adaptation for GPUs of the noise-contrastive estimation algorithm, a method that avoids repeated summations by training the model to correctly separate generated noise samples from words observed in the training data. However, both these approaches speed up the training process at the cost of lowering the performance.
Our contributions are twofold:
• We introduce LSTMEmbed, an RNN model based on a bidirectional LSTM for training word and sense embeddings that which outperforms classical approaches such as word2vec and GloVe.
• We present an innovative idea for enriching these representations with semantic knowledge from large corpora and vocabularies, while at the same time speeding up the training process.
2
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
2 Vector Space Models for words and senses
2.1 Word Embeddings
Embeddings represent lexical and semantic items as real-valued continuous vectors. These representations are extremely good at capturing syntactic and semantic regularities in language as well as relationships among items. Recent advances (Mikolov et al., 2013, word2vec) showed that word representations learnt with a neural network trained with raw text show relationships such as the male/female relationship, e.g. the induced vector representations of king −man + woman resulted very close to the induced vector of queen. GloVe, an alternative approach trained on aggregated global word-word co-occurrences, reached similar results. While these embeddings are surprisingly good for monosemous words, they fail to represent properly the non-dominant senses of words. For instance, the representations of bar and pub should be similar, as well as those of bar and stick, but having similar representations of pub and stick is undesired. Several approaches were proposed to address this problem: Yu and Dredze (2014) presented an alternative way to train word embeddings by using, in addition to common features, words having some relation in a semantic resource, like PPDB1 (Ganitkevitch et al., 2013) or WordNet (Miller, 1995). Faruqui et al. (2015) presented a technique applicable to pre-processed embeddings, in which vectors are updated (i.e. retrofitted) in order to make them more similar to those which share a word type and less similar those which do not. The word types were extracted from diverse semantic resources such as PPDB, WordNet and FrameNet (Baker et al., 1998). Finally, Melamud et al. (2016) introduced context2vec, a model based on a bidirectional LSTM for learning word embeddings. They use large raw text corpora to learn a neural model that embeds entire sentential contexts and target words in the same low-dimensional space.
2.2 Sense Embeddings
In contrast with the above approaches, which aim to learn representations of single words, sense embeddings represent individual word senses as separate vectors. Sense embeddings can learned with the main approaches: (1) supervised, which rely
1www.paraphrase.org/#/download
on a predefined sense inventory such as WordNet, Wikipedia, BabelNet2 (Navigli and Ponzetto, 2012) or Freebase (Bollacker et al., 2008), and (2) unsupervised, which rely on contextual information from parallel corpora to discriminate word senses among different occurrences. From the first group we can highlight successful approaches: SENSEMBED (Iacobacci et al., 2015) used Babelfy3, a state-of-the-art tool for Word Sense Disambiguation and Entity linking, to build a sense-annotated corpus which was in turn used to train a vector space model for word senses with word2vec. SENSEMBED exploits the structured knowledge of BabelNet’s sense inventory along with the distributional information gathered from text corpora. An important limitation of this approach was the inability to train both word and sense embeddings. The only word embeddings that the model was able to learn were the representations of words which were not annotated by the disambiguation tool. Those representations were of poor quality due to the fact that they are learnt from the occurrences in a ambiguous or unclear context, else the disambiguation should be able to annotate them. In addition, owing to the fact that it is based on word2vec, this approach suffers from the lack of word ordering. AutoExtend (Rothe and Schütze, 2015) is a system that learns embeddings for lexemes, senses and synsets from WordNet in a shared space. The synset/lexeme embeddings live in the same vector space as the word embeddings, given the constraint that words are sums of their lexemes and synsets are sums of their lexemes. AutoExtend is based on an autoencoder, a network that mimics the input and output vectors. Finally, Mancini et al. (2016) presented SW2V, an extension of word2vec which learns word and sense embeddings jointly and represents them in a unified vector space. The model was built by exploiting large corpora and knowledge obtained from WordNet and BabelNet. Their basic idea was to extend the CBOW architecture of word2vec to represent both words and senses as different inputs and train the model in order to predict the word and the sense in the middle. In contrast to AutoExtend, the model learns word and sense embeddings in a shared space as an emerging feature, rather than via constraints on both representations. Nevertheless, being based also
2http://www.babelnet.org/ 3http://babelfy.org/
3
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
Figure 1: The LSTMEmbed architecture Figure 2: The LSTMEmbedSW extension
on word2vec, SW2V also lacks word order. In marked contrast, LSTMEmbed aims to learn representations for both words and senses in a shared emerging space, handling word ordering, and improving those representations by injecting semantic knowledge via pretrained embeddings.
3 LSTMEmbed
3.1 Model Overview
At the core of LSTMEmbed is a bidirectional LSTM, a special kind of recurrent neural network (RNN). An RNN is a type of neural network architecture particularly suited for learning time series. The simplest RNN is called Elman network. This network is composed of an input, a hidden and an output layer, just as regular feed-forward networks, with the difference that the hidden layer takes in addition to the input vector xt ∈ Rn, its previous state ht−1 ∈ Rm. Mathematically, the computation follows the formula:
ht = f (Wxt +Uht−1 + b) (1)
where W ∈ Rm×n is the weights matrix from the input to the hidden layer, U ∈ Rm×m is the weights matrix from the previous hidden state to the current one, b ∈ Rm is the bias and f is the activation function. In practice this architecture has several problems in learning long-term dependencies (Hochreiter, 1991; Bengio et al., 1994). To cope the latter, we adopt the Long Short Term Memory (LSTM) (Hochreiter and Schmidhuber, 1997) architecture which augments the RNN with a series of connections called gates: three gates are added namely the input (it), the forget (ft) and the output (ot) gates. These gates control the flow of information between states. This is achieved
by adding an extra vector, ct ∈ Rn: in each step, the LSTM takes xt, ht−1 and ct−1 as input and outputs ht and ct according to the following calculations:
it = σ ( Wixt +U iht−1 + b i )
ft = σ ( Wfxt +U fht−1 + b f )
ot = σ (W oxt +U oht−1 + b o) gt = tanh (W gxt +U ght−1 + b g)
ct = ft ct−1 + it gt ht = ot tanh(ct)
(2)
where σ is the sigmoid function, tanh is the hyperbolic tangent and is the element-wise multiplication operator. The bidirectional LSTM (Graves and Schmidhuber, 2005, BLSTM) is a variant of the original LSTM especially designed for temporal problems where the input direction is relevant. The state at each time step in a BLSTM consists of the state of two LSTMs, one going left and one going right.
LSTMEmbed, however, is not merely a standard BLSTM: it produces word and sense embeddings jointly based on the following innovations:
• A single lookup table, shared between both left and right LSTM, learned in the same architecture that represents both words and senses.
• Using a sense-annotated corpus which includes both words and senses for learning the embeddings.
• A new way of learning using a set of pretrained embeddings as the objective for injecting semantic information while speeding up the training.
4
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
3.2 Definition
As we mentioned before, our model uses a bidirectional LSTM to obtain word and sense representations. Given a sense-annotated corpus and a set of pretrained embeddings, the objective is to predict the embedding of a single word or sense (embedding given by the pretrained set) given its context. The context is defined by a fixed window W of words and senses on each side.
Figure 1 illustrates the model architecture. Given a sentence and the position of the target token i (word or sense), the input to our model are two sequences of tokens si−W , ..., si−1, the preceding context, and si+1, ..., si+W , the posterior context. Each token is represented by its corresponding embedding vector v(sj) ∈ Rn, given by a shared table which allows to learn representations taking into account the contextual information on both sides of the sentence. Then, the BLSTM reads both sequences, the LSTM that reads the preceding context from left to right and the LSTM that reads the posterior context, from right to left:
ol = lstml(v(si−W ), ...,v(si−1))
or = lstmr(v(si+1), ...,v(si+W )) (3)
The output of the model is given by a perceptron with sigmoid as its activation function, applied to the concatenation of the outputs of both LSTMs:
outLSTMEmbed = σ (W o(ol ⊕ or)) (4)
where Wo ∈ R2m×m is the weights matrix and m the dimension of the LSTM. Then, the model compares outLSTMEmbed with emb(si), where emb(si) is the embedding vector of the target token given by the set of pretrained embeddings. The weights of the network are modified in order to maximize the similarity between outLSTMEmbed and emb(si). For error calculation the comparison is in terms of cosine similarity.
similarity = S(~v1, ~v2) = ~v1 · ~v2 ‖~v1‖‖~v2‖
(5)
Once the training is over, the embedding vector of an item s that our model learns is given by v(s).
3.3 Modeling words and senses together
The vanilla version of LSTMEmbed is able to learn either word embeddings or sense embeddings. In the following we describe an extension of LSTMEmbed, LSTMEmbedSW (Figure 2), which learns both word and sense embeddings jointly in a shared vector space. Given a sentence and the position of the target item i, the input to our model are four sequences, two that represent words and senses on the left side of the context (wi−W , ..., wi−1 and si−W , ..., si−1) and two sequences that represent words and senses from the right side of the context (wi+1, ..., wi+W and si+1, ..., si+W ).
The architecture is augmented by adding an extra layer that takes the sum of the embedding vectors from the word and the sense with the same index and projects them via a linear perceptron into the corresponding LSTM:
pi = W (v(si) + v(wi)) (6)
where W ∈ Rn×n is the weights matrix. In the same way as explained above, the BLSTM reads the two resulting sequences:
ol = lstml(pi−W , ..., pi−1)
or = lstmr(pi+1, ..., pi+W ) (7)
3.4 Input alternatives & Objective embeddings
Corpus type Pretrained Representations
Embeddings words senses
raw text words X – senses – –
sense-annotated words X X senses X X
Table 1: LSTMEmbed configuration alternatives.
Our model can exploit both raw and senseannotated corpora and different types of pretrained embeddings. Given a raw-text training corpus and a set of pretrained word embeddings (i.e. word and sense embeddings), our model is only capable to learn word embeddings, while the combination of raw text and sense embeddings is invalid (see Table 1). With a sense annotated corpus the model can exploit either word or sense embeddings and also it is able to learn word or sense embeddings.
5
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
barn1 pubn1 barn3 stickn1
cafen1 coffee shop2n cage5n washer2n grilln1 public bar1n rigid frame1n strap3n mugn4 grilln1 nut3n flap1n
doughnutsn2 barn1 coupler1n twine1n pantry1n wine barn1 tappet1n buckle1v buffet2n dinern1 puley1n piece of leather1n
coffee shop2n walletn1 stampings1n threaded5v
Table 2: Closest senses of ambiguous nouns.
3.5 Inspiration from Language Models
LSTMEmbed is inspired by the architecture or recurrent neural network language models (RNNLM) (Mikolov et al., 2010; Sutskever et al., 2011; Sundermeyer et al., 2012; Zaremba et al., 2014). Language modelling aims to learn a function which defines probability distributions over sequences of words. While RNN-LMs learns to predict target words based on their context, our model learns to predict the embedding of the target word, and uses the learning process for deriving useful representations of words and senses.
4 Similarity Measurement
In the following we describe how we leverage our representations for the computation of word similarity and analogy tasks.
4.1 Word similarity
As was claimed by Rubenstein and Goodenough (1965) the proportion of words common to the contexts of two words A and B is a function of the degree in which A and B are similar in meaning. LSTMEmbed is intended for improving word and sense representations by learning from their contexts. While measuring semantic similarity between words we will refer to the conventional approach of Resnik (1999) where the similarity bewteen two words is given by the similarity of their closest senses:
Sim (w1, w2) = max s1∈Sw1 s2∈Sw2
S (~s1, ~s2) (8)
where Swi is the set of senses associated with the word wi.
4.2 Word Analogy
Given two pairs of words (wi1, wi2) and (wj1, wj2), the degree of similarity between the
relation among wi1 and wi2, and wj1 and wj2 suggests by what degree the two relations are analogous. For measuring this similarity we follow Iacobacci et al. (2015):
An(wi1, wi2, , wj1, wj2) = S(v(wi1)− v(wi2), v(wj1)− v(wj2))
(9)
5 Experiments
5.1 Evaluation Methods
We evaluate our semantic representations of words and senses with different configurations on tasks of word similarity, synonym identification and word analogy.
Word Similarity. We evaluate LSTMEmbed on standard word similarity and relatedness datasets: the RG65 (Rubenstein and Goodenough, 1965) and the WordSim-353 (Finkelstein et al., 2002, WS353) datasets. We also include the proposed split made by Agirre and Soroa (2009) who divided WS353 in pairs that measured the degree of similarity (WSSim) and pairs that measured the degree of relatedness (WSRel). We include two large datasets: SimLex999 (Hill et al., 2015), which puts especially focus on representing antonyms as completely unrelated words, and the MEN dataset introduced by Bruni et al. (2014) composed by 3000 pairs. Two datasets especially made for analyzing verb similarity are also included in our experiments: YP130, created by Yang and Powers (2005), based on the taxonomy of WordNet, and SimVerb3500 (Gerz et al., 2016) a newer and much larger dataset extracted from the USF norms data set4 (Nelson et al., 2004) and VerbNet5 (Kipper et al., 2008). Finally, we include evaluations on Stanford Contextual Word Similarities (SCWS), a dataset for measuring word-incontext similarity (Huang et al., 2012). We only report the MaxSim measurement, that is, without taking into account the contextual sentences.
Synonym Identification. For synonym identification we include two datasets. The first one, introduced by Landauer and Dumais (1997, TOEFL), is extracted directly from the synonym questions of the TOEFL (Test of English as a Foreign Language). The test is composed by
4http://w3.usf.edu/FreeAssociation/ 5http://verbs.colorado.edu/verb-index
6
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
Model WS353 WSSim WSRel RG65 MEN SimLex SCWS YP130 SimVerb TOEFL ESL SemEval-2012 MaxDiff Spearman
word2vec 0.620 0.699 0.478 0.791 0.650 0.441 0.547 0.694 0.433 0.875 0.640 0.404 0.242 GloVe 0.575 0.684 0.426 0.761 0.675 0.478 0.532 0.658 0.399 0.875 0.620 0.420 0.265
LSTMEmbed 0.634 0.710 0.510 0.719 0.690 0.456 0.552 0.705 0.436 0.878 0.600 0.401 0.216 LSTMEmbedSW 0.561 0.626 0.478 0.785 0.644 0.450 0.529 0.600 0.414 0.869 0.560 0.358 0.139
Table 3: Spearman correlation for Word Similarity and Synonym identification between sense-based representations.
80 multiple-choice synonym questions with four choices per question. The second one, introduced by Turney (2001), provide a set of questions extracted, in this case, from the synonym questions of the ESL (English as a Second Language). Similarly to TOEFL, it is composed by 50 multiplechoice synonym questions with four choices per question.
Word Analogy. For word analogy we experimented with the SemEval-2012 task on Measuring Degrees of Relational Similarity (Jurgens et al., 2012). The task provides a dataset comprising 79 graded word relations, 10 of which are used for training and the rest for test. The task includes two different evaluations, one based on Spearman correlation and a second one based on MaxDiff score (Louviere, 1991).
5.2 Corpora and Training Details
Corpora. We compare several sense-annotated corpora: SemCor (Miller et al., 1994) is a manually sense-tagged corpus created by the WordNet project team at Princeton University. The corpus is a subset of the English Brown Corpus and comprises around 360,000 words, providing annotations for more than 200K content words. The Semantically Enriched Wikipedia (Raganato et al., 2016, SEW) is a automatically-constructed corpus which exploits the hyperlink structure of Wikipedia and the wide-coverage sense inventory of BabelNet. Finally Scozzafava et al. (2015, BabelWiki) presented a sense-annotated corpus of the English and Italian Wikipedia, annotated automatically with Babelfy (Moro et al., 2014), a tool for Word Sense Disambiguation on the BabelNet semantic network. We unify the sense annotations of all corpora used to learn our models into a single sense inventory. To this end we choose the last available version of BabelNet (3.7). BabelNet is both a multilingual encyclopedic dictionary, with lexicographic and encyclopedic cover-
age of terms, and a semantic network which connects concepts and named entities in a network of semantic relations. The resource is a merger of multiple lexical semantic resources such as WordNet and Wikipedia.
5.3 Hyperparameter selection
For chosing the hyperparameters, we trained LSTMEmbed on a raw corpus6. We evaluated the resulting word representations on WS353, one of the word similarity datasets included in our experiments:
We varied the window size between 1 and 15 and we averaged the results across datasets. As in visible in Figure 3, we found that taking a window size longer than 3 words was approximately equivalent across experiments. For our experiments we used a windows size of 10 as that is the recommended window size for word2vec.
5.4 Learning embeddings
LSTMEmbed was built on the Keras7 library using Theano (Theano Development Team, 2016)
6http://mattmahoney.net/dc/text8.zip 7https://keras.io
7
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
as backend. Keras is a neural networks library written in Python and an output of the ONEIROS project (Open-ended Neuro-Electronic Intelligent Robot Operating System). We trained our models with a Nvidia Titan X Pascal GPU on a computer equipped with an eight core Intel Core i73820 running at 3.60GHz with 64GB or RAM.
6 Results
6.1 Corpus Selection
In Figure 4 we can see the progression of the Spearman correlation while our model learns a larger portion of the training corpus. We can see that the BabelWiki corpus achieves better representations than SEW.
Figure 4: Spearman correlation in WS353 against learning progression on BabelWiki and SEW.
6.2 Word Similarity with BabelWiki
In Table 3 we show the results of our model compared with other approaches in the tasks of word similarity and synonym identification. The representations were all trained on the same senseannotated corpus, i.e. BabelWiki. For a fair comparison we trained representations using the same configuration across algorithms: 50-dimension embeddings, window size of 10 words, and a vocabulary of 1M most frequent tokens. For handling frequent words, we discarded the 1000 most frequent tokens. We chose 50 as the LSTM dimensionality, the same dimension than our trained embeddings. We set the batch size in 128 and the training was set only for one epoch. For both word2vec and GloVe, the remaining parameters were chosen following the default configurations. For word2vec we use the Skip-gram with negative sampling set on 10, sub-sampling of frequent words set to 10−3. For GloVe we set the maximum iterations in 15, and the x max in 10.
Model Dim WSSim RG65 MEN SimLex
SW2V 300 0.710 0.740 0.760 0.470 AutoExtend 300 - - 0.750 0.450 SensEmbed 400 - - 0.700 0.390
LSTMEmbed 50 0.710 0.719 0.690 0.456 LSTMEmbedSW 50 0.626 0.785 0.644 0.450
The LSTMEmbed architecture obtains slightly but consistently better performance across task. The LSTMEmbedSW extension is consistently worse, with the exception of the RG65 dataset, but is the only approach that offers a joint space of words and sense. Contrary to our expectations, our approach does not appear to be competitive in the task on word analogy. This may be due to the fact that LSTMEmbed is a much more complex model than word2vec and GloVe. The relations in our model might be represented by a higher degree relationship.
6.3 Comparison with other Systems
We compare the performance of LSTMEmbed against alternative approaches able to obtain sense embeddings: SW2V, AutoExtend and SENSEMBED. Table 4 shows that our approach, although providing the embeddings with smallest dimensionality, achieves competitive results against larger embeddings from the other approaches.
6.4 Word Similarity with SemCor
In Table 5 we show word similarity experiments when training our model with the SemCor corpus. We performed two classes of experiments: 1) taking the SemCor corpus with all its sense annotations and 2) using a raw version of it, e.g. excluding all the annotations. The training was perform using a batch size of 32 and taking into account all the different tokens, 91349 tokens for the sense-annotated SemCor and 46797 for the runs of the raw version of SemCor–. In addition to the model trained with word2vec, we include a model, identified as LSTM, which is identical to LSTMEmbed but usese softmax as output layer as regular language models. As we can see, training with sense-annotated data outperforms the configurations based only on raw text. The LSTM model is competitive in the experiments considering only
8
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
Model Sense RG65 WS353 WSRel WSSim YP130 MEN SCWS SimLex
word2vec - 0.288 -0.009 0.027 -0.009 0.490 0.166 0.270 0.218 X 0.397 0.158 0.125 0.201 0.268 0.305 0.325 0.225
LSTM - 0.358 0.077 0.018 0.125 0.563 0.145 0.189 0.238 X 0.462 0.071 -0.020 0.128 0.532 0.108 0.292 0.247
LSTMEmbed - 0.382 0.067 0.007 0.122 0.492 0.180 0.332 0.309 X 0.434 0.175 0.102 0.211 0.650 0.229 0.351 0.275
LSTMEmbedSW - 0.508 0.081 -0.017 0.164 0.566 0.168 0.322 0.249 X 0.445 0.125 0.009 0.210 0.508 0.214 0.350 0.269
Table 5: Spearman correlation for Word Similarity trained with SemCor.
Emb Dim WS353
word2vec - - 0.488 GloVe - - 0.557
LSTMEmbed
word2vec 50 0.573 word2ve + retro 50 0.569 GoogleNews 300 0.574
SensEmbed 400 0.612
Table 6: LSTMEmbed with different pretrained embeddings compared with word2vec and GloVe.
raw text but unlike the other configurations, it does not seems to take advantage of the sense annotated data. We hypothesize that the increment of the vocabulary, with the corresponding increment of parameters to learn, is responsible for this behavior. Additionally, the learning time of this configuration was substantally larger than the time spent by LSTMEmbed, which is the reason why we did not include it in the experiments with large corpora. Similarly to the experiments on the BabelWiki corpus, LSTMEmbed provides good results, while the LSTMEmbedSW extension provides less performing results with the exception of the RG65 dataset.
6.5 Improving Representations via richer Embeddings
In this section we study how we can inject semantic information through the set of pretrained embeddings. Our assumption is that richer embeddings should enhance the representation delivered by our model. In Table 6 we show the behavior of the LSTMEmbed architecture in the task of word similarity with the WS353 dataset. We perform our experiments in a reduced set, i.e. a 10% sample, of our chosen sense-annotated corpus. We compared four sets of pretrained embeddings. The first set is a 50-dimension embeddings, trained with word2vec Skip-gram with the
default configuration. The second set consists of the same vectors, retrofitted with PPDB using the default configuration. The third set is the wellknown GoogleNews set of pretrained embeddings dataset8. Finally, we tested our model with the pretrained embeddings of SensEmbed9. As we can see, using richer pretrained embeddings improves the resulting representations given by our model. All the representations reach better results compared with the representations from word2vec and GloVe trained on the same corpus. The sense embeddings from SensEmbed, a priori the richest set of pretrained embeddings, achieved in fact the best performance.
7 Conclusions
In this paper we introduced LSTMEmbed, a new model based on a bidirectional LSTM for learning embeddings of words and senses. We draw four main findings: First, we have shown that our approach is able to learn word embeddings which consistently outperform the representations given by classical algorithms like word2vec and GloVe on the same training data. Second, the introduction of an output layer which predicts pre-trained embeddings allow us to inject more semantic information while speed up the training. Third, we have shown that using semantically richer embeddings as enriches the resulting representations- And finally, our sense-based representations also outperform previous representations based on word2vec and GloVe, consistently with the results shown for the word-based representations.
8https://goo.gl/p4RXac 9http://lcl.uniroma1.it/sensembed/
9
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899

- Strengths:  1. The presentation of the paper, up until the final few sections, is excellent and the paper reads very well at the start. The paper has a clear structure and the argumentation is, for the most part, good. 2. The paper addresses an important problem by attempting to incorporate word order information into word (and sense) embeddings and the proposed solution is interesting.  - Weaknesses:   1. Unfortunately, the results are rather inconsistent and one is not left entirely convinced that the proposed models are better than the alternatives, especially given the added complexity. Negative results are fine, but there is insufficient analysis to learn from them. Moreover, no results are reported on the word analogy task, besides being told that the proposed models were not competitive - this could have been interesting and analyzed further. 2. Some aspects of the experimental setup were unclear or poorly motivated, for instance w.r.t. to corpora and datasets (see details below). 3. Unfortunately, the quality of the paper deteriorates towards the end and the reader is left a little disappointed, not only w.r.t. to the results but with the quality of the presentation and the argumentation.  - General Discussion:  1. The authors aim  to learn representations for both words and senses in a shared emerging space . This is only done in the LSTMEmbed_SW version, which rather consisently performs worse than the alternatives. In any case, what is the motivation for learning representations for words and senses in a shared semantic space? This is not entirely clear and never really discussed in the paper. 2. The motivation for, or intuition behind, predicting pre-trained embeddings is not explicitly stated. Also, are the pre-trained embeddings in the LSTMEmbed_SW model representations for words or senses, or is a sum of these used again? If different alternatives are possible, which setup is used in the experiments? 3. The importance of learning sense embeddings is well recognized and also stressed by the authors. Unfortunately, however, it seems that these are never really evaluated; if they are, this remains unclear. Most or all of the word similarity datasets considers words independent of context. 4. What is the size of the training corpora? For instance, using different proportions of BabelWiki and SEW is shown in Figure 4; however, the comparison is somewhat problematic if the sizes are substantially different. The size of SemCor is moreover really small and one would typically not use such a small corpus for learning embeddings with, e.g., word2vec. If the proposed models favor small corpora, this should be stated and evaluated. 5. Some of the test sets are not independent, i.e. WS353, WSSim and WSRel, which makes comparisons problematic, in this case giving three  wins  as opposed to one. 6. The proposed models are said to be faster to train by using pre-trained embeddings in the output layer. However, no evidence to support this claim is provided. This would strengthen the paper. 7. Table 4: why not use the same dimensionality for a fair(er) comparison? 8. A section on synonym identification is missing under similarity measurement that would describe how the multiple-choice task is approached. 9. A reference to Table 2 is missing. 10. There is no description of any training for the word analogy task, which is mentioned when describing the corresponding dataset.