Natural Language Processing (CSEP 517): Language Models, Continued

Size: px
Start display at page:

Download "Natural Language Processing (CSEP 517): Language Models, Continued"

Transcription

1 Natural Language Processing (CSEP 517): Language Models, Continued Noah Smith c 2017 University of Washington nasmith@cs.washington.edu April 3, / 102

2 To-Do List Online quiz: due Sunday Print, sign, and return the academic integrity statement (if you haven t already) Read: Smith (2017); optionally, Jurafsky and Martin (2016), Collins (2011) 2, and Goldberg (2015) 0 4, if you want to know more about neural networks A1 now due April 9 (Sunday) Late policy: four late days 2 / 102

3 Language Models: Definitions V is a finite set of (discrete) symbols ( words or possibly characters); V = V V is the (infinite) set of sequences of symbols from V whose final symbol is p : V R, such that: For any x V, p(x) 0 p(x = x) = 1 x V (I.e., p is a proper probability distribution.) Language modeling: estimate p from examples, x 1:n = x 1, x 2,..., x n. Evaluation on test data x 1:m : perplexity, 2 1 m M i=1 log 2 p( x i) 3 / 102

4 Log-Linear Models: Definitions We define a conditional log-linear model p(y X) as: Y is the set of events/outputs ( for language modeling, V) X is the set of contexts/inputs ( for n-gram language modeling, V n 1 ) φ : X Y R d is a feature vector function w R d are the model parameters p w (Y = y X = x) = exp w φ(x, y) exp w φ(x, y ) y Y 4 / 102

5 Breaking It Down p w (Y = y X = x) = exp w φ(x, y) exp w φ(x, y) y Y 5 / 102

6 Breaking It Down exp w φ(x, y) p w (Y = y X = x) = exp w φ(x, y) y Y linear score w φ(x, y) 6 / 102

7 Breaking It Down exp w φ(x, y) p w (Y = y X = x) = exp w φ(x, y) y Y linear score w φ(x, y) nonnegative exp w φ(x, y) 7 / 102

8 Breaking It Down exp w φ(x, y) p w (Y = y X = x) = exp w φ(x, y) y Y linear score w φ(x, y) nonnegative exp w φ(x, y) normalizer exp w φ(x, y ) = Z w (x) y Y 8 / 102

9 Breaking It Down p w (Y = y X = x) = exp w φ(x, y) exp w φ(x, y) y Y linear score w φ(x, y) Log-linear comes from the fact that: nonnegative exp w φ(x, y) normalizer exp w φ(x, y ) = Z w (x) y Y log p w (Y = y X = x) = w φ(x, y) log Z w (x) }{{} constant in y This is an instance of the family of generalized linear models. 9 / 102

10 The Geometric View Suppose we have instance x, Y = {y 1, y 2, y 3, y 4 }, and there are only two features, φ 1 and φ 2. ϕ 2 (x, y 3 ) (x, y 1 ) (x, y 2 ) (x, y 4 ) ϕ 1 As a simple example, let the two features be binary functions. 10 / 102

11 The Geometric View Suppose we have instance x, Y = {y 1, y 2, y 3, y 4 }, and there are only two features, φ 1 and φ 2. ϕ 2 (x, y 3 ) (x, y 1 ) (x, y 2 ) (x, y 4 ) ϕ 1 w φ = w 1 φ 1 + w 2 φ 2 = 0 11 / 102

12 The Geometric View Suppose we have instance x, Y = {y 1, y 2, y 3, y 4 }, and there are only two features, φ 1 and φ 2. ϕ 2 (x, y 3 ) (x, y 1 ) (x, y 2 ) (x, y 4 ) ϕ 1 distance(w φ = 0, φ 0 ) = w φ 0 w 2 w φ 0 12 / 102

13 The Geometric View Suppose we have instance x, Y = {y 1, y 2, y 3, y 4 }, and there are only two features, φ 1 and φ 2. ϕ 2 (x, y 3 ) (x, y 1 ) (x, y 2 ) (x, y 4 ) ϕ 1 w φ(x, y 1 ) > w φ(x, y 3 ) > w φ(x, y 4 ) > 0 w φ(x, y 2 ) 13 / 102

14 The Geometric View Suppose we have instance x, Y = {y 1, y 2, y 3, y 4 }, and there are only two features, φ 1 and φ 2. ϕ 2 (x, y 3 ) (x, y 1 ) (x, y 2 ) (x, y 4 ) ϕ 1 p w (y 1 x) > p w (y 3 x) > p w (y 4 x) > p w (y 2 x) 14 / 102

15 The Geometric View Suppose we have instance x, Y = {y 1, y 2, y 3, y 4 }, and there are only two features, φ 1 and φ 2. ϕ 2 (x, y 3 ) (x, y 1 ) (x, y 2 ) (x, y 4 ) ϕ 1 15 / 102

16 The Geometric View Suppose we have instance x, Y = {y 1, y 2, y 3, y 4 }, and there are only two features, φ 1 and φ 2. ϕ 2 (x, y 3 ) (x, y 1 ) (x, y 2 ) (x, y 4 ) ϕ 1 p w (y 3 x) > p w (y 1 x) > p w (y 2 x) > p w (y 4 x) 16 / 102

17 The Geometric View Suppose we have instance x, Y = {y 1, y 2, y 3, y 4 }, and there are only two features, φ 1 and φ 2. ϕ 2 (x, y 3 ) (x, y 1 ) (x, y 2 ) (x, y 4 ) ϕ 1 Log-linear parameter estimation tries to choose w so that p w (Y x) matches the empirical distribution, c(x,y ) c(x). 17 / 102

18 Why Build Language Models This Way? Exploit features of histories for sharing of statistical strength and better smoothing (Lau et al., 1993) Condition the whole text on more interesting variables like the gender, age, or political affiliation of the author (Eisenstein et al., 2011) Interpretability! Each feature φ k controls a factor to the probability (e w k ). 1 If w k < 0 then φ k makes the event less likely by a factor of e. w k If wk > 0 then φ k makes the event more likely by a factor of e w k. If wk = 0 then φ k has no effect. 18 / 102

19 Log-Linear n-gram Models p w (X = x) = = l p w (X j = x j X 0:j 1 = x 0:j 1 ) j=1 l j=1 assumption = = l j=1 exp w φ(x 0:j 1, x j ) Z w (x 0:j 1 ) l j 1 exp w φ(x j n+1:j 1, x j ) Z w (x j n+1:j 1 ) exp w φ(h j, x j ) Z w (h j ) 19 / 102

20 Example The man who knew too much many little few. hippopotamus 20 / 102

21 What Features in φ(x j n+1:j 1, X j )? 21 / 102

22 What Features in φ(x j n+1:j 1, X j )? Traditional n-gram features: X j 1 = the X j = man 22 / 102

23 What Features in φ(x j n+1:j 1, X j )? Traditional n-gram features: X j 1 = the X j = man Gappy n-grams: X j 2 = the X j = man 23 / 102

24 What Features in φ(x j n+1:j 1, X j )? Traditional n-gram features: X j 1 = the X j = man Gappy n-grams: X j 2 = the X j = man Spelling features: X j s first character is capitalized 24 / 102

25 What Features in φ(x j n+1:j 1, X j )? Traditional n-gram features: X j 1 = the X j = man Gappy n-grams: X j 2 = the X j = man Spelling features: X j s first character is capitalized Class features: X j is a member of class / 102

26 What Features in φ(x j n+1:j 1, X j )? Traditional n-gram features: X j 1 = the X j = man Gappy n-grams: X j 2 = the X j = man Spelling features: X j s first character is capitalized Class features: X j is a member of class 132 Gazetteer features: X j is listed as a geographic place name 26 / 102

27 What Features in φ(x j n+1:j 1, X j )? Traditional n-gram features: X j 1 = the X j = man Gappy n-grams: X j 2 = the X j = man Spelling features: X j s first character is capitalized Class features: X j is a member of class 132 Gazetteer features: X j is listed as a geographic place name You can define any features you want! Too many features, and your model will overfit Too few (good) features, and your model will not learn 27 / 102

28 What Features in φ(x j n+1:j 1, X j )? Traditional n-gram features: X j 1 = the X j = man Gappy n-grams: X j 2 = the X j = man Spelling features: X j s first character is capitalized Class features: X j is a member of class 132 Gazetteer features: X j is listed as a geographic place name You can define any features you want! Too many features, and your model will overfit Feature selection methods, e.g., ignoring features with very low counts, can help. Too few (good) features, and your model will not learn 28 / 102

29 Feature Engineering Many advances in NLP (not just language modeling) have come from careful design of features. 29 / 102

30 Feature Engineering Many advances in NLP (not just language modeling) have come from careful design of features. Sometimes feature engineering is used pejoratively. 30 / 102

31 Feature Engineering Many advances in NLP (not just language modeling) have come from careful design of features. Sometimes feature engineering is used pejoratively. Some people would rather not spend their time on it! 31 / 102

32 Feature Engineering Many advances in NLP (not just language modeling) have come from careful design of features. Sometimes feature engineering is used pejoratively. Some people would rather not spend their time on it! There is some work on automatically inducing features (Della Pietra et al., 1997). 32 / 102

33 Feature Engineering Many advances in NLP (not just language modeling) have come from careful design of features. Sometimes feature engineering is used pejoratively. Some people would rather not spend their time on it! There is some work on automatically inducing features (Della Pietra et al., 1997). More recent work in neural networks can be seen as discovering features (instead of engineering them). 33 / 102

34 Feature Engineering Many advances in NLP (not just language modeling) have come from careful design of features. Sometimes feature engineering is used pejoratively. Some people would rather not spend their time on it! There is some work on automatically inducing features (Della Pietra et al., 1997). More recent work in neural networks can be seen as discovering features (instead of engineering them). But in much of NLP, there s a strong preference for interpretable features. 34 / 102

35 How to Estimate w? p θ (x) = n-gram l j=1 θ xj h j log-linear n-gram l j 1 exp w φ(h j, x j ) Z w (h j ) Parameters: θ v h w k v V, h (V { }) n 1 k {1,..., d} MLE: ˆθv h = c(hv) c(h) no closed form 35 / 102

36 MLE for w Let training data consist of {(h i, x i )} N i=1. 36 / 102

37 MLE for w Let training data consist of {(h i, x i )} N i=1. Maximum likelihood estimation is: max w R d N log p w (x i h i ) i=1 = max w R d = max w R d N i=1 N log exp w φ(h i, x i ) Z w (h i ) i=1 w φ(h i, x i ) log v V exp w φ(h i, v) } {{ } Z w(h i ) 37 / 102

38 MLE for w Let training data consist of {(h i, x i )} N i=1. Maximum likelihood estimation is: max w R d N log p w (x i h i ) i=1 = max w R d = max w R d This is concave in w. N i=1 N log exp w φ(h i, x i ) Z w (h i ) i=1 w φ(h i, x i ) log v V exp w φ(h i, v) } {{ } Z w(h i ) 38 / 102

39 MLE for w Let training data consist of {(h i, x i )} N i=1. Maximum likelihood estimation is: max w R d N log p w (x i h i ) i=1 = max w R d = max w R d This is concave in w. N i=1 N log exp w φ(h i, x i ) Z w (h i ) i=1 w φ(h i, x i ) log v V Z w (h i ) involves a sum over V terms. exp w φ(h i, v) } {{ } Z w(h i ) 39 / 102

40 MLE for w max w R d N w φ(h i, x i ) log Z w (h i ) }{{} f i (w) i=1 40 / 102

41 MLE for w max w R d N w φ(h i, x i ) log Z w (h i ) }{{} f i (w) i=1 Hope/fear view: for each instance i, increase the score of the correct output x i, score(x i ) = w φ(h i, x i ) decrease the softened max score overall, log v V exp score(v) 41 / 102

42 MLE for w max w R d N w φ(h i, x i ) log Z w (h i ) }{{} f i (w) i=1 Gradient view: w f i = φ(h i, x i ) p }{{} w (v h i ) φ(h i, v) v V observed features }{{} expected features Setting this to zero means getting model s expectations to match empirical observations. 42 / 102

43 MLE for w: Algorithms Batch methods (L-BFGS is popular) Stochastic gradient ascent/descent more common today, especially with special tricks for adapting the step size over time Many specialized methods (e.g., iterative scaling ) 43 / 102

44 Stochastic Gradient Descent Goal: minimize N i=1 f i(w) with respect to w. Input: initial value w, number of epochs T, learning rate α For t {1,..., T }: Choose a random permutation π of {1,..., N}. For i {1,..., N}: w w α w f π(i) Output: w 44 / 102

45 Avoiding Overfitting Maximum likelihood estimation: max w R d N w φ(h i, x i ) log Z w (h i ) i=1 If φ j (h, x) is (almost) always positive, we can always increase the objective (a little bit) by increasing w j toward / 102

46 Avoiding Overfitting Maximum likelihood estimation: max w R d N w φ(h i, x i ) log Z w (h i ) i=1 If φ j (h, x) is (almost) always positive, we can always increase the objective (a little bit) by increasing w j toward +. Standard solution is to add a regularization term: max w R d N i=1 w φ(h i, x i ) log v V where λ > 0 is a hyperparameter and p = 2 or 1. exp w φ(h i, v) λ w p p 46 / 102

47 MLE for w If we had more time, we d study this problem more carefully! Here s what you must remember: There is no closed form; you must use a numerical optimization algorithm like stochastic gradient descent. Log-linear models are powerful but expensive (Z w (h i )). Regularization is very important; we don t actually do MLE. Just like for n-gram models! Only even more so, since log-linear models are even more expressive. 47 / 102

48 Quick Recap Two kinds of language models so far: representation? estimation? think about? n-gram h i is (n 1) previous symbols count and normalize smoothing log-linear featurized representation of h i, x i iterative gradient descent features 48 / 102

49 Neural Network: Definitions Warning: there is no widely accepted standard notation! A feedforward neural network n ν is defined by: A function family that maps parameter values to functions of the form n : R d in R dout ; typically: Non-linear Differentiable with respect to its inputs Assembled through a series of affine transformations and non-linearities, composed together Symbolic/discrete inputs handled through lookups. Parameter values ν Typically a collection of scalars, vectors, and matrices We often assume they are linearized into R D 49 / 102

50 A Couple of Useful Functions softmax : R k R k x 1, x 2,..., x k e x 1 k, j=1 ex j e x 2 k,..., j=1 ex j e x k k j=1 ex j tanh : R [ 1, 1] x ex e x e x + e x Generalized to be elementwise, so that it maps R k [ 1, 1] k. Others include: ReLUs, logistic sigmoids, PReLUs, / 102

51 One Hot Vectors Arbitrarily order the words in V, giving each an index in {1,..., V }. Let e i R V contain all zeros, with the exception of a 1 in position i. This is the one hot vector for the ith word in V. 51 / 102

52 Feedforward Neural Network Language Model (Bengio et al., 2003) Define the n-gram probability as follows: ( p( h 1,..., h n 1 ) = n ν eh1,..., e hn 1 ) = n 1 softmax + M tanh b V j=1 e hj V A j V d d V + W V H u H e h j M T j n 1 + where each e hj R V is a one-hot vector and H is the number of hidden units in the neural network (a hyperparameter ). Parameters ν include: M R V d, which are called embeddings (row vectors), one for every word in V Feedforward NN parameters b R V, A R (n 1) d V, W R V H, u R H, T R (n 1) d H j=1 d H 52 / 102

53 Breaking It Down Look up each of the history words h j, j {1,..., n 1} in M; keep two copies. e hj V e hj V M V d M V d 53 / 102

54 Breaking It Down Look up each of the history words h j, j {1,..., n 1} in M; keep two copies. Rename the embedding for h j as m hj. e hj M = m hj e hj M = m hj 54 / 102

55 Breaking It Down Apply an affine transformation to the second copy of the history-word embeddings (u, T) m hj u H n 1 + j=1 m hj T j d H 55 / 102

56 Breaking It Down Apply an affine transformation to the second copy of the history-word embeddings (u, T) and a tanh nonlinearity. m hj n 1 tanh u + m hj T j j=1 56 / 102

57 Breaking It Down Apply an affine transformation to everything (b, A, W). b V m hj A j n 1 + j=1 + W V H d V n 1 tanh u + m hj T j j=1 57 / 102

58 Breaking It Down Apply a softmax transformation to make the vector sum to one. n 1 softmax b + m hj A j j=1 n 1 + W tanh u + m hj T j j=1 58 / 102

59 Breaking It Down n 1 softmax b + m hj A j j=1 n 1 + W tanh u + m hj T j j=1 Like a log-linear language model with two kinds of features: Concatenation of context-word embeddings vectors m hj tanh-affine transformation of the above New parameters arise from (i) embeddings and (ii) affine transformation inside the nonlinearity. 59 / 102

60 Visualization M u, T tanh W softmax b, A 60 / 102

61 Number of Parameters D = }{{} V d + }{{} V + (n 1)dV + }{{}}{{} V H + }{{} H + (n 1)dH }{{} M b A W u T For Bengio et al. (2003): V (after OOV processing) d {30, 60} H {50, 100} n 1 = 5 So D = 461V parameters, compared to O(V n ) for classical n-gram models. Forcing A = 0 eliminated 300V parameters and performed a bit better, but was slower to converge. If we averaged m hj instead of concatenating, we d get to 221V (this is a variant of continuous bag of words, Mikolov et al., 2013). 61 / 102

62 Why does it work? 62 / 102

63 Why does it work? Historical answer: multiple layers and nonlinearities allow feature combinations a linear model can t get. 63 / 102

64 Why does it work? Historical answer: multiple layers and nonlinearities allow feature combinations a linear model can t get. Suppose we want y = xor(x1, x 2 ); this can t be expressed as a linear function of x 1 and x / 102

65 xor Example x 2 x 1 y Tuples where y = xor(x 1, x 2 ) are red; tuples where y xor(x 1, x 2 ) are blue. 65 / 102

66 Why does it work? Historical answer: multiple layers and nonlinearities allow feature combinations a linear model can t get. Suppose we want y = xor(x 1, x 2 ); this can t be expressed as a linear function of x 1 and x 2. But: z = x 1 x 2 y = x 1 + x 2 2z 66 / 102

67 xor Example (D = 13) Credit: Chris Dyer ( min mean squared error v,a,w,b x 1 {0,1} x 2 {0,1} min v,a,w,b x 1 {0,1} x 2 {0,1} iterations ( ( xor(x 1, x 2 ) v 3 xor(x 1, x 2 ) v 3 ( W 3 2 x 2 ( tanh ) ) 2 + b + a 3 W 3 2 x 2 ) ) 2 + b + a 3 67 / 102

68 Why does it work? Historical answer: multiple layers and nonlinearities allow feature combinations a linear model can t get. Suppose we want y = xor(x 1, x 2 ); this can t be expressed as a linear function of x 1 and x 2. But: z = x 1 x 2 y = x 1 + x 2 2z With high-dimensional inputs, there are a lot of conjunctive features to search through. For log-linear models, Della Pietra et al. (1997) did this, greedily. 68 / 102

69 Why does it work? Historical answer: multiple layers and nonlinearities allow feature combinations a linear model can t get. Suppose we want y = xor(x 1, x 2 ); this can t be expressed as a linear function of x 1 and x 2. But: z = x 1 x 2 y = x 1 + x 2 2z With high-dimensional inputs, there are a lot of conjunctive features to search through. For log-linear models, Della Pietra et al. (1997) did this, greedily. Neural models seem to smoothly explore lots of approximately-conjunctive features. 69 / 102

70 Why does it work? Historical answer: multiple layers and nonlinearities allow feature combinations a linear model can t get. Suppose we want y = xor(x 1, x 2 ); this can t be expressed as a linear function of x 1 and x 2. But: z = x 1 x 2 y = x 1 + x 2 2z With high-dimensional inputs, there are a lot of conjunctive features to search through. For log-linear models, Della Pietra et al. (1997) did this, greedily. Neural models seem to smoothly explore lots of approximately-conjunctive features. Modern answer: representations of words and histories are tuned to the prediction problem. 70 / 102

71 Why does it work? Historical answer: multiple layers and nonlinearities allow feature combinations a linear model can t get. Suppose we want y = xor(x 1, x 2 ); this can t be expressed as a linear function of x 1 and x 2. But: z = x 1 x 2 y = x 1 + x 2 2z With high-dimensional inputs, there are a lot of conjunctive features to search through. For log-linear models, Della Pietra et al. (1997) did this, greedily. Neural models seem to smoothly explore lots of approximately-conjunctive features. Modern answer: representations of words and histories are tuned to the prediction problem. Word embeddings: a powerful idea / 102

72 Important Idea: Words as Vectors The idea of embedding words in R d is much older than neural language models. 72 / 102

73 Important Idea: Words as Vectors The idea of embedding words in R d is much older than neural language models. You should think of this as a generalization of the discrete view of V. 73 / 102

74 Important Idea: Words as Vectors The idea of embedding words in R d is much older than neural language models. You should think of this as a generalization of the discrete view of V. Considerable ongoing research on learning word representations to capture linguistic similarity (Turney and Pantel, 2010); this is known as vector space semantics. 74 / 102

75 Words as Vectors: Example baby cat 75 / 102

76 Words as Vectors: Example baby pig mouse cat 76 / 102

77 Parameter Estimation Bad news for neural language models: Log-likelihood function is not concave. So any perplexity experiment is evaluating the model and an algorithm for estimating it. Calculating log-likelihood and its gradient is very expensive (5 epochs took 3 weeks on 40 CPUs). 77 / 102

78 Parameter Estimation Bad news for neural language models: Log-likelihood function is not concave. So any perplexity experiment is evaluating the model and an algorithm for estimating it. Calculating log-likelihood and its gradient is very expensive (5 epochs took 3 weeks on 40 CPUs). Good news: n ν is differentiable with respect to M (from which its inputs come) and ν (its parameters), so gradient-based methods are available. Essential: the chain rule from calculus (sometimes called backpropagation ) Lots more details in Bengio et al. (2003) and (for NNs more generally) in Goldberg (2015). 78 / 102

79 Next Up More examples of neural language models (in brief): The log-bilinear language model Recurrent neural network language models 79 / 102

80 Log-Bilinear Language Model (Mnih and Hinton, 2007) Define the n-gram probability as follows, for each v V: n 1 ( exp p(v h 1,..., h n 1 ) = j=1 n 1 ( exp v V j=1 m hj A j d d d m hj A j d d d ) + b m v d d ) + b m v d d +c v +c v 80 / 102

81 Log-Bilinear Language Model (Mnih and Hinton, 2007) Define the n-gram probability as follows, for each v V: n 1 ( exp p(v h 1,..., h n 1 ) = j=1 n 1 ( exp v V j=1 m hj A j d d d m hj A j Number of parameters: D = }{{} V d + (n 1)d 2 + d }{{} M A d d d }{{} b ) + b m v d d ) + b m v d d + V }{{} c +c v +c v 81 / 102

82 Log-Bilinear Language Model (Mnih and Hinton, 2007) Define the n-gram probability as follows, for each v V: n 1 ( exp p(v h 1,..., h n 1 ) = j=1 n 1 ( exp v V j=1 m hj A j d d d m hj A j d d d ) + b m v d d ) + b m v d d +c v +c v Number of parameters: D = }{{} V d + (n 1)d 2 + }{{}}{{} d + }{{} V M A b c The predicted word s probability depends on its vector m v, not just on the vectors of the history words. 82 / 102

83 Log-Bilinear Language Model (Mnih and Hinton, 2007) Define the n-gram probability as follows, for each v V: n 1 ( exp p(v h 1,..., h n 1 ) = j=1 n 1 ( exp v V j=1 m hj A j d d d m hj A j d d d ) + b m v d d ) + b m v d d +c v +c v Number of parameters: D = }{{} V d + (n 1)d 2 + }{{}}{{} d + }{{} V M A b c The predicted word s probability depends on its vector m v, not just on the vectors of the history words. Training this model involves a sum over the vocabulary (like log-linear models we saw earlier). 83 / 102

84 Log-Bilinear Language Model (Mnih and Hinton, 2007) Define the n-gram probability as follows, for each v V: n 1 ( exp p(v h 1,..., h n 1 ) = j=1 n 1 ( exp v V j=1 m hj A j d d d m hj A j d d d ) + b m v d d ) + b m v d d +c v +c v Number of parameters: D = }{{} V d + (n 1)d 2 + }{{}}{{} d + }{{} V M A b c The predicted word s probability depends on its vector m v, not just on the vectors of the history words. Training this model involves a sum over the vocabulary (like log-linear models we saw earlier). Later work explored variations to make learning faster. 84 / 102

85 Observations about Neural Language Models (So Far) There s no knowledge built in that the most recent word h n 1 should generally be more informative than earlier ones. This has to be learned. In addition to choosing n, also have to choose dimensionalities like d and H. Parameters of these models are hard to interpret. 85 / 102

86 Observations about Neural Language Models (So Far) There s no knowledge built in that the most recent word h n 1 should generally be more informative than earlier ones. This has to be learned. In addition to choosing n, also have to choose dimensionalities like d and H. Parameters of these models are hard to interpret. Example: l2 -norm of A j and T j in the feedforward model correspond to the importance of history position j. Individual word embeddings can be clustered and dimensions can be analyzed (e.g., Tsvetkov et al., 2015). 86 / 102

87 Observations about Neural Language Models (So Far) There s no knowledge built in that the most recent word h n 1 should generally be more informative than earlier ones. This has to be learned. In addition to choosing n, also have to choose dimensionalities like d and H. Parameters of these models are hard to interpret. Architectures are not intuitive. 87 / 102

88 Observations about Neural Language Models (So Far) There s no knowledge built in that the most recent word h n 1 should generally be more informative than earlier ones. This has to be learned. In addition to choosing n, also have to choose dimensionalities like d and H. Parameters of these models are hard to interpret. Architectures are not intuitive. Still, impressive perplexity gains got people s interest. 88 / 102

89 Recurrent Neural Network Each input element is understood to be an element of a sequence: x 1, x 2,..., x l At each timestep t: The tth input element x t is processed alongside the previous state s t 1 to calculate the new state (s t ). The tth output is a function of the state st. The same functions are applied at each iteration: s t = f recurrent (x t, s t 1 ) y t = f output (s t ) In RNN language models, words and histories are represented as vectors (respectively, x t = e xt and s t ). 89 / 102

90 RNN Language Model The original version, by Mikolov et al. (2010) used a simple RNN architecture along these lines: ( ( ) s t = f recurrent (e xt, s t 1 ) = sigmoid e x t M) A + s t 1 B + c ( ) y t = f output (s t ) = softmax s t U p(v x 1,..., x t 1 ) = [y t ] v Note: this is not an n-gram (Markov) model! 90 / 102

91 Visualization M sigmoid A, B, c U softmax s t s t - 1 x t y t 91 / 102

92 Visualization M A, B, c sigmoid U softmax M A, B, c sigmoid U softmax M A, B, c sigmoid U softmax M A, B, c sigmoid U softmax 92 / 102

93 Improvements to RNN Language Models The simple RNN is known to suffer from two related problems: Vanishing gradients during learning make it hard to propagate error into the distant past. State tends to change a lot on each iteration; the model forgets too much. Some variants: Stacking these functions to make deeper networks. Sundermeyer et al. (2012) use long short-term memories (LSTMs) and Cho et al. (2014) use gated recurrent units (GRUs) to define f recurrent. Mikolov et al. (2014) engineer the linear transformation in the simple RNN for better preservation. Jozefowicz et al. (2015) used randomized search to find even better architectures. 93 / 102

94 Comparison: Probabilistic vs. Connectionist Modeling Probabilistic Connectionist What do we engineer? features, assumptions architectures Theory? as N gets large not really Interpretation of parameters? often easy usually hard 94 / 102

95 Parting Shots 95 / 102

96 Parting Shots I said very little about estimating the parameters. 96 / 102

97 Parting Shots I said very little about estimating the parameters. At present, this requires a lot of engineering. 97 / 102

98 Parting Shots I said very little about estimating the parameters. At present, this requires a lot of engineering. New libraries to help you are coming out all the time. 98 / 102

99 Parting Shots I said very little about estimating the parameters. At present, this requires a lot of engineering. New libraries to help you are coming out all the time. Many of them use GPUs to speed things up. 99 / 102

100 Parting Shots I said very little about estimating the parameters. At present, this requires a lot of engineering. New libraries to help you are coming out all the time. Many of them use GPUs to speed things up. This progression is worth reflecting on: history: represented as: before 1996 (n 1)-gram discrete feature vector embedded vector since 2010 unrestricted embedded 100 / 102

101 References I Yoshua Bengio, Réjean Ducharme, Pascal Vincent, and Christian Jauvin. A neural probabilistic language model. Journal of Machine Learning Research, 3(Feb): , URL Kyunghyun Cho, Bart van Merrienboer, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, Holger Schwenk, and Yoshua Bengio. Learning phrase representations using RNN encoder decoder for statistical machine translation. In Proc. of EMNLP, Michael Collins. Log-linear models, MEMMs, and CRFs, URL Stephen Della Pietra, Vincent Della Pietra, and John Lafferty. Inducing features of random fields. IEEE Transactions on Pattern Analysis and Machine Intelligence, 19(4): , Jacob Eisenstein, Amr Ahmed, and Eric P Xing. Sparse additive generative models of text. In Proc. of ICML, Yoav Goldberg. A primer on neural network models for natural language processing, URL Rafal Jozefowicz, Wojciech Zaremba, and Ilya Sutskever. An empirical exploration of recurrent network architectures. In Proc. of ICML, URL Daniel Jurafsky and James H. Martin. N-grams (draft chapter), URL / 102

102 References II Raymond Lau, Ronald Rosenfeld, and Salim Roukos. Trigger-based language models: A maximum entropy approach. In Proc. of ICASSP, Tomas Mikolov, Martin Karafiát, Lukas Burget, Jan Cernockỳ, and Sanjeev Khudanpur. Recurrent neural network based language model. In Proc. of Interspeech, URL http: // Tomas Mikolov, Kai Chen, Greg Corrado, and Jeffrey Dean. Efficient estimation of word representations in vector space. In Proceedings of ICLR, URL Tomas Mikolov, Armand Joulin, Sumit Chopra, Michael Mathieu, and Marc Aurelio Ranzato. Learning longer memory in recurrent neural networks, arxiv: Andriy Mnih and Geoffrey Hinton. Three new graphical models for statistical language modelling. In Proc. of ICML, Noah A. Smith. Probabilistic language models 1.0, URL Martin Sundermeyer, Ralf Schlüter, and Hermann Ney. LSTM neural networks for language modeling. In Proc. of Interspeech, Yulia Tsvetkov, Manaal Faruqui, Wang Ling, Guillaume Lample, and Chris Dyer. Evaluation of word vector representations by subspace alignment. In Proc. of EMNLP, Peter D. Turney and Patrick Pantel. From frequency to meaning: Vector space models of semantics. Journal of Artificial Intelligence Research, 37(1): , URL / 102

Neural Network Language Modeling

Neural Network Language Modeling Neural Network Language Modeling Instructor: Wei Xu Ohio State University CSE 5525 Many slides from Marek Rei, Philipp Koehn and Noah Smith Course Project Sign up your course project In-class presentation

More information

Improved Learning through Augmenting the Loss

Improved Learning through Augmenting the Loss Improved Learning through Augmenting the Loss Hakan Inan inanh@stanford.edu Khashayar Khosravi khosravi@stanford.edu Abstract We present two improvements to the well-known Recurrent Neural Network Language

More information

Natural Language Processing (CSEP 517): Machine Translation (Continued), Summarization, & Finale

Natural Language Processing (CSEP 517): Machine Translation (Continued), Summarization, & Finale Natural Language Processing (CSEP 517): Machine Translation (Continued), Summarization, & Finale Noah Smith c 2017 University of Washington nasmith@cs.washington.edu May 22, 2017 1 / 30 To-Do List Online

More information

Deep learning for Natural Language Processing and Machine Translation

Deep learning for Natural Language Processing and Machine Translation Deep learning for Natural Language Processing and Machine Translation 2015.10.16 Seung-Hoon Na Contents Introduction: Neural network, deep learning Deep learning for Natural language processing Neural

More information

Deep Learning Recurrent Networks 2/28/2018

Deep Learning Recurrent Networks 2/28/2018 Deep Learning Recurrent Networks /8/8 Recap: Recurrent networks can be incredibly effective Story so far Y(t+) Stock vector X(t) X(t+) X(t+) X(t+) X(t+) X(t+5) X(t+) X(t+7) Iterated structures are good

More information

CSC321 Lecture 10 Training RNNs

CSC321 Lecture 10 Training RNNs CSC321 Lecture 10 Training RNNs Roger Grosse and Nitish Srivastava February 23, 2015 Roger Grosse and Nitish Srivastava CSC321 Lecture 10 Training RNNs February 23, 2015 1 / 18 Overview Last time, we saw

More information

From perceptrons to word embeddings. Simon Šuster University of Groningen

From perceptrons to word embeddings. Simon Šuster University of Groningen From perceptrons to word embeddings Simon Šuster University of Groningen Outline A basic computational unit Weighting some input to produce an output: classification Perceptron Classify tweets Written

More information

Empirical Methods in Natural Language Processing Lecture 10a More smoothing and the Noisy Channel Model

Empirical Methods in Natural Language Processing Lecture 10a More smoothing and the Noisy Channel Model Empirical Methods in Natural Language Processing Lecture 10a More smoothing and the Noisy Channel Model (most slides from Sharon Goldwater; some adapted from Philipp Koehn) 5 October 2016 Nathan Schneider

More information

Based on the original slides of Hung-yi Lee

Based on the original slides of Hung-yi Lee Based on the original slides of Hung-yi Lee New Activation Function Rectified Linear Unit (ReLU) σ z a a = z Reason: 1. Fast to compute 2. Biological reason a = 0 [Xavier Glorot, AISTATS 11] [Andrew L.

More information

High Order LSTM/GRU. Wenjie Luo. January 19, 2016

High Order LSTM/GRU. Wenjie Luo. January 19, 2016 High Order LSTM/GRU Wenjie Luo January 19, 2016 1 Introduction RNN is a powerful model for sequence data but suffers from gradient vanishing and explosion, thus difficult to be trained to capture long

More information

Natural Language Processing (CSE 490U): Language Models

Natural Language Processing (CSE 490U): Language Models Natural Language Processing (CSE 490U): Language Models Noah Smith c 2017 University of Washington nasmith@cs.washington.edu January 6 9, 2017 1 / 67 Very Quick Review of Probability Event space (e.g.,

More information

CS230: Lecture 8 Word2Vec applications + Recurrent Neural Networks with Attention

CS230: Lecture 8 Word2Vec applications + Recurrent Neural Networks with Attention CS23: Lecture 8 Word2Vec applications + Recurrent Neural Networks with Attention Today s outline We will learn how to: I. Word Vector Representation i. Training - Generalize results with word vectors -

More information

CSC321 Lecture 15: Recurrent Neural Networks

CSC321 Lecture 15: Recurrent Neural Networks CSC321 Lecture 15: Recurrent Neural Networks Roger Grosse Roger Grosse CSC321 Lecture 15: Recurrent Neural Networks 1 / 26 Overview Sometimes we re interested in predicting sequences Speech-to-text and

More information

Inter-document Contextual Language Model

Inter-document Contextual Language Model Inter-document Contextual Language Model Quan Hung Tran and Ingrid Zukerman and Gholamreza Haffari Faculty of Information Technology Monash University, Australia hung.tran,ingrid.zukerman,gholamreza.haffari@monash.edu

More information

word2vec Parameter Learning Explained

word2vec Parameter Learning Explained word2vec Parameter Learning Explained Xin Rong ronxin@umich.edu Abstract The word2vec model and application by Mikolov et al. have attracted a great amount of attention in recent two years. The vector

More information

Lecture 5 Neural models for NLP

Lecture 5 Neural models for NLP CS546: Machine Learning in NLP (Spring 2018) http://courses.engr.illinois.edu/cs546/ Lecture 5 Neural models for NLP Julia Hockenmaier juliahmr@illinois.edu 3324 Siebel Center Office hours: Tue/Thu 2pm-3pm

More information

Natural Language Processing and Recurrent Neural Networks

Natural Language Processing and Recurrent Neural Networks Natural Language Processing and Recurrent Neural Networks Pranay Tarafdar October 19 th, 2018 Outline Introduction to NLP Word2vec RNN GRU LSTM Demo What is NLP? Natural Language? : Huge amount of information

More information

arxiv: v1 [cs.cl] 21 May 2017

arxiv: v1 [cs.cl] 21 May 2017 Spelling Correction as a Foreign Language Yingbo Zhou yingbzhou@ebay.com Utkarsh Porwal uporwal@ebay.com Roberto Konow rkonow@ebay.com arxiv:1705.07371v1 [cs.cl] 21 May 2017 Abstract In this paper, we

More information

arxiv: v1 [cs.ne] 19 Dec 2016

arxiv: v1 [cs.ne] 19 Dec 2016 A RECURRENT NEURAL NETWORK WITHOUT CHAOS Thomas Laurent Department of Mathematics Loyola Marymount University Los Angeles, CA 90045, USA tlaurent@lmu.edu James von Brecht Department of Mathematics California

More information

a) b) (Natural Language Processing; NLP) (Deep Learning) Bag of words White House RGB [1] IBM

a) b) (Natural Language Processing; NLP) (Deep Learning) Bag of words White House RGB [1] IBM c 1. (Natural Language Processing; NLP) (Deep Learning) RGB IBM 135 8511 5 6 52 yutat@jp.ibm.com a) b) 2. 1 0 2 1 Bag of words White House 2 [1] 2015 4 Copyright c by ORSJ. Unauthorized reproduction of

More information

A QUESTION ANSWERING SYSTEM USING ENCODER-DECODER, SEQUENCE-TO-SEQUENCE, RECURRENT NEURAL NETWORKS. A Project. Presented to

A QUESTION ANSWERING SYSTEM USING ENCODER-DECODER, SEQUENCE-TO-SEQUENCE, RECURRENT NEURAL NETWORKS. A Project. Presented to A QUESTION ANSWERING SYSTEM USING ENCODER-DECODER, SEQUENCE-TO-SEQUENCE, RECURRENT NEURAL NETWORKS A Project Presented to The Faculty of the Department of Computer Science San José State University In

More information

Neural Networks with Applications to Vision and Language. Feedforward Networks. Marco Kuhlmann

Neural Networks with Applications to Vision and Language. Feedforward Networks. Marco Kuhlmann Neural Networks with Applications to Vision and Language Feedforward Networks Marco Kuhlmann Feedforward networks Linear separability x 2 x 2 0 1 0 1 0 0 x 1 1 0 x 1 linearly separable not linearly separable

More information

EE-559 Deep learning LSTM and GRU

EE-559 Deep learning LSTM and GRU EE-559 Deep learning 11.2. LSTM and GRU François Fleuret https://fleuret.org/ee559/ Mon Feb 18 13:33:24 UTC 2019 ÉCOLE POLYTECHNIQUE FÉDÉRALE DE LAUSANNE The Long-Short Term Memory unit (LSTM) by Hochreiter

More information

Foundations of Natural Language Processing Lecture 5 More smoothing and the Noisy Channel Model

Foundations of Natural Language Processing Lecture 5 More smoothing and the Noisy Channel Model Foundations of Natural Language Processing Lecture 5 More smoothing and the Noisy Channel Model Alex Lascarides (Slides based on those from Alex Lascarides, Sharon Goldwater and Philipop Koehn) 30 January

More information

Random Coattention Forest for Question Answering

Random Coattention Forest for Question Answering Random Coattention Forest for Question Answering Jheng-Hao Chen Stanford University jhenghao@stanford.edu Ting-Po Lee Stanford University tingpo@stanford.edu Yi-Chun Chen Stanford University yichunc@stanford.edu

More information

Natural Language Processing (CSE 517): Cotext Models (II)

Natural Language Processing (CSE 517): Cotext Models (II) Natural Language Processing (CSE 517): Cotext Models (II) Noah Smith c 2016 University of Washington nasmith@cs.washington.edu January 25, 2016 Thanks to David Mimno for comments. 1 / 30 Three Kinds of

More information

Recurrent Neural Networks (Part - 2) Sumit Chopra Facebook

Recurrent Neural Networks (Part - 2) Sumit Chopra Facebook Recurrent Neural Networks (Part - 2) Sumit Chopra Facebook Recap Standard RNNs Training: Backpropagation Through Time (BPTT) Application to sequence modeling Language modeling Applications: Automatic speech

More information

Lecture 6: Neural Networks for Representing Word Meaning

Lecture 6: Neural Networks for Representing Word Meaning Lecture 6: Neural Networks for Representing Word Meaning Mirella Lapata School of Informatics University of Edinburgh mlap@inf.ed.ac.uk February 7, 2017 1 / 28 Logistic Regression Input is a feature vector,

More information

Introduction to RNNs!

Introduction to RNNs! Introduction to RNNs Arun Mallya Best viewed with Computer Modern fonts installed Outline Why Recurrent Neural Networks (RNNs)? The Vanilla RNN unit The RNN forward pass Backpropagation refresher The RNN

More information

Deep Learning Sequence to Sequence models: Attention Models. 17 March 2018

Deep Learning Sequence to Sequence models: Attention Models. 17 March 2018 Deep Learning Sequence to Sequence models: Attention Models 17 March 2018 1 Sequence-to-sequence modelling Problem: E.g. A sequence X 1 X N goes in A different sequence Y 1 Y M comes out Speech recognition:

More information

Recurrent Neural Networks Deep Learning Lecture 5. Efstratios Gavves

Recurrent Neural Networks Deep Learning Lecture 5. Efstratios Gavves Recurrent Neural Networks Deep Learning Lecture 5 Efstratios Gavves Sequential Data So far, all tasks assumed stationary data Neither all data, nor all tasks are stationary though Sequential Data: Text

More information

Semantics with Dense Vectors. Reference: D. Jurafsky and J. Martin, Speech and Language Processing

Semantics with Dense Vectors. Reference: D. Jurafsky and J. Martin, Speech and Language Processing Semantics with Dense Vectors Reference: D. Jurafsky and J. Martin, Speech and Language Processing 1 Semantics with Dense Vectors We saw how to represent a word as a sparse vector with dimensions corresponding

More information

Lecture 17: Neural Networks and Deep Learning

Lecture 17: Neural Networks and Deep Learning UVA CS 6316 / CS 4501-004 Machine Learning Fall 2016 Lecture 17: Neural Networks and Deep Learning Jack Lanchantin Dr. Yanjun Qi 1 Neurons 1-Layer Neural Network Multi-layer Neural Network Loss Functions

More information

Sequence Modeling with Neural Networks

Sequence Modeling with Neural Networks Sequence Modeling with Neural Networks Harini Suresh y 0 y 1 y 2 s 0 s 1 s 2... x 0 x 1 x 2 hat is a sequence? This morning I took the dog for a walk. sentence medical signals speech waveform Successes

More information

NEURAL LANGUAGE MODELS

NEURAL LANGUAGE MODELS COMP90042 LECTURE 14 NEURAL LANGUAGE MODELS LANGUAGE MODELS Assign a probability to a sequence of words Framed as sliding a window over the sentence, predicting each word from finite context to left E.g.,

More information

Natural Language Processing (CSEP 517): Text Classification

Natural Language Processing (CSEP 517): Text Classification Natural Language Processing (CSEP 517): Text Classification Noah Smith c 2017 University of Washington nasmith@cs.washington.edu April 10, 2017 1 / 71 To-Do List Online quiz: due Sunday Read: Jurafsky

More information

Neural Networks Language Models

Neural Networks Language Models Neural Networks Language Models Philipp Koehn 10 October 2017 N-Gram Backoff Language Model 1 Previously, we approximated... by applying the chain rule p(w ) = p(w 1, w 2,..., w n ) p(w ) = i p(w i w 1,...,

More information

Natural Language Processing (CSE 517): Cotext Models

Natural Language Processing (CSE 517): Cotext Models Natural Language Processing (CSE 517): Cotext Models Noah Smith c 2018 University of Washington nasmith@cs.washington.edu April 18, 2018 1 / 32 Latent Dirichlet Allocation (Blei et al., 2003) Widely used

More information

Faster Training of Very Deep Networks Via p-norm Gates

Faster Training of Very Deep Networks Via p-norm Gates Faster Training of Very Deep Networks Via p-norm Gates Trang Pham, Truyen Tran, Dinh Phung, Svetha Venkatesh Center for Pattern Recognition and Data Analytics Deakin University, Geelong Australia Email:

More information

Natural Language Processing

Natural Language Processing Natural Language Processing Info 159/259 Lecture 7: Language models 2 (Sept 14, 2017) David Bamman, UC Berkeley Language Model Vocabulary V is a finite set of discrete symbols (e.g., words, characters);

More information

RECURRENT NEURAL NETWORK BASED LANGUAGE MODELING WITH CONTROLLABLE EXTERNAL MEMORY

RECURRENT NEURAL NETWORK BASED LANGUAGE MODELING WITH CONTROLLABLE EXTERNAL MEMORY RECURRENT NEURAL NETWORK BASED LANGUAGE MODELING WITH CONTROLLABLE EXTERNAL MEMORY Wei-Jen Ko 1, Bo-Hsiang Tseng 2, Hung-Yi Lee 2 1 Research Center for Information Technology Innovation, Academia Sinica

More information

arxiv: v3 [cs.cl] 30 Jan 2016

arxiv: v3 [cs.cl] 30 Jan 2016 word2vec Parameter Learning Explained Xin Rong ronxin@umich.edu arxiv:1411.2738v3 [cs.cl] 30 Jan 2016 Abstract The word2vec model and application by Mikolov et al. have attracted a great amount of attention

More information

IMPROVING STOCHASTIC GRADIENT DESCENT

IMPROVING STOCHASTIC GRADIENT DESCENT IMPROVING STOCHASTIC GRADIENT DESCENT WITH FEEDBACK Jayanth Koushik & Hiroaki Hayashi Language Technologies Institute Carnegie Mellon University Pittsburgh, PA 15213, USA {jkoushik,hiroakih}@cs.cmu.edu

More information

DISTRIBUTIONAL SEMANTICS

DISTRIBUTIONAL SEMANTICS COMP90042 LECTURE 4 DISTRIBUTIONAL SEMANTICS LEXICAL DATABASES - PROBLEMS Manually constructed Expensive Human annotation can be biased and noisy Language is dynamic New words: slangs, terminology, etc.

More information

Machine Translation. 10: Advanced Neural Machine Translation Architectures. Rico Sennrich. University of Edinburgh. R. Sennrich MT / 26

Machine Translation. 10: Advanced Neural Machine Translation Architectures. Rico Sennrich. University of Edinburgh. R. Sennrich MT / 26 Machine Translation 10: Advanced Neural Machine Translation Architectures Rico Sennrich University of Edinburgh R. Sennrich MT 2018 10 1 / 26 Today s Lecture so far today we discussed RNNs as encoder and

More information

Gated Recurrent Neural Tensor Network

Gated Recurrent Neural Tensor Network Gated Recurrent Neural Tensor Network Andros Tjandra, Sakriani Sakti, Ruli Manurung, Mirna Adriani and Satoshi Nakamura Faculty of Computer Science, Universitas Indonesia, Indonesia Email: andros.tjandra@gmail.com,

More information

arxiv: v1 [stat.ml] 18 Nov 2017

arxiv: v1 [stat.ml] 18 Nov 2017 MinimalRNN: Toward More Interpretable and Trainable Recurrent Neural Networks arxiv:1711.06788v1 [stat.ml] 18 Nov 2017 Minmin Chen Google Mountain view, CA 94043 minminc@google.com Abstract We introduce

More information

Sparse vectors recap. ANLP Lecture 22 Lexical Semantics with Dense Vectors. Before density, another approach to normalisation.

Sparse vectors recap. ANLP Lecture 22 Lexical Semantics with Dense Vectors. Before density, another approach to normalisation. ANLP Lecture 22 Lexical Semantics with Dense Vectors Henry S. Thompson Based on slides by Jurafsky & Martin, some via Dorota Glowacka 5 November 2018 Previous lectures: Sparse vectors recap How to represent

More information

ANLP Lecture 22 Lexical Semantics with Dense Vectors

ANLP Lecture 22 Lexical Semantics with Dense Vectors ANLP Lecture 22 Lexical Semantics with Dense Vectors Henry S. Thompson Based on slides by Jurafsky & Martin, some via Dorota Glowacka 5 November 2018 Henry S. Thompson ANLP Lecture 22 5 November 2018 Previous

More information

Recurrent Neural Networks 2. CS 287 (Based on Yoav Goldberg s notes)

Recurrent Neural Networks 2. CS 287 (Based on Yoav Goldberg s notes) Recurrent Neural Networks 2 CS 287 (Based on Yoav Goldberg s notes) Review: Representation of Sequence Many tasks in NLP involve sequences w 1,..., w n Representations as matrix dense vectors X (Following

More information

Deep Learning for Natural Language Processing. Sidharth Mudgal April 4, 2017

Deep Learning for Natural Language Processing. Sidharth Mudgal April 4, 2017 Deep Learning for Natural Language Processing Sidharth Mudgal April 4, 2017 Table of contents 1. Intro 2. Word Vectors 3. Word2Vec 4. Char Level Word Embeddings 5. Application: Entity Matching 6. Conclusion

More information

Introduction to Deep Neural Networks

Introduction to Deep Neural Networks Introduction to Deep Neural Networks Presenter: Chunyuan Li Pattern Classification and Recognition (ECE 681.01) Duke University April, 2016 Outline 1 Background and Preliminaries Why DNNs? Model: Logistic

More information

Combining Static and Dynamic Information for Clinical Event Prediction

Combining Static and Dynamic Information for Clinical Event Prediction Combining Static and Dynamic Information for Clinical Event Prediction Cristóbal Esteban 1, Antonio Artés 2, Yinchong Yang 1, Oliver Staeck 3, Enrique Baca-García 4 and Volker Tresp 1 1 Siemens AG and

More information

Recurrent Neural Networks. Jian Tang

Recurrent Neural Networks. Jian Tang Recurrent Neural Networks Jian Tang tangjianpku@gmail.com 1 RNN: Recurrent neural networks Neural networks for sequence modeling Summarize a sequence with fix-sized vector through recursively updating

More information

Conditional Language Modeling. Chris Dyer

Conditional Language Modeling. Chris Dyer Conditional Language Modeling Chris Dyer Unconditional LMs A language model assigns probabilities to sequences of words,. w =(w 1,w 2,...,w`) It is convenient to decompose this probability using the chain

More information

Machine Learning. Neural Networks. (slides from Domingos, Pardo, others)

Machine Learning. Neural Networks. (slides from Domingos, Pardo, others) Machine Learning Neural Networks (slides from Domingos, Pardo, others) For this week, Reading Chapter 4: Neural Networks (Mitchell, 1997) See Canvas For subsequent weeks: Scaling Learning Algorithms toward

More information

An overview of word2vec

An overview of word2vec An overview of word2vec Benjamin Wilson Berlin ML Meetup, July 8 2014 Benjamin Wilson word2vec Berlin ML Meetup 1 / 25 Outline 1 Introduction 2 Background & Significance 3 Architecture 4 CBOW word representations

More information

Need for Deep Networks Perceptron. Can only model linear functions. Kernel Machines. Non-linearity provided by kernels

Need for Deep Networks Perceptron. Can only model linear functions. Kernel Machines. Non-linearity provided by kernels Need for Deep Networks Perceptron Can only model linear functions Kernel Machines Non-linearity provided by kernels Need to design appropriate kernels (possibly selecting from a set, i.e. kernel learning)

More information

arxiv: v2 [cs.cl] 1 Jan 2019

arxiv: v2 [cs.cl] 1 Jan 2019 Variational Self-attention Model for Sentence Representation arxiv:1812.11559v2 [cs.cl] 1 Jan 2019 Qiang Zhang 1, Shangsong Liang 2, Emine Yilmaz 1 1 University College London, London, United Kingdom 2

More information

Structured Neural Networks (I)

Structured Neural Networks (I) Structured Neural Networks (I) CS 690N, Spring 208 Advanced Natural Language Processing http://peoplecsumassedu/~brenocon/anlp208/ Brendan O Connor College of Information and Computer Sciences University

More information

Part-of-Speech Tagging + Neural Networks 3: Word Embeddings CS 287

Part-of-Speech Tagging + Neural Networks 3: Word Embeddings CS 287 Part-of-Speech Tagging + Neural Networks 3: Word Embeddings CS 287 Review: Neural Networks One-layer multi-layer perceptron architecture, NN MLP1 (x) = g(xw 1 + b 1 )W 2 + b 2 xw + b; perceptron x is the

More information

Algorithms for NLP. Language Modeling III. Taylor Berg-Kirkpatrick CMU Slides: Dan Klein UC Berkeley

Algorithms for NLP. Language Modeling III. Taylor Berg-Kirkpatrick CMU Slides: Dan Klein UC Berkeley Algorithms for NLP Language Modeling III Taylor Berg-Kirkpatrick CMU Slides: Dan Klein UC Berkeley Announcements Office hours on website but no OH for Taylor until next week. Efficient Hashing Closed address

More information

Artificial Neural Networks D B M G. Data Base and Data Mining Group of Politecnico di Torino. Elena Baralis. Politecnico di Torino

Artificial Neural Networks D B M G. Data Base and Data Mining Group of Politecnico di Torino. Elena Baralis. Politecnico di Torino Artificial Neural Networks Data Base and Data Mining Group of Politecnico di Torino Elena Baralis Politecnico di Torino Artificial Neural Networks Inspired to the structure of the human brain Neurons as

More information

Deep Gate Recurrent Neural Network

Deep Gate Recurrent Neural Network JMLR: Workshop and Conference Proceedings 63:350 365, 2016 ACML 2016 Deep Gate Recurrent Neural Network Yuan Gao University of Helsinki Dorota Glowacka University of Helsinki gaoyuankidult@gmail.com glowacka@cs.helsinki.fi

More information

Recurrent Neural Networks. COMP-550 Oct 5, 2017

Recurrent Neural Networks. COMP-550 Oct 5, 2017 Recurrent Neural Networks COMP-550 Oct 5, 2017 Outline Introduction to neural networks and deep learning Feedforward neural networks Recurrent neural networks 2 Classification Review y = f( x) output label

More information

Machine Learning. Neural Networks. (slides from Domingos, Pardo, others)

Machine Learning. Neural Networks. (slides from Domingos, Pardo, others) Machine Learning Neural Networks (slides from Domingos, Pardo, others) Human Brain Neurons Input-Output Transformation Input Spikes Output Spike Spike (= a brief pulse) (Excitatory Post-Synaptic Potential)

More information

CSC321 Lecture 15: Exploding and Vanishing Gradients

CSC321 Lecture 15: Exploding and Vanishing Gradients CSC321 Lecture 15: Exploding and Vanishing Gradients Roger Grosse Roger Grosse CSC321 Lecture 15: Exploding and Vanishing Gradients 1 / 23 Overview Yesterday, we saw how to compute the gradient descent

More information

Recurrent Neural Networks (RNN) and Long-Short-Term-Memory (LSTM) Yuan YAO HKUST

Recurrent Neural Networks (RNN) and Long-Short-Term-Memory (LSTM) Yuan YAO HKUST 1 Recurrent Neural Networks (RNN) and Long-Short-Term-Memory (LSTM) Yuan YAO HKUST Summary We have shown: Now First order optimization methods: GD (BP), SGD, Nesterov, Adagrad, ADAM, RMSPROP, etc. Second

More information

Recurrent Neural Networks with Flexible Gates using Kernel Activation Functions

Recurrent Neural Networks with Flexible Gates using Kernel Activation Functions 2018 IEEE International Workshop on Machine Learning for Signal Processing (MLSP 18) Recurrent Neural Networks with Flexible Gates using Kernel Activation Functions Authors: S. Scardapane, S. Van Vaerenbergh,

More information

Graphical models for part of speech tagging

Graphical models for part of speech tagging Indian Institute of Technology, Bombay and Research Division, India Research Lab Graphical models for part of speech tagging Different Models for POS tagging HMM Maximum Entropy Markov Models Conditional

More information

Eve: A Gradient Based Optimization Method with Locally and Globally Adaptive Learning Rates

Eve: A Gradient Based Optimization Method with Locally and Globally Adaptive Learning Rates Eve: A Gradient Based Optimization Method with Locally and Globally Adaptive Learning Rates Hiroaki Hayashi 1,* Jayanth Koushik 1,* Graham Neubig 1 arxiv:1611.01505v3 [cs.lg] 11 Jun 2018 Abstract Adaptive

More information

arxiv: v1 [cs.cl] 31 May 2015

arxiv: v1 [cs.cl] 31 May 2015 Recurrent Neural Networks with External Memory for Language Understanding Baolin Peng 1, Kaisheng Yao 2 1 The Chinese University of Hong Kong 2 Microsoft Research blpeng@se.cuhk.edu.hk, kaisheny@microsoft.com

More information

Lecture 15: Recurrent Neural Nets

Lecture 15: Recurrent Neural Nets Lecture 15: Recurrent Neural Nets Roger Grosse 1 Introduction Most of the prediction tasks we ve looked at have involved pretty simple kinds of outputs, such as real values or discrete categories. But

More information

Machine Learning for Large-Scale Data Analysis and Decision Making A. Neural Networks Week #6

Machine Learning for Large-Scale Data Analysis and Decision Making A. Neural Networks Week #6 Machine Learning for Large-Scale Data Analysis and Decision Making 80-629-17A Neural Networks Week #6 Today Neural Networks A. Modeling B. Fitting C. Deep neural networks Today s material is (adapted)

More information

Feedforward Neural Networks

Feedforward Neural Networks Feedforward Neural Networks Michael Collins 1 Introduction In the previous notes, we introduced an important class of models, log-linear models. In this note, we describe feedforward neural networks, which

More information

Recurrent and Recursive Networks

Recurrent and Recursive Networks Neural Networks with Applications to Vision and Language Recurrent and Recursive Networks Marco Kuhlmann Introduction Applications of sequence modelling Map unsegmented connected handwriting to strings.

More information

Deep Learning for NLP

Deep Learning for NLP Deep Learning for NLP CS224N Christopher Manning (Many slides borrowed from ACL 2012/NAACL 2013 Tutorials by me, Richard Socher and Yoshua Bengio) Machine Learning and NLP NER WordNet Usually machine learning

More information

Character-level Language Modeling with Gated Hierarchical Recurrent Neural Networks

Character-level Language Modeling with Gated Hierarchical Recurrent Neural Networks Interspeech 2018 2-6 September 2018, Hyderabad Character-level Language Modeling with Gated Hierarchical Recurrent Neural Networks Iksoo Choi, Jinhwan Park, Wonyong Sung Department of Electrical and Computer

More information

Long-Short Term Memory and Other Gated RNNs

Long-Short Term Memory and Other Gated RNNs Long-Short Term Memory and Other Gated RNNs Sargur Srihari srihari@buffalo.edu This is part of lecture slides on Deep Learning: http://www.cedar.buffalo.edu/~srihari/cse676 1 Topics in Sequence Modeling

More information

Neural Turing Machine. Author: Alex Graves, Greg Wayne, Ivo Danihelka Presented By: Tinghui Wang (Steve)

Neural Turing Machine. Author: Alex Graves, Greg Wayne, Ivo Danihelka Presented By: Tinghui Wang (Steve) Neural Turing Machine Author: Alex Graves, Greg Wayne, Ivo Danihelka Presented By: Tinghui Wang (Steve) Introduction Neural Turning Machine: Couple a Neural Network with external memory resources The combined

More information

ECE521 Lecture 7/8. Logistic Regression

ECE521 Lecture 7/8. Logistic Regression ECE521 Lecture 7/8 Logistic Regression Outline Logistic regression (Continue) A single neuron Learning neural networks Multi-class classification 2 Logistic regression The output of a logistic regression

More information

11/3/15. Deep Learning for NLP. Deep Learning and its Architectures. What is Deep Learning? Advantages of Deep Learning (Part 1)

11/3/15. Deep Learning for NLP. Deep Learning and its Architectures. What is Deep Learning? Advantages of Deep Learning (Part 1) 11/3/15 Machine Learning and NLP Deep Learning for NLP Usually machine learning works well because of human-designed representations and input features CS224N WordNet SRL Parser Machine learning becomes

More information

Deep Learning for NLP Part 2

Deep Learning for NLP Part 2 Deep Learning for NLP Part 2 CS224N Christopher Manning (Many slides borrowed from ACL 2012/NAACL 2013 Tutorials by me, Richard Socher and Yoshua Bengio) 2 Part 1.3: The Basics Word Representations The

More information

Deep Feedforward Networks. Seung-Hoon Na Chonbuk National University

Deep Feedforward Networks. Seung-Hoon Na Chonbuk National University Deep Feedforward Networks Seung-Hoon Na Chonbuk National University Neural Network: Types Feedforward neural networks (FNN) = Deep feedforward networks = multilayer perceptrons (MLP) No feedback connections

More information

Deep Learning. Recurrent Neural Network (RNNs) Ali Ghodsi. October 23, Slides are partially based on Book in preparation, Deep Learning

Deep Learning. Recurrent Neural Network (RNNs) Ali Ghodsi. October 23, Slides are partially based on Book in preparation, Deep Learning Recurrent Neural Network (RNNs) University of Waterloo October 23, 2015 Slides are partially based on Book in preparation, by Bengio, Goodfellow, and Aaron Courville, 2015 Sequential data Recurrent neural

More information

Long Short- Term Memory (LSTM) M1 Yuichiro Sawai Computa;onal Linguis;cs Lab. January 15, Deep Lunch

Long Short- Term Memory (LSTM) M1 Yuichiro Sawai Computa;onal Linguis;cs Lab. January 15, Deep Lunch Long Short- Term Memory (LSTM) M1 Yuichiro Sawai Computa;onal Linguis;cs Lab. January 15, 2015 @ Deep Lunch 1 Why LSTM? OJen used in many recent RNN- based systems Machine transla;on Program execu;on Can

More information

Deep Learning Basics Lecture 8: Autoencoder & DBM. Princeton University COS 495 Instructor: Yingyu Liang

Deep Learning Basics Lecture 8: Autoencoder & DBM. Princeton University COS 495 Instructor: Yingyu Liang Deep Learning Basics Lecture 8: Autoencoder & DBM Princeton University COS 495 Instructor: Yingyu Liang Autoencoder Autoencoder Neural networks trained to attempt to copy its input to its output Contain

More information

DEEP LEARNING AND NEURAL NETWORKS: BACKGROUND AND HISTORY

DEEP LEARNING AND NEURAL NETWORKS: BACKGROUND AND HISTORY DEEP LEARNING AND NEURAL NETWORKS: BACKGROUND AND HISTORY 1 On-line Resources http://neuralnetworksanddeeplearning.com/index.html Online book by Michael Nielsen http://matlabtricks.com/post-5/3x3-convolution-kernelswith-online-demo

More information

Need for Deep Networks Perceptron. Can only model linear functions. Kernel Machines. Non-linearity provided by kernels

Need for Deep Networks Perceptron. Can only model linear functions. Kernel Machines. Non-linearity provided by kernels Need for Deep Networks Perceptron Can only model linear functions Kernel Machines Non-linearity provided by kernels Need to design appropriate kernels (possibly selecting from a set, i.e. kernel learning)

More information

Lecture 15: Exploding and Vanishing Gradients

Lecture 15: Exploding and Vanishing Gradients Lecture 15: Exploding and Vanishing Gradients Roger Grosse 1 Introduction Last lecture, we introduced RNNs and saw how to derive the gradients using backprop through time. In principle, this lets us train

More information

Better Conditional Language Modeling. Chris Dyer

Better Conditional Language Modeling. Chris Dyer Better Conditional Language Modeling Chris Dyer Conditional LMs A conditional language model assigns probabilities to sequences of words, w =(w 1,w 2,...,w`), given some conditioning context, x. As with

More information

Logistic Regression & Neural Networks

Logistic Regression & Neural Networks Logistic Regression & Neural Networks CMSC 723 / LING 723 / INST 725 Marine Carpuat Slides credit: Graham Neubig, Jacob Eisenstein Logistic Regression Perceptron & Probabilities What if we want a probability

More information

Stephen Scott.

Stephen Scott. 1 / 35 (Adapted from Vinod Variyam and Ian Goodfellow) sscott@cse.unl.edu 2 / 35 All our architectures so far work on fixed-sized inputs neural networks work on sequences of inputs E.g., text, biological

More information

Deep Learning. Ali Ghodsi. University of Waterloo

Deep Learning. Ali Ghodsi. University of Waterloo University of Waterloo Language Models A language model computes a probability for a sequence of words: P(w 1,..., w T ) Useful for machine translation Word ordering: p (the cat is small) > p (small the

More information

Language Modeling. Hung-yi Lee 李宏毅

Language Modeling. Hung-yi Lee 李宏毅 Language Modeling Hung-yi Lee 李宏毅 Language modeling Language model: Estimated the probability of word sequence Word sequence: w 1, w 2, w 3,., w n P(w 1, w 2, w 3,., w n ) Application: speech recognition

More information

TTIC 31230, Fundamentals of Deep Learning David McAllester, April Sequence to Sequence Models and Attention

TTIC 31230, Fundamentals of Deep Learning David McAllester, April Sequence to Sequence Models and Attention TTIC 31230, Fundamentals of Deep Learning David McAllester, April 2017 Sequence to Sequence Models and Attention Encode-Decode Architectures for Machine Translation [Figure from Luong et al.] In Sutskever

More information

ACCELERATING RECURRENT NEURAL NETWORK TRAINING VIA TWO STAGE CLASSES AND PARALLELIZATION

ACCELERATING RECURRENT NEURAL NETWORK TRAINING VIA TWO STAGE CLASSES AND PARALLELIZATION ACCELERATING RECURRENT NEURAL NETWORK TRAINING VIA TWO STAGE CLASSES AND PARALLELIZATION Zhiheng Huang, Geoffrey Zweig, Michael Levit, Benoit Dumoulin, Barlas Oguz and Shawn Chang Speech at Microsoft,

More information

Deep learning / Ian Goodfellow, Yoshua Bengio and Aaron Courville. - Cambridge, MA ; London, Spis treści

Deep learning / Ian Goodfellow, Yoshua Bengio and Aaron Courville. - Cambridge, MA ; London, Spis treści Deep learning / Ian Goodfellow, Yoshua Bengio and Aaron Courville. - Cambridge, MA ; London, 2017 Spis treści Website Acknowledgments Notation xiii xv xix 1 Introduction 1 1.1 Who Should Read This Book?

More information

Recurrent neural networks

Recurrent neural networks 12-1: Recurrent neural networks Prof. J.C. Kao, UCLA Recurrent neural networks Motivation Network unrollwing Backpropagation through time Vanishing and exploding gradients LSTMs GRUs 12-2: Recurrent neural

More information

Lecture 13: Discriminative Sequence Models (MEMM and Struct. Perceptron)

Lecture 13: Discriminative Sequence Models (MEMM and Struct. Perceptron) Lecture 13: Discriminative Sequence Models (MEMM and Struct. Perceptron) Intro to NLP, CS585, Fall 2014 http://people.cs.umass.edu/~brenocon/inlp2014/ Brendan O Connor (http://brenocon.com) 1 Models for

More information