Compositional Distributional Models of Meaning
Dimitri Kartsaklis

Mehrnoosh Sadrzadeh

School of Electronic Engineeringand Computer Science

COLING 2016
11th December 2016
Osaka, Japan

D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

1/63

In a nutshell

Compositional distributional models of meaning (CDMs)
extend distributional semantics to the phrase/sentence level.
They provide a function that produces a vectorial
representation of the meaning of a phrase or a sentence fromthe distributional vectors of its words.
Useful in every NLP task: sentence similarity, paraphrase
detection, sentiment analysis, machine translation etc.
In this tutorial:
We review three generic classes of CDMs: vector mixtures,
tensor-based models and neural models.

D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

2/63

Outline

1

Introduction2

Vector Mixture Models

3

Tensor-based Models

4

Neural Models

5

Afterword

D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

3/63

Computers and meaning

How can we define Computational Linguistics?
Computational linguistics is the scientific and engineering
discipline concerned with understanding written andspoken language from a computational perspective.
—Stanford Encyclopedia of Philosophy1

1

http://plato.stanford.edu
D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

4/63

Compositional semantics
The principle of compositionality
The meaning of a complex expression is determined by themeanings of its parts and the rules used for combining them.
Montague Grammar: A systematic way of processing
fragments of the English language in order to get semantic
representations capturing their meaning.
There is in my opinion no important theoreticaldifference between natural languages and theartificial languages of logicians.
—Richard Montague, Universal Grammar (1970)

D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

5/63

Syntax-to-semantics correspondence (1/2)
A lexicon:
a. every ` Dt : λP.λQ.∀x[P(x) → Q(x)](1)

b. man ` N : λy .man(y )c. walks ` VI : λz.walk(z)A parse tree, so syntax guides the semantic composition:
S
NP

V IN

Dt

N

Every

man

walks

D. Kartsaklis, M. Sadrzadeh

NP → Dt N : [[N]]([[Dt]])
S → NP VIN : [[VIN ]]([[NP]])

Compositional Distributional Models of Meaning

6/63

Syntax-to-semantics correspondence (2/2)
Logical forms of compounds are computed via β-reduction:S∀x[man(x) → walk(x)]NPλQ.∀x[man(x) → Q(x)]V IN
λz.walk(z)
walks

Dt
λP.λQ.∀x[P(x) → Q(x)]Nλy .man(y )

Every

man

The semantic value of a sentence can be true or false.
Can we do better than that?
D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

7/63

The meaning of words
Distributional hypothesis
Words that occur in similar contexts have similar meanings[Harris, 1958].
The functional interplay of philosophy and...and among works of dystopian
The rapid advance in...calculus, which are more popular in
But because...the value of opinions formed in...if...is an art, not an exact...factors shaping the future of our civilization:...certainty which every new discovery in...if the new technology of computer
He got a...frightened by the powers of destruction...but there is also specialization in

D. Kartsaklis, M. Sadrzadeh

?
?
?
?
?
?
?
?
?
?
?
?
?
?

should, as a minimum, guarantee...
fiction...
today suggests...
-oriented schools.
is based on mathematics...
as well as in the religions...
can discover the laws of human nature....
.
and religion.
either replaces or reshapes.
is to grow significantly
scholarship to Yale.
has given...
and technology...

Compositional Distributional Models of Meaning

8/63

The meaning of words
Distributional hypothesis
Words that occur in similar contexts have similar meanings[Harris, 1958].
The functional interplay of philosophy and science should, as a minimum, guarantee...
...and among works of dystopian science fiction...
The rapid advance in science today suggests...
...calculus, which are more popular in science -oriented schools.
But because science is based on mathematics...
...the value of opinions formed in science as well as in the religions...
...if science can discover the laws of human nature....
...is an art, not an exact science .
...factors shaping the future of our civilization: science and religion.
...certainty which every new discovery in science either replaces or reshapes.
...if the new technology of computer science is to grow significantly
He got a science scholarship to Yale.
...frightened by the powers of destruction science has given...
...but there is also specialization in science and technology...

D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

8/63

Distributional models of meaning

A word is a vector of co-occurrence statistics with every otherword in a selected subset of the vocabulary:
cat
pet
milk

12

cute

8

cat
dog

dog

5

bank

0

money

1

account

money

Semantic relatedness is usually based on cosine similarity:
→
→
h−
v ·−
ui
→
→
−
−
sim(−
v ,−
u ) = cos θ→
v ,→
u = −
→
→
k v kk−uk

D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

9/63

A real vector space
20
pigeoncat
kitten10

parrot

horse
dog
lion
pet
eagle
elephanttiger

footballchampionshipgameplayer

league
team
score
money

raven

bank businessseagullmouse

0

accountstock
brokerram

10

keyboard monitor

intel

marketcreditprofitcurrency

financetechnology

data

processor
20

motherboard
megabyte
laptopcpu
microchip30
D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

10/63

The necessity for a unified model

Distributional models of meaning are quantitative, but they
do not scale up to phrases and sentences; there is not enoughdata:

Even if we had an infinitely large corpus,
what the context of a sentence would be?

D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

11/63

The role of compositionality
Compositional distributional models
We can produce a sentence vector by composing the vectorsof the words in that sentence.
→
−
→, −
→
−
→
s = f (−w
1 w2 , . . . , wn )Three generic classes of CDMs:
Vector mixture models [Mitchell and Lapata (2010)]
Tensor-based models [Coecke, Sadrzadeh, Clark (2010); Baroni and
Zamparelli (2010)]

Neural models [Socher et al. (2012); Kalchbrenner et al. (2014)]

D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

12/63

A CDMs hierarchy

D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

13/63

Applications (1/2)
Why CDMs are important?
The problem of producing robust representations for themeaning of phrases and sentences is at the heart of every
task related to natural language.
Paraphrase detection
Problem: Given two sentences, decide if they say the samething in different words
Solution: Measure the cosine similarity between the sentence
vectors
Sentiment analysis
Problem: Extract the general sentiment from a sentence or adocument
Solution: Train a classifier using sentence vectors as input
D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

14/63

Applications (2/2)

Textual entailment
Problem: Decide if one sentence logically infers a different one
Solution: Examine the feature inclusion properties of thesentence vectors
Machine translation
Problem: Automatically translate one sentence into a different
language
Solution: Encode the source sentence into a vector, then use
this vector to decode a surface form into the target language
And so on. Many other potential applications exist...

D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

15/63

Outline

1

Introduction2

Vector Mixture Models

3

Tensor-based Models

4

Neural Models

5

Afterword

D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

16/63

Element-wise vector composition
The easiest way to compose two vectors is by working
element-wise [Mitchell and Lapata (2010)]:−→ = α−→ + β−
→=
w−1−
w
w
w
2
1
2

X

−
(αciw1 + βciw2 )→
ni

i

−
→=−
→
w−1−
w
w
2
1

−
→=
w
2

X w w
−
ci 1 ci 2 →niiAn element-wise “mixture”
of theinput elements: Tensor-based
Vectormixture=D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

=

17/63

Properties of vector mixture models

Words, phrases and sentences share the same vector space
A bag-of-word approach. Word order does not play a role:−−→ −−→ −−→ −−→ −−→ −−→
dog + bites + man = man + bites + dog
Feature-wise, vector addition can be seen as feature union,and vector multiplication as feature intersection

D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

18/63

Vector mixtures: Intuition
The distributional vector of a word shows the extent to which
this word is related to other words of the vocabulary
For a verb, the components of its vector are related to theaction described by the verb
I.e. the vector for the word ‘run’ shows the extent to which a‘dog’ can run, a ‘car’ can run, a ‘table’ can run and so on−−→→ shows theSo, the element-wise composition of dog with −runextent to which things that are related to dogs can also run(and vice versa); in other words:
The resulting vector shows how compatible is the verb
with the specific subject.

D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

19/63

Vector mixtures: Pros and Cons
Distinguishing feature:
All words contribute equally to the final result.

PROS:
Trivial to implement
Surprisingly effective in practice
CONS:
A bag-of-word approach
Does not distinguish between the type-logical identities of thewords

D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

20/63

Outline

1

Introduction2

Vector Mixture Models

3

Tensor-based Models

4

Neural Models

5

Afterword

D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

21/63

Relational words as functions
In a vector mixture model, an adjective is of the same order as
the noun it modifies, and both contribute equally to the result.
One step further: Relational words are multi-linear maps
(tensors of various orders) that can be applied to one or morearguments (vectors).
Vector mixture=

Tensor-based=

Formalized in the context of compact closed categories by
Coecke, Sadrzadeh and Clark (2010).
D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

22/63

Quantizing the grammar
Coecke, Sadrzadeh and Clark (2010):
Pregroup grammars are structurally homomorphic with thecategory of finite-dimensional vector spaces and linear maps
(both share compact closure)
In abstract terms, there exists a structure-preserving passage
from grammar to meaning:
F : Grammar → Meaning
The meaning of a sentence w1 w2 . . . wn with grammaticalderivation α is defined as:−−−−−−→
−
→ −
→
−
→
w−
1 w2 . . . wn := F(α)(w1 ⊗ w2 ⊗ . . . ⊗ wn )D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

23/63

Pregroup grammars
A pregroup grammar P(Σ, B) is a relation that assigns grammatical types from a pregroup algebra freely generated overa set of atomic types B to words of a vocabulary Σ.
A pregroup algebra is a partially ordered monoid, where eachelement p has a left and a right adjoint such that:p · pr ≤ 1 ≤ pr · p

pl · p ≤ 1 ≤ p · plElements of the pregroup are basic (atomic) grammatical
types, e.g. B = {n, s}.
Atomic grammatical types can be combined to form types ofhigher order (e.g. n · nl or nr · s · nl )A sentence w1 w2 . . . wn (with word wi to be of type ti ) is
grammatical whenever:t1 · t2 · . . . · tn ≤ s
D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

24/63

Pregroup derivation: example
p · pr ≤ 1 ≤ pr · p

pl · p ≤ 1 ≤ p · pl

S

NP

VP

tremblingshadowsplay

hide-and-seek

n nl

n

nr s nl

n

Adj

N

V

N

tremblingshadowsplay

hide-and-seekn · nl · n · nr · s · nl · n ≤ n · 1 · nr · s · 1= n · nr · s
≤ 1·s
= s
D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

25/63

Compact closed categories

A monoidal category (C, ⊗, I ) is compact closed when every
object has a left and a right adjoint, for which the following
morphisms exist:
r

ηr

A ⊗ Ar −→ I −→ Ar ⊗ Alηl

Al ⊗ A −→I −→ A ⊗ Al

Pregroup grammars are CCCs, with  and η maps
corresponding to the partial orders
FdVect, the category of finite-dimensional vector spaces andlinear maps, is a also a (symmetric) CCC:
 maps correspond to inner productη maps to identity maps and multiples of those

D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

26/63

A functor from syntax to semantics
We define a strongly monoidal functor F such that:
F : P(Σ, B) → FdVect

F(p) = P∀p ∈ B

F(1) = RF(p · q) = F(p) ⊗ F(q)r

F(p ) = F(p l ) = F(p)F(p ≤ q) = F(p) → F(q)r

F( ) = F(l ) = inner product in FdVect
F(η r ) = F(η l ) = identity maps in FdVect

D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

27/63

A multi-linear model
The grammatical type of a word defines the vector spacein which the word lives:
Nouns are vectors in N;
adjectives are linear maps N → N, i.e elements in
N ⊗ N;
intransitive verbs are linear maps N → S, i.e. elements
in N ⊗ S;
transitive verbs are bi-linear maps N ⊗ N → S, i.e.
elements of N ⊗ S ⊗ N;
The composition operation is tensor contraction, i.e.
elimination of matching dimensions by application of innerproduct.
D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

28/63

Categorical composition: example
S

NP

VP

trembling shadows
n nl
n

Adj

N

V

N

tremblingshadowsplay

hide-and-seekplay hide-and-seek
nr s nlnType reduction morphism:(rn · 1s ) ◦ (1n · ln · 1nr ·s · ln ) : n · nl · n · nr · s · nl · n → shi−−−−−→−−−−−−−−−→
F (rn · 1s ) ◦ (1n · ln · 1nr ·s · ln ) trembling ⊗ shadows ⊗ play ⊗ hide-and-seek =−−−−−→−−−−−−−−−→(N ⊗ 1S ) ◦ (1N ⊗ N ⊗ 1N⊗S ⊗ N ) trembling ⊗ shadows ⊗ play ⊗ hide-and-seek =−−−−−→−−−−−−−−−→
trembling × shadows × play × hide-and-seek−−−−−→ −−−−−−−−−→
shadows, hide-and-seek ∈ N

trembling ∈ N ⊗ N

D. Kartsaklis, M. Sadrzadeh

play ∈ N ⊗ S ⊗ N

Compositional Distributional Models of Meaning

29/63

Creating relational tensors: Extensional approach
A relational word is defined as the set of its arguments:[[red]] = {car , door , dress, ink, · · · }Grefenstette and Sadrzadeh (2011):
adj =

X

−
−→
noun
i

verb int =

i

X −−→
subj iverb tr =i

X −−→ −→
subj i ⊗ obj iiKartsaklis and Sadrzadeh (2016):
adj =

X

−
−−→ ⊗ −
−−→
noun
noun
i
i

i

verb int =X −−→ −−→
subji ⊗ subjii

X −−→
verb tr =subj i ⊗iD. Kartsaklis, M. Sadrzadeh

−−→
−→ !
−→
subj i + obj i⊗ obj i2Compositional Distributional Models of Meaning

30/63

Creating relational tensors: Statistical approach
Baroni and Zamparelli (2010):
Create holistic distributional vectors for whole compounds (asif they were words) and use them to train a linear regression
model.
red
× car = red car× door = red door
× dress = red dress× ink = red ink

ˆ = arg min
adj
adj

"

−−−−−→
1 X−−→ − −
(adj × −noun
adj nouni )2
i
2m

#

i

D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

31/63

Functional words

Certain classes of words, such as determiners, relative
pronouns, prepositions, or coordinators occur in almost every
possible context.
Thus, they are considered semantically vacuous from a
distributional perspective and most often they are simply
ignored.
In the tensor-based setting, these special words can be modelled by exploiting additional mathematical structures, suchas Frobenius algebras and bialgebras.

D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

32/63

Frobenius algebras in FdVect
Given a symmetric CCC (C, ⊗, I ), an object X ∈ C has a
Frobenius structure on it if there exist morphisms:∆:X →X ⊗X , ι:X →Iandµ:X ⊗X →X , ζ :I →X

conforming to the Frobenius condition:(µ ⊗ 1X ) ◦ (1X ⊗ ∆) = ∆ ◦ µ = (1X ⊗ µ) ◦ (∆ ⊗ 1X )−In FdVect, any vector space V with a fixed basis {→vi }i has acommutative special Frobenius algebra over it [Coecke andPavlovic, 2006]:
−
−
−
∆:→
vi 7→ →
vi ⊗ →
vi

−
−
−
µ:→
vi ⊗ →
vi 7→ →
vi

It can be seen as copying and merging of the basis.

D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

33/63

Frobenius algebras: Relative pronouns
How to represent relative pronouns in a tensor-based setting?
A relative clause modifies the head noun of a phrase:
who
the manN

Nr N Sl N

likes

Mary

Nr S NlN

the man

=

N

likes

Nr

Nl

Mary

N

The result is a merging of the vectors of the noun and therelative clause:
−
−→
man

−−−→
(likes × Mary )[Sadrzadeh, Clark, Coecke (2013)]

D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

34/63

Frobenius algebras: Coordination
Copying and merging are the key processes in coordination:
sleeps and snores
John

and
John

sleepssnoresN

N

NrS

S r N rr

Nr

S

Sl N

Nr

Nr

S

Nr

Nr

S

S

7→

S

The subject is copied by a ∆-map and interacts individuallywith the two verbs
The results are merged together with a µ-map−−→TJohn × (sleep

snore)[Kartsaklis (2016)]
D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

35/63

Tensor-based models: Intuition
Tensor-based composition goes beyond a simple compatibility
check between the two argument vectors; it transforms the
input into an output of possibly different type.
A verb, for example, is a function that takes as input a noun
and transforms it into a sentence:
fint : N → S

ftr : N × N → S

Size and form of the sentence space become tunable
parameters of the models, and can depend on the task.
Taking S = {( 01 ) , ( 10 )}, for example, provides an equivalent
to formal semantics.

D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

36/63

Tensor-based models: Pros and Cons
Distinguishing feature:
Relational words are multi-linear maps acting on arguments
PROS:
Aligned with the formal semantics perspective
More powerful than vector mixtures
Flexible regarding the representation of functional words, suchas relative pronouns and prepositions.
CONS:
Every logical and functional word must be assigned to an
appropriate tensor representation–it’s not always clear how
Space complexity problems for functions of higher arity (e.g. a
ditransitive verb is a tensor of order 4)
D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

37/63

Outline

1

Introduction2

Vector Mixture Models

3

Tensor-based Models

4

Neural Models

5

Afterword

D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

38/63

An artificial neuron

The xi s form the input vector
The wji s is a set of weights associated with the i-th output of
the layer
f is a non-linear function such as tanh or sigmoid
ai is the i-th output of the layer, computed as:ai = f (w1i x1 + w2i x2 + w3i x3 )D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

39/63

A simple neural net
A feed-forward neural network with one hidden layer:
h1 = f (w11 x1 +w21 x2 +w31 x3 +w41 x4 +w51 x5 +b1 )h2 = f (w12 x1 +w22 x2 +w32 x3 +w42 x4 +w52 x5 +b2 )h3 = f (w13 x1 +w23 x2 +w33 x3 +w43 x4 +w53 x5 +b3 )
−
→
−
→
→
or h = f (W(1) −x + b (1) )Similarly:
−
→ −
→
−
→
y = f (W(2) h + b (2) )Note that W(1) ∈ R3×5 and W(2) ∈ R2×3
f is a non-linear function such as tanh or sigmoid(take f = Id and you have a tensor-based model)
A universal approximator
D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

40/63

Objective functions
The goal of NN training is to find the set of parameters that
optimizes a given objective function
Or, to put it differently, to minimize an error function.
Assume, for example, the goal of the NN is to produce a→−−
vector →y that matches a specific target vector t . The
function:
E=

1 X →
− − 2
|| ti − →
yi ||
2m
i

gives the total error across all training instances.
We want to set the weights of the NN such that E becomeszero or as close to zero as possible.

D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

41/63

Gradient descent
Take steps proportional to the negative of the gradient of E
at the current point.

Θt = Θt−1 − α∇E (Θt−1 )Θt : the parameters ofthe model at time
step tα: a learning rate
(Graph taken from “The Beginner Programmer” blog,
http://firsttimeprogrammer.blogspot.co.uk)

D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

42/63

Backpropagation of errors
How do we compute the error terms at the inner layers?
These are computed based one the errors of the next layer byusing backpropagation. In general:δk = ΘTk δk+1f 0 (zk )δk is the error vector at layer kΘk is the weight matrix of layer k
zk is the weighted sum at the output of layer k
f 0 is the derivative of the non-linear function f

Just an application of the chain rule for derivatives.
D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

43/63

Recurrent and recursive NNs
Standard NNs assume that inputs are independent of eachotherThat is not the case in language; a word, for example, always
depends on the previous words in the same sentence
In a recurrent NN, connections form a directed cycle so thateach output depends on the previous ones
A recursive NN is applied recursively following a specificstructure.
outputoutput

input

input

Recurrent NN

D. Kartsaklis, M. Sadrzadeh

Recursive NN
Compositional Distributional Models of Meaning

44/63

Recursive neural networks for composition

Pollack (1990); Socher et al. (2011;2012):

D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

45/63

Unsupervised learning with NNs
How can we train a NN in an unsupervised manner?
Train the network to reproduce its input via an expansion
layer:

Use the output of the hidden layer as a compressed version of
the input [Socher et al. (2011)]
D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

46/63

Long Short-Term Memory networks (1/2)
RNNs are effective, but fail to capture long-range
dependencies such as:
The movie I liked and John said Mary and Ann
really hated“Vanishing gradient” problem: Back-propagating the error
requires the multiplication of many very small numbers
together, and training for the bottom layers starts to stall.
Long Short-Term Memory networks (LSTMs) (Hochreiter andSchmidhuber, 1997) provide a solution, by equipping eachneuron with an internal state.

D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

47/63

Long Short-Term Memory networks (2/2)

RNN

LSTM

(Diagrams taken from Christopher Olah’s blog, http://colah.github.io/)
D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

48/63

Linguistically aware NNs
NN-based methods come mainly from image processing. How
can we make them more linguistically aware?
Cheng and Kartsaklis (2015):

plausibility layer
sentence vector

Take into accountsyntax, by optimizing
against a scrambled
version of each sentencecompositional layer

Dynamicallydisambiguate themeaning of words during
training based on theircontext

D. Kartsaklis, M. Sadrzadeh

plausibility layerphrase vector
compositional
layer
gate

sense vectors

main(ambiguous)
vectors

Compositional Distributional Models of Meaning

49/63

Convolutional NNs
Originated in pattern recognition [Fukushima, 1980]
Small filters apply on every position of the input vector:

Capable of extracting fine-grained local features independentlyof the exact position in input
Features become increasingly global as more layers are stacked
Each convolutional layer is usually followed by a pooling layer
Top layer is fully connected, usually a soft-max classifier
Application to language: Collobert and Weston (2008)
D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

50/63

DCNNs for modelling sentences
Kalchbrenner, Grefenstetteand Blunsom (2014): A deeparchitecture using dynamic
k-max pooling
Syntactic structure is
induced automatically:(Figures reused with permission)
D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

51/63

Beyond sentence level
An additional convolutional layer can provide document vectors[Denil et al. (2014)]:(Figure reused with permission)
D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

52/63

Neural models: Intuition (1/2)

Recall that tensor-based composition involves a linear
transformation of the input into some output.
Neural models make this process more effective by applying
consecutive non-linear layers of transformation.

A NN does not only project a noun vector onto a sentence
space, but it can also transform the geometry of the space
itself in order to make it reflect better the relationships between the points (sentences) in it.

D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

53/63

Neural models: Intuition (2/2)
Example: Although there is no linear map to send an inputx ∈ {0, 1} to the correct XOR value, the function can beapproximated by a simple NN with one hidden layer.

Points in (b) can be seen as representing two semanticallydistinct groups of sentences, which the NN is able todistinguish (while a linear map cannot)

D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

54/63

Neural models: Pros and Cons
Distinguishing feature:
Drastic transformation of the sentence space.
PROS:
Non-linearity and layered approach allow the simulation of avery wide range of functions
Word vectors are parameters of the model, optimized during
training
State-of-the-art results in a number of NLP tasks
CONS:
Requires expensive training based on backpropagation
Difficult to discover the right configuration
A “black-box” approach: not easy to correlate inner workings
with output
D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

55/63

Outline

1

Introduction2

Vector Mixture Models

3

Tensor-based Models

4

Neural Models

5

Afterword

D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

56/63

Refresher: A CDMs hierarchy

D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

57/63

Open issues-Future work

No convincing solution for logical connectives, negation,
quantifiers and so on.
Functional words, such as prepositions and relative pronouns,
are also a problem.
Sentence space is usually identified with word space. This isconvenient, but is it the right thing to do?
Solutions depend on the specific CDM class—e.g. not muchto do in a vector mixture setting
Important: How can we make NNs more linguistically aware?
[Cheng and Kartsaklis (2015)]

D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

58/63

Summary

CDMs provide quantitative semantic representations forsentences (or even documents)
Element-wise operations on word vectors constitute an easy
and reasonably effective way to get sentence vectors
Categorical compositional distributional models allow
reasoning on a theoretical level—a glass box approach
Neural models are extremely powerful and effective; still a
black-box approach, not easy to explain why a specificconfiguration works and some other does not.
Convolutional networks seem to constitute the most promisingsolution to the problem of capturing the meaning of sentences

D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

59/63

Thank you for your attention!

D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

60/63

References I
Baroni, M. and Zamparelli, R. (2010).
Nouns are Vectors, Adjectives are Matrices.
In Proceedings of Conference on Empirical Methods in Natural Language Processing (EMNLP).
Cheng, J. and Kartsaklis, D. (2015).
Syntax-aware multi-sense word embeddings for deep compositional models of meaning.
In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pages
1531–1542, Lisbon, Portugal. Association for Computational Linguistics.
Coecke, B., Sadrzadeh, M., and Clark, S. (2010).
Mathematical Foundations for a Compositional Distributional Model of Meaning. Lambek Festschrift.
Linguistic Analysis, 36:345–384.
Collobert, R. and Weston, J. (2008).
A unified architecture for natural language processing: Deep neural networks with multitask learning.
In Proceedings of the 25th international conference on Machine learning, pages 160–167. ACM.
Denil, M., Demiraj, A., Kalchbrenner, N., Blunsom, P., and de Freitas, N. (2014).
Modelling, visualising and summarising documents with a single convolutional neural network.
Technical Report arXiv:1406.3830, University of Oxford.
Grefenstette, E. and Sadrzadeh, M. (2011).
Experimental support for a categorical compositional distributional model of meaning.
In Proceedings of the 2011 Conference on Empirical Methods in Natural Language Processing, pages
1394–1404, Edinburgh, Scotland, UK. Association for Computational Linguistics.
Harris, Z. (1968).
Mathematical Structures of Language.
Wiley.

D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

61/63

References II
Kalchbrenner, N., Grefenstette, E., and Blunsom, P. (2014).
A convolutional neural network for modelling sentences.
In Proceedings of the 52nd Annual Meeting of the Association for Computational Linguistics (Volume 1:
Long Papers), pages 655–665, Baltimore, Maryland. Association for Computational Linguistics.
Kartsaklis, D. (2015).
Compositional Distributional Semantics with Compact Closed Categories and Frobenius Algebras.
PhD thesis, University of Oxford.
Kartsaklis, D. and Sadrzadeh, M. (2016).
A compositional distributional inclusion hypothesis.
In Proceedings of the 2017 Conference on Logical Aspects of Computational Linguistics, Nancy, France.
Springer.
Mitchell, J. and Lapata, M. (2010).
Composition in distributional models of semantics.
Cognitive Science, 34(8):1388–1439.
Montague, R. (1970a).
English as a formal language.
In Linguaggi nella Società e nella Tecnica, pages 189–224. Edizioni di Comunità, Milan.
Montague, R. (1970b).
Universal grammar.
Theoria, 36:373–398.
Sadrzadeh, M., Clark, S., and Coecke, B. (2013).
The Frobenius anatomy of word meanings I: subject and object relative pronouns.
Journal of Logic and Computation, Advance Access.

D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

62/63

References III

Sadrzadeh, M., Clark, S., and Coecke, B. (2014).
The Frobenius anatomy of word meanings II: Possessive relative pronouns.
Journal of Logic and Computation.
Socher, R., Huang, E., Pennington, J., Ng, A., and Manning, C. (2011).
Dynamic Pooling and Unfolding Recursive Autoencoders for Paraphrase Detection.
Advances in Neural Information Processing Systems, 24.
Socher, R., Huval, B., Manning, C., and A., N. (2012).
Semantic compositionality through recursive matrix-vector spaces.
In Conference on Empirical Methods in Natural Language Processing 2012.
Socher, R., Manning, C., and Ng, A. (2010).
Learning Continuous Phrase Representations and Syntactic Parsing with recursive neural networks.
In Proceedings of the NIPS-2010 Deep Learning and Unsupervised Feature Learning Workshop.

D. Kartsaklis, M. Sadrzadeh

Compositional Distributional Models of Meaning

63/63