Question Answering with Subgraph Embeddings

This paper presents a system which learns to answer questions on a broad range of topics from a knowledge base using few hand-crafted features. Our model learns low-dimensional embeddings of words and knowledge base constituents; these representations are used to score natural language questions against candidate answers. Training our system using pairs of questions and structured representations of their answers, and pairs of question paraphrases, yields competitive results on a competitive benchmark of the literature.


Introduction
Teaching machines how to automatically answer questions asked in natural language on any topic or in any domain has always been a long standing goal in Artificial Intelligence.With the rise of large scale structured knowledge bases (KBs), this problem, known as open-domain question answering (or open QA), boils down to being able to query efficiently such databases with natural language.These KBs, such as Freebase [3] encompass huge ever growing amounts of information and ease open QA by organizing a great variety of answers in a structured format.However, the scale and the difficulty for machines to interpret natural language still makes this task a challenging problem.
The state-of-the-art techniques in open QA can be classified into two main classes, namely, information retrieval based and semantic parsing based.Information retrieval systems first retrieve a broad set of candidate answers by querying the search API of KBs with a transformation of the question into a valid query and then use fine-grained detection heuristics to identify the exact answer [8,12,14].On the other hand, semantic parsing methods focus on the correct interpretation of the meaning of a question by a semantic parsing system.A correct interpretation converts a question into the exact database query that returns the correct answer.Interestingly, recent works [1,9,2,7] have shown that such systems can be efficiently trained under indirect and imperfect supervision and hence scale to large-scale regimes, while bypassing most of the annotation costs.
Yet, even if both kinds of system have shown the ability to handle largescale KBs, they still require experts to hand-craft lexicons, grammars, and KB schema to be effective.This non-negligible human intervention might not be generic enough to conveniently scale up to new databases with other schema, broader vocabularies or languages other than English.In contrast, [6] proposed a framework for open QA requiring almost no human annotation.Despite being an interesting approach, this method is outperformed by other competing methods.[5] introduced an embedding model, which learns low-dimensional vector representations of words and symbols (such as KBs constituents) and can be trained with even less supervision than the system of [6] while being able to achieve better prediction performance.However, this approach is only compared with [6] which operates in a simplified setting and has not been applied in more realistic conditions nor evaluated against the best performing methods.
In this paper, we improve the model of [5] by providing the ability to answer more complicated questions.sThe main contributions of the paper are: (1) a more sophisticated inference procedure that is both efficient and can consider longer paths ( [5] considered only answers directly connected to the question in the graph); and (2) a richer representation of the answers which encodes the question-answer path and surrounding subgraph of the KB.Our approach is competitive with the current state-of-the-art on the recent benchmark We-bQuestions [1] without using any lexicon, rules or additional system for partof-speech tagging, syntactic or dependency parsing during training as most other systems do.

Task Definition
Our main motivation is to provide a system for open QA able to be trained as long as it has access to: (1) a training set of questions paired with answers and (2) a KB providing a structure among answers.We suppose that all potential answers are entities in the KB and that questions are sequences of words that include one identified KB entity.When this entity is not given, plain string matching is used to perform entity resolution.Smarter methods could be used but this is not our focus.
We use WebQuestions [1] as our evaluation bemchmark.Since it contains few training samples, it is impossible to learn on it alone, and this section describes the various data sources that were used for training.These are similar to those used in [2].
WebQuestions This dataset is built using Freebase as the KB and contains 5,810 question-answer pairs.It was created by crawling questions through the Google Suggest API, and then obtaining answers using Amazon Mechanical Turk.We used the original split (3,778 examples for training and 2,032 for testing), and isolated 1k questions from the training set for validation.We-bQuestions is built on Freebase since all answers are defined as Freebase entities.In each question, we identified one Freebase entity using string matching between words of the question and entity names in Freebase.When the same string matches multiple entities, only the entity appearing in most triples, i.e. the most popular in Freebase, was kept.Example questions (answers) in the dataset include "Where did Edgar Allan Poe died?" (baltimore) or "What degrees did Barack Obama get?" (bachelor of arts, juris doctor).Freebase Freebase [3] is a huge and freely available database of general facts; data is organized as triplets (subject, type1.type2.predicate,object), where two entities subject and object (identified by mids) are connected by the relation type type1.type2.predicate.We used a subset, created by only keeping triples where one of the entities was appearing in either the WebQuestions training/validation set or in ClueWeb extractions.We also removed all entities appearing less than 5 times and finally obtained a Freebase set containing 14M triples made of 2.2M entities and 7k relation types. 1 Since the format of triples does not correspond to any structure one could find in language, we decided to transform them into automatically generated questions.Hence, all triples were converted into questions "What is the predicate of the type2 subject?" (using the mid of the subject) with the answer being object.An example is "What is the nationality of the person barack obama?" (united states).More examples and details are given in a longer version of this paper [4].

WebQuestions
ClueWeb Extractions Freebase data allows to train our model on 14M questions but these have a fixed lexicon and vocabulary, which is not realistic.Following [1], we also created questions using ClueWeb extractions provided by [10].Using string matching, we ended up with 2M extractions structured as (subject, "text string", object) with both subject and object linked to Freebase.We also converted these triples into questions by using simple patterns and Freebase types.An example of generated question is "Where barack obama was allegedly bear in?" (hawaii).
Paraphrases The automatically generated questions that are useful to connect Freebase triples and natural language, do not provide a satisfactory modeling of natural language because of their semi-automatic wording and rigid syntax.To overcome this issue, we follow [6] and supplement our training data with an indirect supervision signal made of pairs of question paraphrases collected from the WikiAnswers website.On WikiAnswers, users can tag pairs of questions what is the judicial capital of the in state sikkim ?gangtok (sikkim, location.instate.judicialcapital, gangtok) who influenced the influence node yves saint laurent ?helmut newton (yves saint laurent, influence.influencenode.influenced,helmut newton) Freebase who is born in the location brighouse ?edward barber generated questions (brighouse, location.location.peopleborn here, edward barber) and associated triples who is the producer of the recording rhapsody in b minor, op.79, no.  as rephrasings of each other: [6] harvested a set of 2M distinct questions from WikiAnswers, which were grouped into 350k paraphrase clusters.

Embedding Questions and Answers
Inspired by [5], our model works by learning low-dimensional vector embeddings of words appearing in questions and of entities and relation types of Freebase, so that representations of questions and of their corresponding answers are close to each other in the joint embedding space.Let q denote a question and a a candidate answer.Learning embeddings is achieved by learning a scoring function S(q, a), so that S generates a high score if a is the correct answer to the question q, and a low score otherwise.Note that both q and a are represented as a combination of the embeddings of their individual words and/or symbols; hence, learning S essentially involves learning these embeddings.In our model, the form of the scoring function is: Let W be a matrix of R k×N , where k is the dimension of the embedding space which is fixed a-priori, and N is the dictionary of embeddings to be learned.Let N W denote the total number of words and N S the total number of entities and relation types.With N = N W + N S , the i-th column of W is the embedding of the i-th element (word, entity or relation type) in the dictionary.The function f (.), which maps the questions into the embedding space R k is defined as f (q) = Wφ(q), where φ(q) ∈ N N , is a sparse vector indicating the number of times each word appears in the question q (usually 0 or 1).Likewise the function g(.) which maps the answer into the same embedding space R k as the questions, is given by g(a) = Wψ(a).Here ψ(a) ∈ N N is a sparse vector representation of the answer a, which we now detail.

Embedding model
Freebase subgraph

Binary encoding of the subgraph ψ(a)
Embedding of the subgraph g(a) Binary encoding of the ques0on Φ(q) Embedding of the ques0on f(q) Ques0on q Subgraph of a candidate answer a (here K. Preston) Score S(q,a) How the candidate answer fits the ques0on

Dot product
Embedding matrix W Fig. 1.Illustration of the subgraph embedding model scoring a candidate answer: (i) locate entity in the question; (ii) compute path from entity to answer; (iii) represent answer as path plus all connected entities to the answer (the subgraph); (iv) embed both the question and the answer subgraph separately using the learnt embedding vectors, and score the match via their dot product.

Representing Candidate Answers
We now describe possible feature representations for a single candidate answer.
(When there are multiple correct answers, we average these representations, see Section 3.4.)We consider three different types of representation, corresponding to different subgraphs of Freebase around it.
(i) Single Entity.The answer is represented as a single entity from Freebase: ψ(a) is a 1-of-N S coded vector with 1 corresponding to the entity of the answer, and 0 elsewhere.(ii) Path Representation.The answer is represented as a path from the entity mentioned in the question to the answer entity.In our experiments, we considered 1-or 2-hops paths (i.e. with either 1 or 2 edges to traverse): (barack obama, people.person.place of birth, honolulu) is a 1-hop path and (barack obama, people.person.place of birth, location.location.containedby,hawaii) a 2-hops path.This results in a ψ(a) which is a 3-of-N S or 4-of-N S coded vector, expressing the start and end entities of the path and the relation types (but not entities) in-between.(iii) Subgraph Representation.We encode both the path representation from (ii), and the entire subgraph of entities connected to the candidate answer entity.That is, for each entity connected to the answer we include both the relation type and the entity itself in the representation ψ(a).In order to represent the answer path differently to the surrounding subgraph (so the model can differentiate them), we double the dictionary size for entities, and use one embedding representation if they are in the path and another if they are in the subgraph.Thus we now learn a parameter matrix R k×N where N = N W + 2N S (N S is the total number of entities and relation types).If there are C connected entities with D relation types to the candidate answer, its representation is a 3 + C + D or 4 + C + D-of-N S coded vector, depending on the path length.
Our hypothesis is that including more information about the answer in its representation will lead to improved results.While it is possible that all required information could be encoded in the k dimensional embedding of the single entity (i), it is unclear what dimension k should be to make this possible.For example the embedding of a country entity encoding all of its citizens seems unrealistic.Similarly, only having access to the path ignores all the other information we have about the answer entity, unless it is encoded in the embeddings of either the entity of the question, the answer or the relations linking them, which might be quite complicated as well.We thus adopt the subgraph approach.Figure 1 illustrates our model.

Training and Loss Function
As in [13], we train our model using a margin-based ranking loss function.Let D = {(q i , a i ) : i = 1, . . ., |D|} be the training set of questions q i paired with their correct answer a i .The loss function we minimize is where m is the margin (fixed to 0.1).Minimizing Eq. ( 2) learns the embedding matrix W so that the score of a question paired with a correct answer is greater than with any incorrect answer ā by at least m.ā is sampled from a set of incorrect candidates Ā.This is achieved by sampling 50% of the time from the set of entities connected to the entity of the question (i.e.other candidate paths), and by replacing the answer entity by a random one otherwise.Optimization is accomplished using stochastic gradient descent, multi-threaded with Hogwild! [11], with the constraint that the columns w i of W remain within the unit-ball, i.e., ∀ i , ||w i || 2 ≤ 1.

Multitask Training of Embeddings
Since a large number of questions in our training datasets are synthetically generated, they do not adequately cover the range of syntax used in natural language.Hence, we also multi-task the training of our model with the task of paraphrase prediction.We do so by alternating the training of S with that of a scoring function S prp (q 1 , q 2 ) = f (q 1 ) f (q 2 ), which uses the same embedding matrix W and makes the embeddings of a pair of questions (q 1 , q 2 ) similar to each other if they are paraphrases (i.e. if they belong to the same paraphrase cluster), and make them different otherwise.Training S prp is similar to that of S except that negative samples are obtained by sampling a question from another paraphrase cluster.We also multitask the training of the embeddings with the mapping of the mids of Freebase entities to the actual words of their names, so that the model learns that the embedding of the mid of an entity should be similar to the embedding of the word(s) that compose its name(s).

Inference
Once W is trained, at test time, for a given question q the model predicts the answer with: â = argmax a ∈A(q) S(q, a ) where A(q) is the candidate answer set.This candidate set could be the whole KB but this has both speed and potentially precision issues.Instead, we create a candidate set A(q) for each question.We recall that each question contains one identified Freebase entity.A(q) is first populated with all triples from Freebase involving this entity.This allows to answer simple factual questions whose answers are directly connected to them (i.e.1-hop paths).This strategy is denoted C 1 .
Since a system able to answer only such questions would be limited, we supplement A(q) with examples situated in the KB graph at 2-hops from the entity of the question.We do not add all such quadruplets since this would lead to very large candidate sets.Instead, we consider the following general approach: given that we are predicting a path, we can predict its elements in turn using a beam search, and hence avoid scoring all candidates.Specifically, our model first ranks relation types using Eq.(1), i.e. selects which relation types are the most likely to be expressed in q.We keep the top 10 types (10 was selected on the validation set) and only add 2-hops candidates to A(q) when these relations appear in their path.Scores of 1-hop triples are weighted by 1.5 since they have one less element than 2-hops quadruplets.This strategy, denoted C 2 , is used by default.
A prediction a can commonly actually be a set of candidate answers, not just one answer, for example for questions like "Who are David Beckham's children?".This is achieved by considering a prediction to be all the entities that lie on the same 1-hop or 2-hops path from the entity found in the question.Hence, all answers to the above question are connected to david beckham via the same path (david beckham, people.person.children,*).The feature representation of the prediction is then the average over each candidate entity's features (see Section 3.1), i.e. ψ all (a ) = 1 |a | a j :a ψ(a j ) where a j are the individual entities in the overall prediction a .In the results, we compare to a baseline method that can only predict single candidates, which understandly performs poorly.

Experiments
We compare our system in terms of F1 score as computed by the official evaluation script2 (F1 (Berant)) but also with a slightly different F1 definition, termed F1 (Yao) which was used in [14] (the difference being the way that questions with no answers are dealt with), and precision @ 1 (p@1) of the first candidate entity (even when there are a set of correct answers), comparing to recently published systems. 3The upper part of Table 3 indicates that our approach outperforms [14], [1] and [5], and performs similarly as [2].
The lower part of Table 3 compares various versions of our model.Our default approach uses the Subgraph representation for answers and C 2 as the candidate answers set.Replacing C 2 by C 1 induces a large drop in performance because many questions do not have answers thatare directly connected to their inluded entity (not in C 1 ).However, using all 2-hops connections as a candidate set is also detrimental, because the larger number of candidates confuses (and slows a lot) our ranking based inference.Our results also verify our hypothesis of Section 3.1, that a richer representation for answers (using the local subgraph) can store more pertinent information.Finally, we demonstrate that we greatly improve upon the model of [5], which actually corresponds to a setting with the Path representation and C 1 as candidate set.
We also considered an ensemble of our approach and that of [2].As we only had access to their test predictions we used the following combination method.Our approach gives a score S(q, a) for the answer it predicts.We chose a threshold such that our approach predicts 50% of the time (when S(q, a) is above its value), and the other 50% of the time we use the prediction of [2] instead.We aimed for a 50/50 ratio because both methods perform similarly.The ensemble improves the state-of-the-art, and indicates that our models are significantly different in their design.

Conclusion
This paper presented an embedding model that learns to perform open QA using training data made of questions paired with their answers and of a KB to provide a structure among answers, and can achieve promising performance on the competitive benchmark WebQuestions.

Table 1 .
Statistics of data sets used in the paper.
1 ?glenngould (rhapsody in b minor, op.79, no. 1, music.recording.producer,glenn gould) what are the symptoms of the disease sepsis ?skin discoloration (sepsis, medicine.disease.symptoms,skin discoloration) what is cher's son's name ?elijah blue allman (cher, people.person.children,elijah blue allman) what are dollars called in spain ?peseta (spain, location.country.currencyformerly used, peseta) WebQuestions what is henry clay known for ?lawyer training questions (henry clay, people.person.profession,lawyer) and associated paths who is the president of the european union 2011 ?jerzy buzek (european union, government.governmentaljurisdiction.governingofficials government.governmentposition held.officeholder, jerzy buzek) what 6 states border south dakota ?iowa (south dakota, location.location.containslocation.location.partiallycontainedby, iowa) what does acetazolamide be an inhibitor of ?carbonic anhydrase (acetazolamide, medicine.drugingredient.activemoiety of drug, carbonic anhydrase) which place is a district in andhra pradesh ?adilabad (andhra pradesh, location.location.contains,adilabad) ClueWeb what is a regional airline based in dublin ?aer arann generated questions (dublin, location.location.nearbyairports aviation.airport.focuscity for, aer arann) and associated paths what mean fire in sanskrit ?agni (sanskrit, unknown relation, agni) where does american legion proceed to ?san francisco (american legion, 22-rdf-syntax-ns#type type.type.instance,san francisco) what are two reason to get a 404 ?what is error 404 ?you receive a 404 -unable to find error message ?how do you correct error 404 ?WikiAnswers what is the term for a teacher of islamic law ?clusters of what is the islamic religious teacher called ?quest.paraphrases what is the name of the religious book islam use ?who is chief of islamic religious authority ?what country is bueno aire in ?what countrie is buenos aires in ?what country is buenas aire in ?what country is bueno are in ?

Table 2 .
Examples of questions, answer paths and paraphrases used in this paper.

Table 3 .
Results on the WebQuestions test set.