KR102194837B1 - Method and apparatus for answering knowledge-based question - Google Patents
Method and apparatus for answering knowledge-based question Download PDFInfo
- Publication number
- KR102194837B1 KR102194837B1 KR1020200080322A KR20200080322A KR102194837B1 KR 102194837 B1 KR102194837 B1 KR 102194837B1 KR 1020200080322 A KR1020200080322 A KR 1020200080322A KR 20200080322 A KR20200080322 A KR 20200080322A KR 102194837 B1 KR102194837 B1 KR 102194837B1
- Authority
- KR
- South Korea
- Prior art keywords
- entity
- vector
- question sentence
- question
- relation
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/20—Natural language analysis
- G06F40/279—Recognition of textual entities
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/33—Querying
- G06F16/332—Query formulation
- G06F16/3329—Natural language query formulation or dialogue systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/33—Querying
- G06F16/3331—Query processing
- G06F16/334—Query execution
- G06F16/3347—Query execution using vector based model
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Mathematical Physics (AREA)
- Artificial Intelligence (AREA)
- Human Computer Interaction (AREA)
- Health & Medical Sciences (AREA)
- Audiology, Speech & Language Pathology (AREA)
- General Health & Medical Sciences (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
Description
본 발명은 지식기반 질문 응답 방법 및 장치에 관한 것이다. 보다 구체적으로는, 하나의 질문 문장과 엔티티(Entity), 릴레이션(Relation)을 동일한 네트워크 안에서 추론하여, 질문 문장에 대한 정답을 효율적으로 추론할 수 있는 방법 및 이를 수행하는 장치에 관한 것이다.The present invention relates to a knowledge-based question answering method and apparatus. More specifically, the present invention relates to a method for efficiently inferring a correct answer to a question sentence by inferring one question sentence, an entity, and a relation in the same network, and an apparatus for performing the same.
Freebase, DBPedia, YAGO, WikiData, Google Knowledge Graph 와 같은 오픈 도메인의 대규모 지식 베이스가 등장하면서 많은 정보를 축적하게 되었다. 이러한 대규모의 지식 베이스를 사용하기 위해서는 SPARQL 또는 graph query와 같은 쿼리 언어들을 이해하고 다룰 줄 알아야 하는데, 데이터베이스 환경에 익숙하지 않은 일반 사용자들은 이를 이해하고 사용하는데 있어 어려움이 있다. With the emergence of large open domain knowledge bases such as Freebase, DBPedia, YAGO, WikiData, and Google Knowledge Graph, a lot of information has been accumulated. In order to use such a large knowledge base, it is necessary to understand and handle query languages such as SPARQL or graph query, but general users who are not familiar with the database environment have difficulty in understanding and using it.
그에 따라, 많은 사람들이 보다 쉽게 Knowledge graph(KG)에 축적된 데이터를 이용하고, 이와 동시에 효율적으로 사용할 수 있는 knowledge based question answering(KB-QA) 연구가 활발히 이루어지고 있다. Accordingly, knowledge-based question answering (KB-QA) research that allows many people to more easily use the data accumulated in the knowledge graph (KG) and use it efficiently at the same time is being actively conducted.
KB-QA는 자연어로 구성된 질문 문장을 KB의 쿼리로 매핑하는 것으로서, 질문과 그에 대한 정답을 기계학습 기법으로 학습한 후, 이 후 다양한 질문에 대한 정답을 추론할 수 있는 모델이라 할 수 있다. KB-QA maps a question sentence composed of natural language to a query of KB. After learning a question and its correct answer using machine learning techniques, it can be said to be a model that can infer correct answers to various questions.
발명의 배경이 되는 기술은 본 발명에 대한 이해를 보다 용이하게 하기 위해 작성되었다. 발명의 배경이 되는 기술에 기재된 사항들이 선행기술로 존재한다고 인정하는 것으로 이해되어서는 안 된다.The technology that is the background of the present invention has been prepared to facilitate understanding of the present invention. It should not be understood as an admission that the matters described in the technology behind the invention exist as prior art.
KB-QA 모델과 관련하여 다양한 연구가 진행되고 있으며, 이중에서도 하나의 질문 문장을 지식 베이스 내에 존재하는 팩트(Fact) 하나와 연결시켜 정확한 정답을 찾아낼 수 있는 단순 질문(Simple Question) 문제의 경우, 질문 문장의 핵심과 의도를 정확하게 파악하기 위한 방법이 필요하다.Various researches are being conducted in relation to the KB-QA model, and among them, in the case of a simple question problem that can find the correct answer by linking one question sentence with one fact existing in the knowledge base In addition, a method is needed to accurately grasp the core and intention of the question sentence.
즉, 정형화되지 않은 자연어 형태의 질문 문장에서 질문자가 원하는 정보를 구조화된 지식 베이스(KB)에서 찾아내기 위해서는, 질문 문장의 주어 역할을 하는 단어 또는 구를 지식 베이스의 엔티티(entity)와 연결시키고, 질문 문장의 서술어에 해당하는 단어 또는 구를 지식 베이스의 릴레이션(relation)을 릴레이션과 연결시켜야 하는데, 종래의 연구들에서는 질문 문장에서 독립적이라 할 수 없는 주어와 서술어를 독립적인 요소로 가정하고 정답을 찾아내기 때문에, 정답의 정확도가 떨어질 수밖에 없다. That is, in order to find the information that the questioner wants in the structured knowledge base (KB) in the question sentence in the unstructured natural language form, a word or phrase serving as the subject of the question sentence is connected with an entity of the knowledge base, The word or phrase corresponding to the predicate of the question sentence must be connected to the relation of the knowledge base. In the conventional studies, the subject and the predicate, which cannot be called independent in the question sentence, are assumed as independent elements and the correct answer is determined Because of finding it, the accuracy of the correct answer is bound to decrease.
이에, 본 발명의 발명자들은, 엔드투엔드(end-to-end) 방식에서 질문 문장 내 주어 및 서술어와 대응되는 엔티티 및 릴레이션이 서로 영향을 주는 요소인 것으로 가정하고, 질문 문장에 대한 정답을 보다 효과적으로 찾아낼 수 있는 새로운 지식기반 질문 응답 방법 및 장치를 개발하고자 하였다.Accordingly, the inventors of the present invention assume that entities and relations corresponding to subjects and predicates in a question sentence are factors that influence each other in an end-to-end method, and answer correct answers to the question sentences. We tried to develop a new knowledge-based question answering method and device that can be found effectively.
그 결과, 본 발명의 발명자들은, 질문 문장과, 엔티티 그리고 릴레이션을 하나의 세트에 묶고, 새롭게 구성한 하나의 네트워크 안에서 매칭 스코어를 계산한 후 정답을 추론함으로써, 질문 문장의 의도를 정확하게 파악하여, 정답의 정확도를 높일 수 있는 새로운 지식기반 질문 응답 방법을 개발하기에 이르렀다. As a result, the inventors of the present invention accurately grasp the intention of the question sentence by inferring the correct answer after combining the question sentence, the entity and the relation into one set, calculating the matching score in one newly constructed network, and It has come to develop a new knowledge-based question answering method that can increase the accuracy of the data.
본 발명의 일 실시 예에서 해결하고자 하는 과제는 변형된 트랜스포머 네트워크 구조를 이용하여 질문 문장의 구조와 릴레이션을 결정하기 위한 중요 토큰을 확인하고, 문장을 하나의 벡터로 표현한 뒤, 셀프 어텐션(self-attention) 기법을 이용하여 각 속성에 대한 정답을 하나의 네트워크 안에서 계산함으로써, 정답의 정확도를 높이는 방법 및 이를 수행하는 장치를 제공하는 것이다. The problem to be solved in an embodiment of the present invention is to identify an important token for determining the structure and relation of a question sentence using a modified transformer network structure, express the sentence as a vector, and then self-attention (self-attention). Attention) technique is used to calculate the correct answer for each attribute in one network, thereby providing a method of increasing the accuracy of the correct answer and a device for performing it.
본 발명의 과제들은 이상에서 언급한 과제들로 제한되지 않으며, 언급되지 않은 또 다른 과제들은 아래의 기재로부터 당업자에게 명확하게 이해될 수 있을 것이다.The problems of the present invention are not limited to the problems mentioned above, and other problems that are not mentioned will be clearly understood by those skilled in the art from the following description.
전술한 바와 같은 과제를 해결하기 위하여 본 발명의 일 실시 예에 따른 지식기반 질문 응답 방법을 제공한다. 상기 방법은, 질문 문장을 수신하는 단계, 상기 질문 문장과 적어도 하나의 엔티티(entity) 및 릴레이션(relation)을 포함하는 후보 입력군(Candidate fact)을 복수 개 생성하는 단계, 상기 후보 입력군 각각을 통합 계산 모델(Integrated Scoring Model)에 입력하여, 상기 후보 입력군 각각에 대한 정답 스코어(Fact Score)를 계산하는 단계 및 계산된 정답 스코어 중 가장 높은 값을 가지는 정답 스코어와 매칭되는 정답을 제공하는 단계를 포함하도록 구성된다. In order to solve the above-described problems, a knowledge-based question answering method according to an embodiment of the present invention is provided. The method includes the steps of receiving a question sentence, generating a plurality of candidate input groups (Candidate fact) including the question sentence and at least one entity and a relationship, each of the candidate input groups By inputting into an integrated scoring model, calculating a fact score for each of the candidate input groups, and providing a correct answer matching the correct answer score having the highest value among the calculated correct answer scores. It is configured to include.
본 발명의 특징에 따르면, 상기 통합 계산 모델은, 상기 후보 입력군을 구성하는 토큰들의 단어 단위, 위치, 속성을 기준으로 임베딩된 벡터들의 조합을 입력 시퀀스로 하는 인풋 임베딩 레이어, 상기 토큰들의 정보가 상호 반영된 입력 벡터 시퀀스를 획득하는 인코딩 레이어, 상기 입력 벡터 시퀀스에서 속성 별로 마스크를 씌워 질문 문장 벡터(rq1)(rq2), 엔티티 벡터(rs), 릴레이션 벡터(rp)를 계산하는 마스크 어텐션 레이어와 상기 질문 문장 벡터, 상기 엔티티 벡터 및 상기 릴레이션 벡터를 이용하여 상기 정답 스코어를 계산하는 스코어 레이어를 포함할 수 있다.According to a feature of the present invention, the integrated calculation model includes, as an input sequence, an input embedding layer using a combination of vectors embedded based on word units, positions, and attributes of tokens constituting the candidate input group, and information on the tokens. An encoding layer that obtains a mutually reflected input vector sequence, a mask for calculating a question sentence vector (r q1 ) (r q2 ), an entity vector (r s ), and a relation vector (r p ) by applying a mask for each attribute in the input vector sequence It may include an attention layer, a score layer that calculates the correct answer score by using the question sentence vector, the entity vector, and the relation vector.
본 발명의 다른 특징에 따르면, 상기 후보 입력군은, 토큰화된 질문 문장, 엔티티, 릴레이션을 포함하며, 각 속성의 마지막 순서에 적어도 하나의 특수 토큰이 삽입될 수 있다.According to another feature of the present invention, the candidate input group includes tokenized question sentences, entities, and relations, and at least one special token may be inserted in the last order of each attribute.
본 발명의 또 다른 특징에 따르면, 상기 마스크 어텐션 레이어는 상기 특수 토큰이 삽입된 위치를 기준으로 상기 복수의 토큰들 각각의 속성 별로 마스크를 씌우고, 상기 질문 문장, 상기 엔티티 및 상기 릴레이션을 고정된 길이의 벡터로 계산할 수 있다.According to another feature of the present invention, the mask attention layer masks each attribute of each of the plurality of tokens based on the position where the special token is inserted, and sets the question sentence, the entity, and the relation to a fixed length. Can be calculated as a vector of
본 발명의 또 다른 특징에 따르면, 상기 스코어 레이어는, 상기 질문 문장 벡터와 상기 엔티티 벡터 이용하여 엔티티 매칭 스코어를 계산하고, 상기 질문 문장 벡터와 릴레이션 벡터를 이용하여 릴레이션 매칭 스코어를 계산하며, 상기 엔티티 매칭 스코어와 상기 릴레이션 매칭 스코어에 학습된 파라미터를 적용하여, 상기 정답 스코어를 계산할 수 있다.According to another feature of the present invention, the score layer calculates an entity matching score using the question sentence vector and the entity vector, calculates a relation matching score using the question sentence vector and the relation vector, and the entity The correct answer score may be calculated by applying the learned parameter to the matching score and the relation matching score.
본 발명의 또 다른 특징에 따르면, 상기 인코딩 레이어는, 트랜스포머 엔코더(Transformer Encoder), LSTM 및 Bi-LSTM 중 어느 하나의 네트워크 구조가 적용될 수 있다.According to another feature of the present invention, the encoding layer may have any one of a transformer encoder, an LSTM, and a Bi-LSTM network structure.
본 발명의 또 다른 특징에 따르면, 상기 엔티티는, 지식 베이스(Knowledge Base, KB) 내 모든 엔티티에 상기 질문 문장을 구성하는 단어 단위를 대입하고, 대입된 단어 단위와 일치하는 엔티티가 존재하는 경우, 해당 단어 단위를 엔티티로서 하나의 후보 입력군에 포함시킬 수 있다.According to another feature of the present invention, when the entity substitutes a word unit constituting the question sentence to all entities in a knowledge base (KB), and an entity matching the substituted word unit exists, The word unit may be included as an entity in one candidate input group.
본 발명의 또 다른 특징에 따르면, 상기 제공하는 단계 이후에, 상기 질문 문장의 정답에 해당하지 않은 후보 입력군 중 어느 하나의 후보 입력군에서 엔티티를 손상시킨 제1 네거티브 샘플, 릴레이션을 손상시킨 제2 네거티브 샘플을 생성하는 단계와 상기 질문 문장의 정답에 해당하는 후보 입력군을 포지티브 샘플로 설정하고, 상기 포지티브 샘플, 상기 제1 및 제2 네거티브 샘플을 하기 [수학식 1]에 대입하여, 상기 질문 문장과 상기 정답을 학습하는 단계를 더 포함할 수 있다.According to another feature of the present invention, after the providing step, a first negative sample in which an entity is damaged in any one candidate input group among candidate input groups that do not correspond to the correct answer of the question sentence, and a first negative sample in which the relation is damaged. 2 Generating a negative sample and setting a candidate input group corresponding to the correct answer of the question sentence as a positive sample, and substituting the positive sample and the first and second negative samples into [Equation 1] below, It may further include the step of learning the question sentence and the correct answer.
[수학식 1][Equation 1]
여기서, 주어진 function은 scroing function, q는 질문 문장, t는 q에 대한 positive, negative sample임.Here, the given function is a scroing function, q is a question sentence, and t is a positive and negative sample for q.
전술한 바와 같은 과제를 해결하기 위하여 본 발명의 다른 실시 예에 따른 지식기반 질문 응답 장치를 제공한다. 지식기반 질문 응답 장치는, 저장부, 통신부 및 상기 저장부, 상기 통신부와 동작 가능하게 연결된 프로세서를 포함하되, 상기 프로세서는, 질문 문장을 수신하고, 상기 질문 문장과 적어도 하나의 엔티티(entity) 및 릴레이션(relation)을 합한 후보 입력군(Candidate fact)을 복수 개 생성하며, 상기 후보 입력군 각각을 통합 계산 모델(Integrated Scoring Model)에 입력하여, 상기 후보 입력군 각각에 대한 정답 스코어(Fact Score)를 계산하고, 계산된 정답 스코어 중 가장 높은 값을 가지는 정답 스코어와 매칭되는 정답을 제공하도록 구성된다.In order to solve the above-described problem, a knowledge-based question response apparatus according to another embodiment of the present invention is provided. The knowledge-based question response apparatus includes a storage unit, a communication unit, and a processor operably connected to the storage unit and the communication unit, wherein the processor receives the question sentence, the question sentence and at least one entity, and Generating a plurality of candidate facts in which relations are summed, and inputting each of the candidate input groups into an integrated scoring model, and a correct answer score for each of the candidate input groups Is calculated, and configured to provide a correct answer matching the correct answer score having the highest value among the calculated correct answer scores.
본 발명의 특징에 따르면, 상기 통합 계산 모델은, 상기 후보 입력군을 구성하는 토큰들의 단어 단위, 위치, 속성을 기준으로 임베딩된 벡터들의 조합을 입력 시퀀스로 하는 인풋 임베딩 레이어, 상기 토큰들의 정보가 상호 반영된 입력 벡터 시퀀스를 획득하는 인코딩 레이어, 상기 입력 벡터 시퀀스에서 속성 별로 마스크를 씌워 질문 문장 벡터(rq1)(rq2), 엔티티 벡터(rs), 릴레이션 벡터(rp)를 계산하는 마스크 어텐션 레이어와 상기 질문 문장 벡터, 상기 엔티티 벡터 및 상기 릴레이션 벡터를 이용하여 상기 정답 스코어를 계산하는 스코어 레이어를 포함할 수 있다.According to a feature of the present invention, the integrated calculation model includes, as an input sequence, an input embedding layer using a combination of vectors embedded based on word units, positions, and attributes of tokens constituting the candidate input group, and information on the tokens. An encoding layer that obtains a mutually reflected input vector sequence, a mask for calculating a question sentence vector (r q1 ) (r q2 ), an entity vector (r s ), and a relation vector (r p ) by applying a mask for each attribute in the input vector sequence It may include an attention layer, a score layer that calculates the correct answer score by using the question sentence vector, the entity vector, and the relation vector.
본 발명의 다른 특징에 따르면, 상기 후보 입력군은, 토큰화된 질문 문장, 엔티티, 릴레이션을 포함하며, 각 속성의 마지막 순서에 적어도 하나의 특수 토큰이 삽입될 수 있다.According to another feature of the present invention, the candidate input group includes tokenized question sentences, entities, and relations, and at least one special token may be inserted in the last order of each attribute.
본 발명의 또 다른 특징에 따르면, 상기 마스크 어텐션 레이어는 상기 특수 토큰이 삽입된 위치를 기준으로 상기 복수의 토큰들 각각의 속성 별로 마스크를 씌우고, 상기 질문 문장, 상기 엔티티 및 상기 릴레이션을 고정된 길이의 벡터로 계산할 수 있다.According to another feature of the present invention, the mask attention layer masks each attribute of each of the plurality of tokens based on the position where the special token is inserted, and sets the question sentence, the entity, and the relation to a fixed length. Can be calculated as a vector of
본 발명의 또 다른 특징에 따르면, 상기 스코어 레이어는, 상기 질문 문장 벡터와 상기 엔티티 벡터 이용하여 엔티티 매칭 스코어를 계산하고, 상기 질문 문장 벡터와 릴레이션 벡터를 이용하여 릴레이션 매칭 스코어를 계산하며, 상기 엔티티 매칭 스코어와 상기 릴레이션 매칭 스코어에 학습된 파라미터를 적용하여, 상기 정답 스코어를 계산할 수 있다.According to another feature of the present invention, the score layer calculates an entity matching score using the question sentence vector and the entity vector, calculates a relation matching score using the question sentence vector and the relation vector, and the entity The correct answer score may be calculated by applying the learned parameter to the matching score and the relation matching score.
본 발명의 또 다른 특징에 따르면, 상기 인코딩 레이어는, 트랜스포머 엔코더(Transformer Encoder), LSTM 및 Bi-LSTM 중 어느 하나의 네트워크 구조가 적용될 수 있다.According to another feature of the present invention, the encoding layer may have any one of a transformer encoder, an LSTM, and a Bi-LSTM network structure.
본 발명의 또 다른 특징에 따르면, 상기 엔티티는, 지식 베이스(Knowledge Base, KB) 내 모든 엔티티에 상기 질문 문장을 구성하는 단어 단위를 대입하고, 대입된 단어 단위와 일치하는 엔티티가 존재하는 경우, 해당 단어 단위를 엔티티로서 하나의 후보 입력군에 포함시킬 수 있다.According to another feature of the present invention, when the entity substitutes a word unit constituting the question sentence to all entities in a knowledge base (KB), and an entity matching the substituted word unit exists, The word unit may be included as an entity in one candidate input group.
본 발명의 또 다른 특징에 따르면, 상기 프로세서는, 정답을 제공한 이후에, 상기 질문 문장의 정답에 해당하지 않은 후보 입력군 중 어느 하나의 후보 입력군에서 엔티티를 손상시킨 제1 네거티브 샘플, 릴레이션을 손상시킨 제2 네거티브 샘플을 생성하고, 상기 질문 문장의 정답에 해당하는 후보 입력군을 포지티브 샘플로 설정하고, 상기 포지티브 샘플, 상기 제1 및 제2 네거티브 샘플을 하기 [수학식 1]에 대입하여, 상기 질문 문장과 상기 정답을 학습할 수 있다.According to another feature of the present invention, after providing the correct answer, the processor includes a first negative sample and a relation in which an entity is damaged in any one of the candidate input groups that do not correspond to the correct answer of the question sentence. Generate a second negative sample in which is damaged, set a candidate input group corresponding to the correct answer of the question sentence as a positive sample, and substitute the positive sample and the first and second negative samples into the following [Equation 1] Thus, the question sentence and the correct answer can be learned.
[수학식 1][Equation 1]
여기서, 주어진 function은 scroing function, q는 질문 문장, t는 q에 대한 positive, negative sample임.Here, the given function is a scroing function, q is a question sentence, and t is a positive and negative sample for q.
기타 실시 예의 구체적인 사항들은 상세한 설명 및 도면들에 포함되어 있다.Details of other embodiments are included in the detailed description and drawings.
본 발명은 엔티티와 릴레이션을 동일한 네트워크 안에서 추론하여, 질문 문장에 대한 정답을 보다 정확하게 추론할 수 있다. 또한, 질문 문장과 엔티티, 릴레이션을 포함하는 하나의 후보 입력군에서 각 항목들 사이에 특수 토큰을 포함시킴으로써, 모든 위치의 정보들이 효율적으로 집약될 수 있다.In the present invention, by inferring an entity and a relation in the same network, a correct answer to a question sentence can be more accurately inferred. In addition, by including a special token between each item in one candidate input group including a question sentence, entity, and relation, information of all locations can be efficiently aggregated.
아울러, 본 발명은 질문 문장을 구성하는 각 단어들을 별개의 벡터로 표현하지 않고, 질문 문장 전체를 벡터로 표현함으로써, 문장의 의도에 적합하게 어텐션을 줄 수 있어, 질문 문장과 지식 베이스(KB)의 팩트 간 매칭 스코어를 효과적으로 계산할 수 있다. In addition, the present invention does not express each word constituting the question sentence as a separate vector, but expresses the entire question sentence as a vector, so that attention can be given appropriately to the intention of the sentence, and the question sentence and the knowledge base (KB) It is possible to effectively calculate the matching score between the facts of
즉, 본 발명은 RNN 기반의 릴레이션 추론 모델(Relation Detection Model) 대신 셀프 어텐션(Self-attention)을 기반으로 하는 트랜스포머 엔코더 네트워크를 사용하여, 정답을 추론하는 과정에서 복잡한 자연어 처리 또는 어휘 분석을 사용하지 않아, 불필요한 연산량을 줄일 수 있으며, 스스로 그 의미를 학습시킬 수 있다. That is, the present invention uses a transformer encoder network based on self-attention instead of an RNN based relation detection model, and does not use complex natural language processing or vocabulary analysis in the process of inferring the correct answer. As a result, it is possible to reduce the amount of unnecessary computation and learn its meaning by itself.
본 발명에 따른 효과는 이상에서 예시된 내용에 의해 제한되지 않으며, 더욱 다양한 효과들이 본 발명 내에 포함되어 있다.The effects according to the present invention are not limited by the contents exemplified above, and more various effects are included in the present invention.
도 1a는 종래의 지식기반 질문 응답 모델에서 질문 문장에 대한 엔티티와 릴레이션을 찾는 방식을 설명하기 위한 개략도이다.
도 1b는 본 발명의 지식기반 질문 응답 장치에서 정답을 찾는 방식을 설명하기 위한 개략도이다.
도 2는 본 발명의 일 실시 예에 따른 지식기반 질문 응답 장치의 구성을 나타낸 블록도이다.
도 3은 본 발명의 일 실시 예에 따른 지식기반 질문 응답 방법의 개략적인 순서도이다.
도 4는 본 발명의 일 실시 예에 따른 통합 계산 모델의 구성을 나타낸 개략도이다.
도 5a 내지 도 5c는 종래의 질문 응답 모델과 본 발명의 일 실시 예에 따른 통합 계산 모델에서 어텐션을 줄 토큰을 찾아내는 방식을 설명하기 위한 개략도이다.
도 6은 본 발명의 일 실시 예에 따른 인풋 임베딩 레이어에 들어가는 벡터 조합을 설명하기 위한 개략도이다.
도 7은 본 발명의 일 실시 예에 따른 질문 응답 방법에서 마스크 어텐션 레이어를 사용하는 모습을 예시적으로 나타낸 개략도이다.
도 8은 본 발명의 일 실시 예에 따른 통합 계산 모델과 변형을 준 모델들의 성능 평과 결과 그래프이다.
도 9a는 본 발명의 일 실시 예에 따른 통합 계산 모델에서 마스크 어텐션 레이어를 제거한 구성을 나타낸 개략도이다.
도 9b는 본 발명의 일 실시 예에 따른 통합 계산 모델에서 엔티티와 릴레이션을 다시 분리시킨 구성을 나타낸 개략도이다.
도 10a 및 도 10b는 본 발명의 일 실시 예에 따른 질문 응답 방법을 통해 각 토큰들에 주어진 어텐션의 분포를 설명하기 위한 개략도이다.1A is a schematic diagram for explaining a method of finding an entity and a relation for a question sentence in a conventional knowledge-based question answering model.
1B is a schematic diagram illustrating a method of finding a correct answer in a knowledge-based question answering apparatus of the present invention.
2 is a block diagram showing the configuration of a knowledge-based question answering apparatus according to an embodiment of the present invention.
3 is a schematic flowchart of a knowledge-based question answering method according to an embodiment of the present invention.
4 is a schematic diagram showing the configuration of an integrated calculation model according to an embodiment of the present invention.
5A to 5C are schematic diagrams illustrating a method of finding a token to be paid attention in a conventional question answering model and an integrated calculation model according to an embodiment of the present invention.
6 is a schematic diagram illustrating a vector combination entering an input embedding layer according to an embodiment of the present invention.
7 is a schematic diagram illustrating an example of using a mask attention layer in a method for answering a question according to an embodiment of the present invention.
8 is a graph of performance evaluation results of an integrated calculation model and a model to which a modification is applied according to an embodiment of the present invention.
9A is a schematic diagram showing a configuration in which a mask attention layer is removed from an integrated calculation model according to an embodiment of the present invention.
9B is a schematic diagram showing a configuration in which entities and relations are separated again in an integrated calculation model according to an embodiment of the present invention.
10A and 10B are schematic diagrams for explaining distribution of attention given to tokens through a question answering method according to an embodiment of the present invention.
본 발명의 이점 및 특징, 그리고 그것들을 달성하는 방법은 첨부되는 도면과 함께 상세하게 후술되어 있는 실시 예들을 참조하면 명확해질 것이다. 그러나, 본 발명은 이하에서 개시되는 실시 예들에 한정되는 것이 아니라 서로 다른 다양한 형태로 구현될 것이며, 단지 본 실시 예들은 본 발명의 개시가 완전하도록 하며, 본 발명이 속하는 기술분야에서 통상의 지식을 가진 자에게 발명의 범주를 완전하게 알려주기 위해 제공되는 것이며, 본 발명은 청구항의 범주에 의해 정의될 뿐이다. 도면의 설명과 관련하여, 유사한 구성요소에 대해서는 유사한 참조부호가 사용될 수 있다.Advantages and features of the present invention, and a method of achieving them will become apparent with reference to the embodiments described below in detail together with the accompanying drawings. However, the present invention is not limited to the embodiments disclosed below, but will be implemented in a variety of different forms, only the present embodiments make the disclosure of the present invention complete, and common knowledge in the art It is provided to completely inform the scope of the invention to the possessor, and the invention is only defined by the scope of the claims. In connection with the description of the drawings, similar reference numerals may be used for similar elements.
본 문서에서, "가진다," "가질 수 있다," "포함한다," 또는 "포함할 수 있다" 등의 표현은 해당 특징(예: 수치, 기능, 동작, 또는 부품 등의 구성요소)의 존재를 가리키며, 추가적인 특징의 존재를 배제하지 않는다.In this document, expressions such as "have," "may have," "include," or "may contain" are the presence of corresponding features (eg, elements such as numbers, functions, actions, or parts). And does not exclude the presence of additional features.
본 문서에서, "A 또는 B," "A 또는/및 B 중 적어도 하나," 또는 "A 또는/및 B 중 하나 또는 그 이상" 등의 표현은 함께 나열된 항목들의 모든 가능한 조합을 포함할 수 있다. 예를 들면, "A 또는 B," "A 및 B 중 적어도 하나," 또는 "A 또는 B 중 적어도 하나"는, (1) 적어도 하나의 A를 포함, (2) 적어도 하나의 B를 포함, 또는(3) 적어도 하나의 A 및 적어도 하나의 B 모두를 포함하는 경우를 모두 지칭할 수 있다.In this document, expressions such as "A or B," "at least one of A or/and B," or "one or more of A or/and B" may include all possible combinations of items listed together. . For example, "A or B," "at least one of A and B," or "at least one of A or B" includes (1) at least one A, (2) at least one B, Or (3) it may refer to all cases including both at least one A and at least one B.
본 문서에서 사용된 "제1," "제2," "첫째," 또는 "둘째," 등의 표현들은 다양한 구성요소들을, 순서 및/또는 중요도에 상관없이 수식할 수 있고, 한 구성요소를 다른 구성요소와 구분하기 위해 사용될 뿐 해당 구성요소들을 한정하지 않는다. 예를 들면, 제1 사용자 기기와 제2 사용자 기기는, 순서 또는 중요도와 무관하게, 서로 다른 사용자 기기를 나타낼 수 있다. 예를 들면, 본 문서에 기재된 권리범위를 벗어나지 않으면서 제1 구성요소는 제2 구성요소로 명명될 수 있고, 유사하게 제2 구성요소도 제1 구성요소로 바꾸어 명명될 수 있다.Expressions such as "first," "second," "first," or "second," used in this document can modify various elements, regardless of their order and/or importance, and refer to one element. It is used to distinguish it from other components and does not limit the components. For example, a first user device and a second user device may represent different user devices regardless of order or importance. For example, without departing from the scope of rights described in this document, a first component may be named a second component, and similarly, a second component may be renamed to a first component.
어떤 구성요소(예: 제1 구성요소)가 다른 구성요소(예: 제2 구성요소)에 "(기능적으로 또는 통신적으로) 연결되어((operatively or communicatively) coupled with/to)" 있다거나 "접속되어(connected to)" 있다고 언급된 때에는, 상기 어떤 구성요소가 상기 다른 구성요소에 직접적으로 연결되거나, 다른 구성요소(예: 제3 구성요소)를 통하여 연결될 수 있다고 이해되어야 할 것이다. 반면에, 어떤 구성요소(예: 제1 구성요소)가 다른 구성요소(예: 제2 구성요소)에 "직접 연결되어" 있다거나 "직접 접속되어" 있다고 언급된 때에는, 상기 어떤 구성요소와 상기 다른 구성요소 사이에 다른 구성요소(예: 제3 구성요소)가 존재하지 않는 것으로 이해될 수 있다.Some component (eg, a first component) is "(functionally or communicatively) coupled with/to)" to another component (eg, a second component) or " When referred to as "connected to", it should be understood that the certain component may be directly connected to the other component or may be connected through another component (eg, a third component). On the other hand, when a component (eg, a first component) is referred to as being “directly connected” or “directly connected” to another component (eg, a second component), the component and the It may be understood that no other component (eg, a third component) exists between the different components.
본 문서에서 사용된 표현 "~하도록 구성된(또는 설정된)(configured to)"은 상황에 따라, 예를 들면, "~에 적합한(suitable for)," "~하는 능력을 가지는(having the capacity to)," "~하도록 설계된(designed to)," "~하도록 변경된(adapted to)," "~하도록 만들어진(made to)," 또는 "~ 를 할 수 있는(capable of)"과 바꾸어 사용될 수 있다. 용어 "~하도록 구성된(또는 설정된)"은 하드웨어적으로 "특별히 설계된(specifically designed to)" 것만을 반드시 의미하지 않을 수 있다. 대신, 어떤 상황에서는, "~하도록 구성된 장치"라는 표현은, 그 장치가 다른 장치 또는 부품들과 함께 "~할 수 있는" 것을 의미할 수 있다. 예를 들면, 문구 "A, B, 및 C를 수행하도록 구성된(또는 설정된)프로세서"는 해당 동작을 수행하기 위한 전용 프로세서(예: 임베디드 프로세서), 또는 메모리 장치에 저장된 하나 이상의 소프트웨어 프로그램들을 실행함으로써, 해당 동작들을 수행할 수 있는 범용 프로세서(generic-purpose processor)(예: CPU 또는 application processor)를 의미할 수 있다.The expression "configured to" as used in this document is, for example, "suitable for," "having the capacity to" depending on the situation. ," "designed to," "adapted to," "made to," or "capable of" can be used interchangeably. The term "configured to (or set)" may not necessarily mean only "specifically designed to" in hardware. Instead, in some situations, the expression "a device configured to" may mean that the device "can" along with other devices or parts. For example, the phrase “processor configured (or configured) to perform A, B, and C” means a dedicated processor (eg, an embedded processor) for performing the operation, or by executing one or more software programs stored in a memory device. , May mean a generic-purpose processor (eg, a CPU or an application processor) capable of performing corresponding operations.
본 문서에서 사용된 용어들은 단지 특정한 실시 예를 설명하기 위해 사용된 것으로, 다른 실시 예의 범위를 한정하려는 의도가 아닐 수 있다. 단수의 표현은 문맥상 명백하게 다르게 뜻하지 않는 한, 복수의 표현을 포함할 수 있다. 기술적이거나 과학적인 용어를 포함해서 여기서 사용되는 용어들은 본 문서에 기재된 기술분야에서 통상의 지식을 가진 자에 의해 일반적으로 이해되는 것과 동일한 의미를 가질 수 있다. 본 문서에 사용된 용어들 중 일반적인 사전에 정의된 용어들은, 관련 기술의 문맥상 가지는 의미와 동일 또는 유사한 의미로 해석될 수 있으며, 본 문서에서 명백하게 정의되지 않는 한, 이상적이거나 과도하게 형식적인 의미로 해석되지 않는다. 경우에 따라서, 본 문서에서 정의된 용어일지라도 본 문서의 실시 예들을 배제하도록 해석될 수 없다.Terms used in this document are only used to describe a specific embodiment, and may not be intended to limit the scope of other embodiments. Singular expressions may include plural expressions unless the context clearly indicates otherwise. Terms used herein, including technical or scientific terms, may have the same meaning as commonly understood by one of ordinary skill in the art described in this document. Among the terms used in this document, terms defined in a general dictionary may be interpreted as having the same or similar meanings as those in the context of the related technology, and unless explicitly defined in this document, an ideal or excessively formal meaning Is not interpreted as. In some cases, even terms defined in this document cannot be interpreted to exclude embodiments of this document.
본 발명의 여러 실시 예들의 각각 특징들이 부분적으로 또는 전체적으로 서로 결합 또는 조합 가능하며, 당업자가 충분히 이해할 수 있듯이 기술적으로 다양한 연동 및 구동이 가능하며, 각 실시 예들이 서로에 대하여 독립적으로 실시 가능할 수도 있고 연관 관계로 함께 실시 가능할 수도 있다.Each of the features of the various embodiments of the present invention can be partially or entirely combined or combined with each other, and as those skilled in the art can fully understand, technically various interlocking and driving are possible, and each embodiment may be independently implemented with respect to each other It may be possible to do it together in a related relationship.
본 명세서의 해석의 명확함을 위해, 이하에서는 본 명세서에서 사용되는 용어들을 정의하기로 한다.For clarity of interpretation of the present specification, terms used in the present specification will be defined below.
도 1a는 종래의 지식기반 질문 응답 모델에서 질문 문장에 대한 엔티티와 릴레이션을 찾는 방식을 설명하기 위한 개략도이고, 도 1b는 본 발명의 지식기반 질문 응답 장치에서 정답을 찾는 방식을 설명하기 위한 개략도이다.1A is a schematic diagram illustrating a method of finding an entity and a relation for a question sentence in a conventional knowledge-based question answering model, and FIG. 1B is a schematic diagram illustrating a method of finding a correct answer in the knowledge-based question answering apparatus of the present invention. .
도 1a 및 도 1b 모두 단순 질문(Simple Question Answering)에 대한 정답을 제공하기 위해 구현되었으며, 질문 문장을 바탕으로 지식 베이스(KB)에서 정답을 탐색하는 Information Retrieval 방식을 이용하는 것을 전제로 한다. Both FIGS. 1A and 1B are implemented to provide correct answers to Simple Question Answering, and it is premised that an Information Retrieval method of searching for correct answers in a knowledge base (KB) based on question sentences is used.
도 1a를 참조하면, 종래의 지식기반 질문 응답 모델에서는 엔티티 매칭 스코어(Entity Matching Score)를 계산하는 모델과 릴레이션 매칭 스코어(Relation Matching Score)를 계산하는 모델이 분리되어 있으며, 각자 독립적인 파라미터를 구성하는 것을 알 수 있다. Referring to FIG. 1A, in a conventional knowledge-based question answering model, a model for calculating Entity Matching Score and a model for calculating Relation Matching Score are separated, and independent parameters are configured. I can see that.
종래의 모델에서는, 엔티티, 릴레이션 각각의 모델이 하나의 질문 문장에 대해 m개의 엔티티 후보(m은 1 이상의 자연수)들의 매칭 스코어를 계산하고, 하나의 질문 문장에 대해 n개의 릴레이션 후보(n은 1 이상의 자연수)들의 매칭 스코어를 계산함으로써, 장치의 연산량이 증가하게 된다. In a conventional model, each model of entity and relation calculates a matching score of m entity candidates (m is a natural number of 1 or more) for one question sentence, and n relation candidates (n is 1) for one question sentence. By calculating the matching score of the above natural numbers), the computational amount of the device increases.
뿐만 아니라, 주어와 서술어는 단어만을 보았을 때 독립적이라고 할 수 있지만, 질문 문장의 해석하여 보았을 때 그 의미는 연결되어 있으므로, 이와 대응되는 엔티티와 릴레이션을 분리시킨 종래의 모델은 정답의 정확도가 떨어질 수 있다. In addition, the subject and the predicate can be said to be independent when only the word is viewed, but the meaning is connected when viewed through the interpretation of the question sentence, so the conventional model that separates the corresponding entity and relation may be less accurate in the correct answer. have.
반면, 도 1b를 참조하면, 본 발명의 일 실시 예에 따른 질문 응답 모델에서는 “질문 문장, 엔티티, 릴레이션”을 포함하는 후보 입력군(Input Question Tokens, Candidate Entity Tokens, Candidate Relation Tokens)을 하나의 통합 계산 모델에 넣어 정답을 추론하도록 한다(Find Best Fact). 즉, 본 발명의 일 실시 예에 따른 질문 응답 모델에서는, 독립적이지 않은 엔티티와 릴레이션이 독립적으로 학습되는 것을 막고, 장치의 연산량을 줄인 효과적인 추론이 가능할 수 있다.On the other hand, referring to FIG. 1B, in the question response model according to an embodiment of the present invention, one candidate input group (Input Question Tokens, Candidate Entity Tokens, Candidate Relation Tokens) including “question sentence, entity, relation” Put it in an integrated calculation model to infer the correct answer (Find Best Fact). That is, in the question answering model according to an embodiment of the present invention, effective inference may be possible by preventing independent learning of non-independent entities and relations and reducing the amount of computation of the device.
이하에서는, 도 1b의 통합 계산 모델을 구현할 수 있는 지식기반 질문 응답 장치(100)에 대하여 설명하도록 한다.Hereinafter, a knowledge-based
도 2는 본 발명의 일 실시 예에 따른 지식기반 질문 응답 장치의 구성을 나타낸 블록도이다.2 is a block diagram showing the configuration of a knowledge-based question answering apparatus according to an embodiment of the present invention.
지식기반 질문 응답 장치(100)(이하, “질문 응답 장치(100)”라 한다)의 구성을 설명하기에 앞서, 본 발명의 지식기반 질문 응답 장치(100)는 어느 하나의 서버(server)를 구현하는 장치일 수 있다. Prior to describing the configuration of the knowledge-based question response device 100 (hereinafter, referred to as “
도 2를 참조하면, 질문 응답 장치(100)는 저장부(110), 통신부(120) 및 프로세서(130)를 포함할 수 있다. Referring to FIG. 2, the
저장부(110)는 지식 베이스(KB) 전체를 포함하거나, 후보 입력군을 구성하기 위한 일부의 팩트(Fact)를 포함할 수 있다. 실시 예에 따라, 저장부(110)는 질문 문장에 대한 정답을 제공할 수 있는 통합 계산 모델(Integrated Scoring Model)의 구조와 질문 문장과 이에 대응되는 정답을 학습하기 위한 질문 응답 학습 모델을 저장할 수 있다. The
다양한 실시 예에서 저장부(110)는 각종 데이터, 명령 및 정보를 저장할 수 있는 휘발성 또는 비휘발성 기록 매체를 포함할 수 있다. 예를 들어, 저장부(110)는 플래시 메모리 타입, 하드디스크 타입, 멀티미디어 카드 마이크로 타입, 카드 타입의 메모리(예를 들어 SD 또는 XD 메모리 등), 램, SRAM, 롬, EEPROM, PROM, 네트워크 저장 스토리지, 클라우드 중 적어도 하나의 타입의 저장매체를 포함할 수 있다. 또한, 저장부(110)에는 질문 응답 장치(100)의 동작을 위한 명령어들이 기록되어 있을 수 있다. In various embodiments, the
통신부(120)는 유/무선 통신 네트워크를 이용하여 외부 디바이스(미도시)로부터 질문 문장을 수신하고, 그에 대한 정답을 송신할 수 있다. 여기서, 질문 문장은 자연어로 구성될 수 있으며, 질문 문장에 대한 정답도 역시 자연어로 제공되거나, 지식 베이스(KB) 내 주소를 포함하여 제공될 수 있다. 예를 들어, 통신부(120)는 “Where was Obama born”이라는 질문 문장을 수신하고, “fb:m.87d2z(“Honolulu, Hawaii”)”라는 정답을 송신할 수 잇다.The
프로세서(130)는 저장부(110), 통신부(120)와 동작 가능하게 연결되어, 질문 응답 장치(100)의 전반적인 동작을 제어할 수 있으며, 어느 하나의 질문에 대한 정답을 제공하기 위한 다양한 명령들을 수행할 수 있다. The
이를 위해, 프로세서(130)는 CPU(Central Processing Unit)나 AP(Application Processor)와 같은 연산 장치에 해당할 수 있다. 또한, 프로세서(230)는 다양한 연산 장치가 통합된 SoC(System on Chip)와 같은 통합 칩(Integrated Chip (IC))의 형태로 구현될 수 있다.To this end, the
실시 예에 따라, 프로세서(130)는 질문 문장과 적어도 하나의 엔티티 및 릴레이션을 포함하는 후보 입력군(Candidate fact)을 복수 개 생성하고, 각각을 통합 계산 모델에 입력하여, 정답 스코어를 계산할 수 있다. 프로세서(130)는 후보 입력군 각각의 정답 스코어를 확인하고 이 중 가장 점수가 높은 후보 입력군에 매칭되는 정답을 제공할 수 있다. Depending on the embodiment, the
즉, 프로세서(130)가 후보 입력군 생성 시, 질문 문장과 엔티티, 릴레이션을 하나에 포함시킴에 따라, 통합 계산 모델에서는 두 개의 정보가 상호 반영된 입력 벡터 시퀀스를 획득할 수 있다. 이때, 입력 벡터 시퀀스를 획득하는 인코딩 레이어는 트랜스포머 엔코더(Transformer Encoder), LSTM 및 Bi-LSTM 중 어느 하나의 네트워크 구조를 이용할 수 있으며, 가장 바람직하게는 트랜스포머 엔코더를 사용하여, 정답에 대한 정확도를 높일 수 있다. That is, when the
지금까지 본 발명의 일 실시 예에 통합 계산 모델을 구현하는 따른 질문 응답 장치(100)의 구성에 대해 설명하였으며, 이하 도 3 내지 도 7을 이용하여, 본 발명의 일 실시 예에 따른 질문 응답 장치(100)가 수행하는 지식기반 질문 응답 방법에 대하여 설명하도록 한다.So far, the configuration of the
도 3은 본 발명의 일 실시 예에 따른 지식기반 질문 응답 방법의 개략적인 순서도이고, 도 4는 본 발명의 일 실시 예에 따른 통합 계산 모델의 구성을 나타낸 개략도이다. 3 is a schematic flowchart of a method for answering a knowledge-based question according to an embodiment of the present invention, and FIG. 4 is a schematic diagram showing the configuration of an integrated calculation model according to an embodiment of the present invention.
도 3을 참조하면, 질문 응답 장치(100)는 질문 문장을 수신한다(S110). 실시 예에 따라, 질문 문장은 하나의 정답을 가지는 문장일 수 있다. 예를 들어, 질문 문장은 “Where is the birthplace of Barak Obama?”, “When was Obama born?”과 같이 하나의 정답만을 가지는 문장일 수 있다. 3, the
S110 단계 이후, 질문 응답 장치(100)는 질문 문장과 적어도 하나의 엔티티 및 릴레이션을 포함하는 후보 입력군(Candidate fact)을 복수 개 생성한다(S120). 즉, 하나의 질문 문장에 대해 정답일 것으로 예상되는 다양한 엔티티, 릴레이션 후보들이 존재하므로, 질문 응답 장치(100)는 하나의 질문 문장과 엔티티, 릴레이션을 결합한 후보 입력군을 복수 개 생성할 수 있다. After step S110, the
한편, 후보 입력군에 포함시키는 엔티티의 경우, 질문 응답 장치(100)에 저장된 모든 지식 베이스(KB)의 크기가 크기 때문에, 지식 베이스(KB)에 존재하는 모든 팩트를 탐색하면서, 가장 높은 점수를 가지는 팩트를 선별하는 과정이 지나치게 소모적일 수 있다. On the other hand, in the case of the entity included in the candidate input group, since the size of all the knowledge bases (KB) stored in the
그에 따라, 질문 응답 장치(100)는 지식 베이스(KB) 내 모든 엔티티(팩트)에 질문 문장을 구성하는 단어 단위를 대입하고, 대입된 단어 단위와 일치하는 엔티티가 존재하는 경우, 해당 단어 단위를 엔티티로서 하나의 후보 입력군에 포함시킬 수 있다. Accordingly, the
예를 들어, 질문 응답 장치(100)는 질문 문장 q의 길이 1부터 L까지 모든 단어 단위를 n-gram 모델을 사용하여, 이와 정확하게 일치하는 가명(alias)을 가진 엔티티를 후보 입력군에 포함시킬 수 있다. 만약, 하나의 단어 단위에서 여러 개의 엔티티가 일치하는 경우, 전체 KB 안에서, 엔티티가 주어 역할을 하는 팩트 개수를 내림차순으로 정렬하고, 상위 m개의 엔티티만을 후보 입력군에 포함시킬 수도 있다. For example, the
한편, 후보 입력군은 질문 문장, 엔티티, 릴레이션을 토큰화하고, 이를 순서대로 나열한 것으로서, 후보 입력군을 구성하는 각 속성의 마지막 순서에는 적어도 하나의 특수 토큰이 삽입될 수 있다. 예를 들어, 도 4와 같이 토큰화된 질문 문장 뒤에 점선으로 도시된 두 개의 특수 토큰이 삽입되고, 토큰화된 엔티티와 릴레이션 뒤에 점선으로 도시된 하나의 특수 토큰이 삽입된 것을 확인할 수 있다. 여기서, 특수 토큰은 토큰들의 중요도(어텐션, attention)를 결정하는 요소로서, 문장의 구조와 의도를 파악하여 정답을 추론하는데 도움을 주는 역할을 한다. On the other hand, the candidate input group is a question sentence, entity, and relation tokenized and arranged in order, and at least one special token may be inserted in the last order of each attribute constituting the candidate input group. For example, as shown in FIG. 4, it can be seen that two special tokens shown by dotted lines are inserted after the tokenized question sentence, and one special token shown by dotted lines is inserted after the tokenized entity and relation. Here, the special token is an element that determines the importance (attention) of the tokens, and plays a role of helping to infer the correct answer by grasping the structure and intention of the sentence.
한편, 종래의 질문 응답 모델에서도 하나의 질문 응답을 구성하는 토큰들 중에서 중요한 토큰에 어텐션을 주었으나, 어텐션을 주기까지의 과정이 비효율적이었다. 그러나, 본 발명의 일 실시 예에 따른 질문 응답 모델에서는 어텐션을 주는 특수 토큰의 위치를 도 4와 같이 변경시킴으로써, 질문 응답 모델을 보다 효율적으로 운용할 수 있다. Meanwhile, even in the conventional question-response model, attention was given to an important token among tokens constituting one question response, but the process of giving attention was inefficient. However, in the question response model according to an embodiment of the present invention, by changing the location of a special token giving attention as shown in FIG. 4, the question response model can be more efficiently operated.
도 5a 내지 도 5c는 종래의 질문 응답 모델과 본 발명의 일 실시 예에 따른 통합 계산 모델에서 어텐션을 줄 토큰을 찾아내는 방식을 설명하기 위한 개략도이다.5A to 5C are schematic diagrams illustrating a method of finding a token to be paid attention in a conventional question answering model and an integrated calculation model according to an embodiment of the present invention.
도 5a를 참조하면, 하나의 질문 문장(Question)에 대해 4가지의 릴레이션(Relation)이 존재할 수 있으며, 이 중 정답과 연관성이 높은 릴레이션을 분별하여야 한다. 구체적으로, 정답과 연관성이 높은 릴레이션을 분별하기 위해서는 질문 문장 벡터와 릴레이션 벡터를 연산하는 스코어링(scoring) 방법을 이용해야 하며, 이를 위해서는 질문 문장과 릴레이션의 의미를 포함할 수 있도록, 동일한 길이의 벡터로 압축해서 표현해야 한다. 이때, 질문 문장과 릴레이션을 구성하는 복수의 토큰들 중 보다 중요한 의미를 가지는 토큰에 집중하기 위해 어텐션을 줄 수 있다.Referring to FIG. 5A, four relations may exist for one question sentence, and among them, a relation having a high correlation with the correct answer should be identified. Specifically, in order to discriminate relations that are highly related to the correct answer, a scoring method that calculates the question sentence vector and the relation vector should be used, and for this purpose, a vector of the same length so that the meaning of the question sentence and the relation can be included. It should be compressed with At this time, attention may be given to focus on a token having a more important meaning among a plurality of tokens constituting the question sentence and the relation.
도 5b를 참조하면, 종래의 질문 응답 모델에서는 우선적으로, 후보 릴레이션에 대한 고정된 길이의 벡터를 산출하고(1), 릴레이션 벡터를 질문 문장을 구성하는 각 토큰 별 벡터와 매칭하여 중요도가 높은 토큰(어텐션을 줄 토큰)을 검출하게 된다(2). 여기서, 질문 문장을 구성하는 단어 아래에 표시된 검은 막대 그래프는 릴레이션 벡터와 토큰 별 벡터와의 매칭 정도를 확률 값으로 표현한 것이다. 예를 들어, 어텐션에 대한 학습이 정답에 맞게 이루어질 경우, 도시된 질문 문장에서 “people/person/nationality”릴레이션이 “born”이라는 단어와 가장 연관성이 높은 것으로 나타날 수 있다. 5B, in the conventional question answering model, first, a vector of a fixed length for a candidate relation is calculated (1), and the relation vector is matched with a vector for each token constituting the question sentence, so that tokens of high importance (Token to give attention) is detected (2). Here, the black bar graph displayed under the words constituting the question sentence represents the degree of matching between the relation vector and the vector for each token as a probability value. For example, when learning about attention is performed in accordance with the correct answer, the “people/person/nationality” relationship in the illustrated question sentence may appear to have the highest correlation with the word “born”.
이와 같이, 각 토큰 별로 릴레이션 벡터와의 매칭을 해본 뒤, 가장 높은 확률 값을 가지는 토큰에 많은 가중치를 줄 수 있으며, 이 가중치를 기준으로 질문 문장에 대한 벡터를 얻게 된다(3). In this way, after matching with the relation vector for each token, many weights can be given to the token with the highest probability value, and a vector for the question sentence is obtained based on this weight (3).
상술한 (1)~(3) 과정은 질문 문장과 매칭될 수 있는 4가지의 릴레이션 중 하나의 릴레이션에 대해 어텐션을 주는 방법이었으며, 종래의 질문 응답 모델을 사용할 경우, 릴레이션이 바뀔 때마다 어텐션을 주기 위한 기준이 되는 토큰이 바뀔 수 있으므로, 질문 문장을 구성하는 각 토큰들과의 연산을 개별적으로 수행해야 하는 번거로움이 존재한다. The above-described processes (1) to (3) were a method of giving attention to one of the four relations that can be matched with the question sentence, and when using the conventional question answering model, attention is given whenever the relation changes. Since the token, which is the basis for giving, can be changed, there is a hassle of having to individually perform an operation with each token constituting the question sentence.
즉, 종래의 질문 응답 모델은 질문 문장에서 의미 없는 토큰들에 대한 불필요한 연산을 반복적으로 수행하여, 연산량을 낭비하게 된다.That is, the conventional question answering model repeatedly performs unnecessary operations on meaningless tokens in the question sentence, thereby wasting the amount of computation.
또한, 릴레이션의 경우 질문 문장의 핵심 정보를 담고 있지 않기 때문에, 릴레이션 벡터를 기준으로 각 토큰들과의 연산을 수행할 경우, 단순히 단어 간의 매칭 정도만을 보게 된다. 그에 따라, 릴레이션 벡터가 기준이 된다면, 질문 문장의 구조적인 정보를 알 수 없으며, 만약 질문 문장에서 학습하지 않은 단어나 릴레이션이 나타나게 되면, 종래의 방법으로는 질문 문장에 올바른 어텐션을 줄 수 없다.In addition, since the relation does not contain the core information of the question sentence, when an operation with each token is performed based on the relation vector, only the degree of matching between words is seen. Accordingly, if the relation vector is the reference, structural information of the question sentence cannot be known, and if unlearned words or relations appear in the question sentence, correct attention cannot be given to the question sentence by the conventional method.
이에, 도 5c를 참조하면, 본 발명의 일 실시 예에 따른 통합 계산 모델은 어텐션의 기준을 질문 문장 내에서 자체적으로 찾을 수 있도록 한다. 구체적으로, 질문 응답 장치(100)는 셀프 어텐션을 통해 질문 문장에서 어떠한 단어가 릴레이션을 결정하는데 중요한 역할을 하는지 결정할 수 있다. 즉, 단순히 릴레이션 벡터와 유사한 단어를 검출해내는 것이 아니라, 어떠한 외부 조건 없이 문장 내에서 문장 구조를 파악하여 릴레이션을 결정하는데 중요한 단어가 되는 토큰을 찾을 수 있으며, 이를 학습할 수 있다. Thus, referring to FIG. 5C, the integrated calculation model according to an embodiment of the present invention enables the criteria of attention to be found within the question sentence by itself. Specifically, the
예를 들어, 종래의 질문 응답 모델은 “where was obama born”이라는 질문에서 “people/person/nationality”라는 릴레이션과 유사한 단어가 “born”이기 때문에, “”이라는 단어를 찾도록 어텐션이 학습되었지만, 새로운 통합 계산 모델은 “where was obama~”라는 문장의 구조를 읽고, 릴레이션을 결정하는데 가장 중요한 단어가 동사와 연관이 깊고, 의문형 접속사와 주어가 되는 명사가 순서대로 위치하면 대체로 그 뒤에 동사가 위치한다는 것을 인지하고, “born”에 어텐션을 주도록 학습할 수 있다.For example, in the conventional question answering model, since the word similar to the relation “people/person/nationality” in the question “where was obama born” is “born”, attention is learned to find the word “”. The new integrated calculation model reads the structure of the sentence “where was obama~”, and the most important word for determining the relation is deeply related to the verb, and if the interrogative conjunction and the subject noun are placed in order, the verb is usually placed behind it. Recognizing that they do, they can learn to give attention to “born”.
그에 따라, 본 발명의 일 실시 예에 따른 통합 계산 모델은 질문 문장에 대한 벡터는 한 번의 계산으로 고정시켜 두고, 이와 대응되는 다수의 릴레이션 벡터들을 산출한 후 비교하여, 다수의 릴레이션에 대한 매칭 스코어를 보다 효과적으로 계산할 수 있다. Accordingly, in the integrated calculation model according to an embodiment of the present invention, a vector for a question sentence is fixed in one calculation, and a plurality of relation vectors corresponding thereto are calculated and compared, and a matching score for a plurality of relations Can be calculated more effectively.
z, 종래에 릴레이션 벡터를 먼저 얻은 후, 이를 기준으로 질문 문장의 각 단어들에 대한 어텐션을 계산하였다면, 본 발명의 일 실시 예에서는 질문 문장의 가장 마지막에 “<find_relation>”과 같은 특수 토큰을 추가로 덧붙임으로써, 질문 문장에서 어텐션을 줄 단어를 미리 찾아내고, 질문 문장 전체에 대한 벡터를 산출할 수 있다.Z, if a relation vector was obtained in the prior art, and then attention for each word of the question sentence was calculated based on this, in an embodiment of the present invention, a special token such as “<find_relation>” at the end of the question sentence By additionally adding, it is possible to find a word to give attention in the question sentence in advance and calculate a vector for the entire question sentence.
또한, 상술한 방식은 질문 문장이라는 하나의 속성에 국한되지 않고, 토큰화된 질문 문장에 뒤이어 붙는 다수의 속성에서도 적용될 수 있다. 예를 들어, 토큰화된 질문 문장, 엔티티, 릴레이션의 끝에 특수 토큰을 삽입함으로써, 나열된 토큰들을 구분하고, 각 항목에서 중요한 토큰에 대한 어텐션을 보다 효율적으로 줄 수 있다.In addition, the above-described method is not limited to one attribute of a question sentence, but can be applied to a plurality of attributes following the tokenized question sentence. For example, by inserting a special token at the end of a tokenized question sentence, entity, or relation, it is possible to distinguish listed tokens and give more efficient attention to important tokens in each item.
다시 도 3을 참조하여 설명하도록 한다.It will be described again with reference to FIG. 3.
S120 단계 이후, 질문 응답 장치(100)는 후보 입력군 각각을 통합 계산 모델에 입력하여, 후보 입력군 각각에 대한 정답 스코어(Fact Score)를 계산한다(S130). After step S120, the
즉, 질문 문장 q, m개의 후보 엔티티 집합 Cs={s1, …, sm}, n개의 후보 릴레이션 집합 Cp={p1, …, pn}이 존재할 때, 질문 문장에 가장 적합한 엔티티와 릴레이션을 추론하기 위한 수학식은 하기 [수학식 1]과 같이 표현될 수 있다.That is, the question sentence q, a set of m candidate entities C s ={s 1 ,… , s m }, set of n candidate relations C p ={p 1 ,… When, p n } exists, an equation for inferring an entity and a relation most suitable for a question sentence may be expressed as [Equation 1] below.
여기서, , 는 각각 문장에 가장 적합한 엔티티, 릴레이션을 의미하며, 함수 S는 질문 문장 q와 지식 베이스(KB) 팩트가 주어졌을 때, 이들 간의 점수를 계산하여 반환하는 함수를 의미한다. 본 발명의 일 실시 예에 따른 통합 계산 모델은 함수 인공신경망 네트워크를 기반으로 해당 함수를 구성할 수 있다. here, , Denotes the most appropriate entity and relation for each sentence, and function S denotes a function that calculates and returns a score between question sentences q and knowledge base (KB) facts. The integrated calculation model according to an embodiment of the present invention may configure a corresponding function based on a functional artificial neural network network.
다시 도 4를 참조하면, 정답 스코어를 계산하기 위한 통합 계산 모델의 전체적인 계층 구조가 다음과 같을 수 있다. 통합 계산 모델은 1)인풋 임베딩 레이어, 2)인코딩 레이어, 3)마스크 어텐션 레이어 및 4)스코어 레이어로 구성되며, 1)인풋 임베딩 레이어를 통해 규격화된 후보 입력군은 4)스코어 레이어를 통해 팩트 스코어로 전환되어 출력될 수 있다. Referring back to FIG. 4, the overall hierarchical structure of the integrated calculation model for calculating the correct answer score may be as follows. The integrated calculation model consists of 1) an input embedding layer, 2) an encoding layer, 3) a mask attention layer, and 4) a score layer, and the candidate input group standardized through the 1) input embedding layer is 4) a fact score through the score layer. Can be converted to and output.
도 6은 본 발명의 일 실시 예에 따른 인풋 임베딩 레이어에 들어가는 벡터 조합을 설명하기 위한 개략도이다.6 is a schematic diagram illustrating a vector combination entering an input embedding layer according to an embodiment of the present invention.
도 6을 참조하면, 1)인풋 임베딩 레이어를 통해 후보 입력군을 구성하는 토큰들을 단어 단위(Word), 위치(Position), 속성(Segment)을 기준으로 임베딩하고, 토큰 별로 임베딩된 벡터들을 합할 수 있으며, 합해진 벡터들의 조합을 입력 시퀀스로 할 수 있다.Referring to FIG. 6, 1) tokens constituting a candidate input group are embedded through an input embedding layer based on a word unit (Word), a position (Position), and a property (Segment), and the embedded vectors for each token can be summed. In addition, a combination of the summed vectors can be used as an input sequence.
수식으로 표현하면, 입력 시퀀스에 해당하는 벡터들의 조합은 “embedding x={x1, …, xL}”로 정의할 수 있으며, 이는 하기 [수학식 2]와 같이 단어 단위 임베딩(word embedding ew={ew 1, …, ew L}, 위치 임베딩(position embedding) ep={ep 1, …, ep L}, 속성 임베딩(segment embedding) es={es 1, …, es L}의 합으로 계산될 수 있다.Expressed as an equation, the combination of vectors corresponding to the input sequence is “embedding x={x 1 ,… , x L }”, which can be defined as “word embedding e w ={e w 1 , …, e w L }”, position embedding e p = It can be calculated as the sum of {e p 1 , …, e p L }, segment embedding e s ={e s 1 , …, e s L }.
한편, 질문 응답 장치(100)는 입력 시퀀스를 생성하기 위한 전 단계로, 질문 문장, 엔티티, 릴레이션을 토큰화할 수 있다. 실시 예에 따라, 질문 응답 장치(100)는 질문 문장의 경우, 공백 문자를 기준으로 문장을 쪼개어 단어 단위로 토큰화할 수 있으며, 엔티티의 경우, 엔티티의 alias description을 사용하여 해당 정보를 단어 단위로 토큰화할 수 있다. 또한, 릴레이션의 경우, predicate URI를 릴레이션의 정보로 사용하면서, URI의 구분자(“/”)를 기준으로 나누어진 단어를 토큰화할 수 있다. 여기서, Relation URI의 경우 엔티티와 릴레이션의 관계를 포함하는 단어들로 구성되어 있어, 단어 단위 임베딩에 적합할 수 있다. 아울러, 단어 단위 임베딩은 GloVe embedding 등 공지된 다양한 워드 임베딩 방식을 사용할 수 있다. Meanwhile, the
한편, 도 5a 내지 도 5c를 통해 설명한 바와 같이, 질문 문장, 엔티티, 릴레이션 사이에는 임베딩을 구분하기 위한 분리 토큰(<sep>)을 덧붙여 줄 수 있다. Meanwhile, as described with reference to FIGS. 5A to 5C, a separation token (<sep>) for distinguishing embedding may be added between the question sentence, the entity, and the relation.
실시 예에 따라, 질문 응답 장치(100)는 입력 시퀀스의 토큰들이 질문 문장(Question), 엔티티(Entity), 릴레이션(Relation) 중 어디에 속하는 토큰인지 알 수 있도록 속성 임베딩(segment embedding)을 할 수 있다. 이때, 속성 임베딩의 벡터 크기는 단어 단위 임베딩의 벡터 크기와 동일할 수 있다. Depending on the embodiment, the
아울러, 질문 문장, 엔티티, 릴레이션을 속성 기준으로 임베딩하는 경우, 모두 랜덤 벡터로 초기화되는 학습을 반복하면서, 각각의 속성 정보를 잘 구분할 수 있도록 분포할 수 있다.In addition, in the case of embedding question sentences, entities, and relations based on attributes, each attribute information may be distributed so that each attribute information can be distinguished well while repeating learning initialized with a random vector.
실시 예에 따라, 질문 응답 장치(100)는 입력 시퀀스의 토큰들이 어느 위치에 속하는지 파악할 수 있도록 위치 임베딩(position embedding)할 수 있다. 이때, 위치 임베딩의 벡터 크기는 단어 단위 임베딩, 속성 임베딩의 벡터 크기와 동일할 수 있다.According to an embodiment, the
아울러, 위치 임베딩은 임베딩 매트릭스(embedding matrix)를 랜덤 초기화하고, 학습을 통해 최적 값을 찾을 수 있도록 학습될 수 있다.In addition, position embedding may be learned so that an embedding matrix is randomly initialized and an optimal value is found through learning.
다시, 도 4를 참조하면, 2)인코딩 레이어를 통해 입력 시퀀스(x={x1, …, xL})에서 토큰들의 정보가 상호 반영된 새로운 입력 벡터 시퀀스(z={z1, …, zL})를 획득할 수 있다. Again, referring to FIG. 4, 2) a new input vector sequence in which information of tokens is mutually reflected in an input sequence (x={x 1 , …, x L }) through an encoding layer (z={z 1 , …, z L }) can be obtained.
실시 예에 따라, 인코딩 레이어는 트랜스포머 엔코더(Transformer Encoder), LSTM 및 Bi-LSTM 중 어느 하나의 네트워크 구조가 적용될 수 있으며, 바람직하게는 트랜스포머 엔코더를 기반으로 중요한 정보들을 효과적으로 선택한 후, 새로운 입력 시퀀스를 출력할 수 있다.Depending on the embodiment, the encoding layer may have a network structure of any one of a transformer encoder, LSTM, and Bi-LSTM, and preferably, after effectively selecting important information based on a transformer encoder, a new input sequence is selected. Can be printed.
3)마스크 어텐션 레이어를 통해 새로운 입력 시퀀스에 속성 별로 마스크를 씌워 질문 문장 벡터(rq1)(rq2), 엔티티 벡터(rs), 릴레이션 벡터(rp)를 계산할 수 있다. 이 과정에서 앞서 토큰들의 속성을 구분하기 위해 삽입되었던 어텐션 토큰이 이용될 수 있다.3) Mask A question sentence vector (r q1 ) (r q2 ), an entity vector (r s ), and a relation vector (r p ) can be calculated by applying a mask for each attribute to a new input sequence through the attention layer. In this process, the attention token that was previously inserted to distinguish the properties of the tokens may be used.
구체적으로, 질문 응답 장치(100)는 마스크 어텐션 레이어에서 어텐션 토큰을 사용하여, 입력 시퀀스에 존재하는 토큰들의 얼라인먼트(alignment)를 구하고, 질문 문장, 엔티티, 릴레이션에 대한 정보들을 고정된 길이를 가지는 하나의 벡터(rq1)(rq2)(rs)(rp)로 압축시킬 수 있다. 여기서, 질문 문장에 대한 벡터는 두 개의 어텐션 토큰을 이용한 결과이며, 이는 각각 엔티티 벡터와 릴레이션 벡터 간 연산에서 사용될 수 있다.Specifically, the
이때, 본 발명의 일 실시 예에 따른 통합 계산 모델에서 마스크 어텐션 레이어는 소프트맥스(softmax) 함수를 적용하여 각 토큰의 가중치를 계산하기 전에, 어느 하나의 속성에 초점을 맞추기 위해 다른 두 개의 속성에 마스크를 씌워 가려줄 수 있다.In this case, in the integrated calculation model according to an embodiment of the present invention, before the mask attention layer calculates the weight of each token by applying a softmax function, two other attributes are selected to focus on one attribute. You can cover it with a mask.
도 7은 본 발명의 일 실시 예에 따른 질문 응답 방법에서 마스크 어텐션 레이어를 사용하는 모습을 예시적으로 나타낸 개략도이다.7 is a schematic diagram illustrating an example of using a mask attention layer in a question answering method according to an embodiment of the present invention.
도 7을 참조하면, 엔티티 벡터를 생성하고자 할 때, 입력 시퀀스에 포함된 모든 토큰들 중에서 엔티티 속성이 아닌 다른 속성들에 대해서는 마스크를 적용(점선 도시)하여 다른 속성으로 어텐션이 가지 않도록 할 수 있으며, 다른 속성에 대한 벡터를 계산할 때도 이와 동일한 방법을 적용할 수 있다. 여기서, 속성들에 대한 구분은 특수 토큰이 삽입된 위치를 이용할 수 있다.Referring to FIG. 7, when creating an entity vector, a mask may be applied to attributes other than entity attributes among all tokens included in the input sequence (dotted lines shown) to prevent attention from other attributes. In addition, the same method can be applied when calculating vectors for other properties. Here, for the classification of attributes, a position in which a special token is inserted may be used.
상술한 방법을 적용하였을 때, 엔티티에 대한 속성 마스크(Masks)는 [수학식 3]과 같이 표현될 수 있다.When the above-described method is applied, the attribute mask (Mask s ) for the entity may be expressed as [Equation 3].
segzi는 zi가 질문 문장에서 어떠한 속성에 속하는지 명시한다. 이에, segzi ∈ {question, entity, relation}으로 정의될 수 있으며, 속성 마스크를 통해 해당 속성이 아닌 다른 속성에 대해서는 음의 무한대 값을 가지도록 함으로써, 이후 소프트맥스 함수를 적용할 시에 해당 토큰의 가중치가 0으로 수렴하도록 할 수 있다. seg zi specifies which attribute z i belongs to in the question sentence. Therefore, it can be defined as seg zi ∈ {question, entity, relation}, and the corresponding token when applying the Softmax function later by making the attribute other than the corresponding attribute have a negative infinity value through the attribute mask. The weight of can be made to converge to zero.
이와 같이, 속성 마스크를 통해 질문 문장, 엔티티, 릴레이션을 모두 이어서 입력 시퀀스로 이용하더라도 질문 문장, 엔티티, 릴레이션에 대한 서로 다른 벡터를 한 번에 얻을 수 있다. In this way, even if the question sentence, entity, and relation are all successively used as an input sequence through the attribute mask, different vectors for the question sentence, entity, and relation can be obtained at once.
또한, 마스크 어텐션 레이어에서는 속성마다 각각 다른 파라미터를 가지는 얼라인먼트 함수(alignment function)을 적용하여, 자신의 속성에서 중요한 내용이 무엇인지 스스로 판단하도록 할 수 있다.In addition, in the mask attention layer, an alignment function having different parameters for each attribute may be applied, so that an important content may be determined by itself.
실제로 학습이 진행되는 동안, 본 발명의 일 실시 예에 따른 통합 계산 모델은 입력 시퀀스 내에서 중요한 단어가 무엇인지 스스로 파악하고, 중요한 단어의 벡터에 더 높은 가중치를 두어 많은 정보를 가져올 수 있다. 이러한 경우, 일률적인 형태로 각각의 속성에 대한 벡터를 만드는 것이 아니기 때문에, 입력 시퀀스를 벡터로 압축하는 과정에서 중요한 정보들이 손실되는 위험을 막을 수 있다.While learning is actually in progress, the integrated calculation model according to an embodiment of the present invention can self-identify what is an important word in an input sequence, and place a higher weight on a vector of an important word to obtain a lot of information. In this case, since a vector for each attribute is not created in a uniform form, it is possible to prevent the risk of losing important information in the process of compressing the input sequence into a vector.
다시, 4를 참조하면, 4)스코어 레이어를 통해 3)마스크 어텐션 레어에어서 계산한 질문 문장 벡터(rq1)(rq2), 엔티티 벡터(rs), 릴레이션 벡터(rp)를 이용하여 정답 스코어를 계산할 수 있다. 여기서, 스코어는 스칼라 값으로써, 두 벡터간의 유사도를 표현하는 값일 수 있다. Again, referring to 4, 4) through a score layer, 3) a question sentence vector (r q1 ) (r q2 ), an entity vector (r s ), and a relation vector (r p ) calculated from the mask attention layer. You can calculate the correct answer score. Here, the score is a scalar value, and may be a value representing the degree of similarity between two vectors.
구체적으로, 질문 응답 장치(100)는 질문 문장 벡터(rq1)와 엔티티 벡터(rs) 이용하여 엔티티 매칭 스코어를 계산하고, 질문 문장 벡터(rq2)와 릴레이션 벡터(rp)를 이용하여 릴레이션 매칭 스코어를 계산할 수 있다. 여기서, 매칭 스코어의 계산은 벡터 내적으로, 하기 [수학식 4], [수학식 5]와 같이 표현될 수 있다.Specifically, the
아울러, 질문 응답 장치(100)는 두 가지의 매칭 스코어(엔티티 매칭 스코어, 릴레이션 매칭 스코어)에 학습된 파라미터를 적용하여, 최종 정답 스코어를 계산할 수 있다. 이는 곧 하기 [수학식 6]과 같이 표현될 수 있다.In addition, the
다시 도 3을 참조하면, S130 단계 이후, 질문 응답 장치(100)는 계산된 정답 스코어 중 가장 높은 값을 가지는 정답 스코어와 매칭되는 정답을 제공한다. 구체적으로, 도 5 내지 도 7을 참조하여 설명한 정답 스코어 계산 방법은 하나의 후보 입력군을 기준으로 한 것이며, 질문 응답 장치(100)는 S120 단계에서 생성한 후보 입력군의 개수에 따라 각각의 후보 입력군에 대한 정답 스코어를 계산할 수 있다. Referring back to FIG. 3, after step S130, the
그에 따라, 가장 높은 값을 가진다는 것은 해당 후보 입력군에 포함된 엔티티, 릴레이션이 질문 문장에 대한 정답과 가장 근접한 정보인 것으로 이해될 수 있으며, 질문 응답 장치(100)는 정답 스코어를 통해 최종적으로 질문 문장에 대한 정답을 출력할 수 있다. Accordingly, it can be understood that having the highest value means that the entity and relation included in the corresponding candidate input group are information closest to the correct answer to the question sentence, and the
지금까지 본 발명의 일 실시 예에 따른 질문 응답 장치(100)가 수행하는 지식기반 질문 응답 방법에 대하여 설명하였다. 본 발명에 따르면, 엔티티와 릴레이션을 동일한 네트워크 안에서 추론하여, 질문 문장에 대한 정답을 보다 정확하게 추론할 수 있다. 뿐만 아니라, 질문 문장과 엔티티, 릴레이션을 포함하는 후보 입력군에서 각 항목들 사이에 특수 토큰을 포함시킴으로써, 모든 위치의 정보들이 효율적으로 집약될 수 있다.So far, a knowledge-based question answering method performed by the
한편, 상술한 질문 응답 모델의 성능을 검증하기 위해, 종래 엔드투엔드(end-to-end) 방식의 질문 응답 모델과 본 발명의 일 실시 예에 따른 엔드투엔드 방식의 통합 계산 모델을 적용시킨 질문 응답 모델을 이용하여 질문 문장에 대한 정답 정확도 검사를 수행하였으며, 이를 위한 실험 환경 및 파라미터 조건은 하기 [표 1], [표 2]와 같다.Meanwhile, in order to verify the performance of the above-described question-response model, a conventional end-to-end question-response model and an end-to-end integrated calculation model according to an embodiment of the present invention are applied. The accuracy test of the correct answer to the question sentence was performed using the question response model, and the experimental environment and parameter conditions for this are shown in [Table 1] and [Table 2].
상기 실험 환경 및 조건에 따라 질문 문장을 입력으로 주었을 때 반환하는 엔티티와 릴레이션의 정확도를 각 모델 별로 계산하였으며, 엔티티와 릴레이션이 모두 일치하는 경우에만 정답으로 인정하였다. 그에 따라, 엔드투엔드 방식의 지식기반 질문 응답 모델들의 성능이 하기 [표 3]과 같이 나타남을 확인할 수 있다.According to the experimental environment and conditions, the accuracy of the entity and relation returned when the question sentence was input as an input was calculated for each model, and the correct answer was recognized only when both entities and relations matched. Accordingly, it can be seen that the performance of the end-to-end knowledge-based question-response models is shown in [Table 3].
즉, 본 발명의 일 실시 예에 따른 지식기반 질문 응답 모델(통합 계산 모델)은 현존하는 엔드투엔드 방식의 모델들 보다 좋은 성능을 가지고 있다. That is, the knowledge-based question response model (integrated calculation model) according to an embodiment of the present invention has better performance than existing end-to-end models.
한편, 질문 응답 장치(100)는 하나의 질문에 대한 정답을 도출해낸 이후에 이를 학습하여 통합 계산 모델을 지속적으로 업데이트할 수 있다. Meanwhile, the
일반적으로, KB-QA 모델에서는 정답에 대한 학습을 하기 위해 하기 [수학식 7]로 표현되는 손실 함수(Loss Function)을 적용한다. In general, in the KB-QA model, a loss function expressed by the following [Equation 7] is applied to learn about the correct answer.
여기서, D는 학습 데이터 셋, 함수 f는 스코어링 함수, q는 질문 문장, 는 주어진 q에 대한 포지티브 샘플(positive sample)이며, 는 주어진 q에 대한 네거티브 샘플(negative sample)이다. Where D is the training data set, function f is the scoring function, q is the question sentence, Is a positive sample for a given q, Is the negative sample for a given q.
종래의 KB-QA 모델의 학습은 하나의 포지티브 샘플에 대해서 다수의 네거티브 샘플을 임의로 생성하여, 두 개의 샘플 사이의 거리를 극대화하는 방향으로 이루어졌으나, 오버 피팅(overfitting) 문제가 발생할 수 있다.In the conventional KB-QA model learning, a number of negative samples are randomly generated for one positive sample, and the distance between the two samples is maximized, but an overfitting problem may occur.
그에 따라, 본 발명의 일 실시 예에 따른 질문 응답 장치(100)는 로지스틱 손실(logistic loss)을 최소화하는 방향으로 학습 모델을 변형할 수 있다. 예를 들어, 질문 응답 장치(100)는 포지티브 샘플에 대해서는 높은 점수를 갖도록 하고, 네거티브 샘플에 대해서는 낮은 스코어를 갖도록 학습 모델을 변형할 수 있으며, 이는 하기 [수학식 8]로 표현될 수 있다.Accordingly, the
여기서, q는 질문 문장, t는 q에 대한 positive, negative sample이고, 함수 f는 입력 값의 스코어를 반환하는 스코어링 함수이며, l은 포지티브 샘플에 대해서 1, 네거티브 샘플에 대해서 -1 값을 가지는 라벨이다. Here, q is a question sentence, t is a positive and negative sample for q, a function f is a scoring function that returns a score of an input value, and l is a label having a value of 1 for positive samples and -1 for negative samples. to be.
실시 예에 따라, 질문 응답 장치(100)는 하나의 질문 문장에서 하나의 포지티브 샘플과 두 개의 네거티브 샘플을 만들 수 있다. 구체적으로, 질문 응답 장치(100)는 질문 문장의 정답에 해당하지 않은 후보 입력군 중 어느 하나의 후보 입력군에서 엔티티를 손상시킨 제1 네거티브 샘플, 릴레이션을 손상시킨 제2 네거티브 샘플을 두 개를 생성할 수 있으며, 질문 문장에 대응되는 모든 샘플들을 상기 [수학식 8]에 대입하여 질문 문장과 정답을 학습할 수 있다.According to an embodiment, the
다시 말해서, 질문 응답 장치(100)는 질문 문장의 정답에 해당하는 후보 입력군을 포지티브 샘플로 설정하고, 포지티브 샘플, 상기 제1 및 제2 네거티브 샘플을 이용하여 질문 문장과 정답을 학습할 수 있다.In other words, the
만약, 전체 지식 베이스(KB)에서 질문 문장에 대한 정답과 관련된 팩트를 제외하고 네거티브 샘플을 만들기 위한 후보 입력군이 존재하지 않는 경우에는 전체 지식 베이스 세트를 임의로 샘플링할 수 있다. If, in the entire knowledge base (KB), there is no candidate input group for making a negative sample except for a fact related to a correct answer to a question sentence, the entire knowledge base set may be randomly sampled.
이와 같이, 질문 응답 장치(100)는 통합 계산 모델을 학습하기 위해, 추론하는 과정과 동일한 방식으로 후보 입력군을 생성함으로써, 학습에 유용한 네거티브 샘플을 획득할 수 있고, 한 번의 학습으로 보다 향상된 통합 계산 모델을 얻을 수 있다. As described above, in order to learn the integrated calculation model, the
이하에서는 앞서 언급한 본 발명의 일 실시 예에 따른 통합 계산 모델의 효과를 검증하기 위해 모델의 변형을 주어 테스트를 진행하고, 그 비교 결과를 정리한다. Hereinafter, in order to verify the effect of the integrated calculation model according to an embodiment of the present invention, a test is performed by modifying the model, and the comparison result is summarized.
도 8은 본 발명의 일 실시 예에 따른 통합 계산 모델과 변형을 준 모델들의 성능 평과 결과 그래프이고, 도 9a는 본 발명의 일 실시 예에 따른 통합 계산 모델에서 마스크 어텐션 레이어를 제거한 구성을 나타낸 개략도이며, 도 9b는 본 발명의 일 실시 예에 따른 통합 계산 모델에서 엔티티와 릴레이션을 다시 분리시킨 구성을 나타낸 개략도이다.8 is a performance evaluation result graph of an integrated calculation model and a modified model according to an embodiment of the present invention, and FIG. 9A is a schematic diagram showing a configuration in which a mask attention layer is removed from the integrated calculation model according to an embodiment of the present invention 9B is a schematic diagram showing a configuration in which entities and relations are separated again in an integrated calculation model according to an embodiment of the present invention.
도 8을 참조하면, 제1 실시 예는 엔티티와 릴레이션이 하나로 합쳐진 상태에서, 인코딩 레이어에 트랜스포머 엔코더 네트워크 구조를 적용시킨 예에서 가장 높은 정확도를 가지는 것을 확인할 수 있다.Referring to FIG. 8, it can be seen that the first embodiment has the highest accuracy in an example in which a transformer encoder network structure is applied to an encoding layer in a state in which entities and relations are combined into one.
도 9a 및 도 9b에 도시된 모델은 각각 제1 비교 예, 제2 실시 예에 해당하며, 도 8에 도시되어 있는 제1 실시 예~제4 실시 예들과 제1 비교 예~제4 비교 예들에 대응되는 통합 계산 모델은 [표 4]와 같다.The models shown in FIGS. 9A and 9B correspond to the first comparative example and the second example, respectively, and the first to fourth examples and the first to fourth comparative examples shown in FIG. The corresponding integrated calculation model is shown in [Table 4].
즉, 트랜스포머를 사용한 모델이 Bi-LSTM을 사용한 모델 보다 5~7% 정도 높은 정확도를 보이고 있으며, 엔티티와 릴레이션을 따로 추론하는 모델은 그렇지 않은 모델보다 6~10% 정도 낮은 성능을 보이는 것을 확인할 수 있다.In other words, it can be seen that the model using the transformer shows 5 to 7% higher accuracy than the model using Bi-LSTM, and the model that infers entities and relations separately shows 6 to 10% lower performance than the model that does not. have.
또한, 학습 초반에는 트랜스포머 엔코더를 이용하는 모델과 RNN 기반의 모델을 이용하는데 있어, 정확도 차이가 크게 벌어지는데, 트랜스포머 엔코더를 이용하는 모델이 20 epoch 근처에서 수렴 포인트에 도달하는 반면, Bi-LSTM을 사용한 모델들은 70 epoch에 이르러서야 수렴하고 있다. In addition, at the beginning of training, the difference in accuracy between the model using the transformer encoder and the model based on RNN widens. While the model using the transformer encoder reaches the convergence point around 20 epoch, the model using Bi-LSTM It is converging only at the 70 epoch.
LSTM을 사용한 모델들은 엔티티와 릴레이션의 분리 변화를 주어도 accuracy graph의 형태가 비슷한 형태를 띄고 있다. 즉, 최종적인 정확도에서만 차이가 존재하며, 학습을 하는 양상에는 큰 변화를 주지 못한다. 그러나 트랜스포머 엔코더 모델은 엔티티와 릴레이션을 합칠 경우, 보다 빠르게 수렴 포인트에 도달하고, 엔티티와 릴레이션을 분리하는 경우, 학습 초기에 일정 수준까지 빠르게 학습은 가능하지만, 그 정확도가 떨어져 더 복잡한 문제를 학습하지 못하는 것으로 해석될 수 있다. Models using LSTM have a similar shape of the accuracy graph even when the separation of entity and relation is given. In other words, there is a difference only in the final accuracy, and it does not make a big change in the learning pattern. However, the transformer encoder model reaches the convergence point faster when the entity and the relation are combined, and when the entity and the relation are separated, it is possible to quickly learn to a certain level at the beginning of learning, but its accuracy is low, so it does not learn more complex problems. It can be interpreted as being unable to.
도 10a 및 도 10b는 본 발명의 일 실시 예에 따른 질문 응답 방법을 통해 각 토큰들에 주어진 어텐션의 분포를 설명하기 위한 개략도이다.10A and 10B are schematic diagrams for explaining distribution of attention given to tokens through a question answering method according to an embodiment of the present invention.
도 10a 및 10b를 참조하면, 본 발명의 일 실시 예에 따른 질문 응답 방법을 통해 어느 하나의 질문 문장에 대한 정답이라고 추론된 후보 입력군에 대해 각 토큰 별로 어텐션이 다음과 같이 분포됨을 확인할 수 있다. 10A and 10B, it can be seen that attention is distributed for each token for a candidate input group inferred as the correct answer to any one question sentence through the question answering method according to an embodiment of the present invention. .
여기서, y축은 시퀀스의 토큰들을 나타내며, 토큰의 밝기가 밝을수록 더 많은 어텐션이 주어졌으며, 더 많은 가중치를 가지고 있음을 나타낸다. Here, the y-axis represents the tokens of the sequence, and the brighter the token, the more attention is given and the more weight it has.
질문 1(Question 1, 엔티티와의 매칭)과 질문 2(Question 2, 릴레이션과의 매칭)를 보면 동일한 문장에 대해서도 서로 다른 어텐션 분포를 보이고 있지만, 엔티티와의 매칭을 보는 어텐션임에도 릴레이션을 분별하는데 도움이 되는 토큰에 어느 정도의 가중치가 들어간 것을 확인할 수 있다. If you look at Question 1 (Question 1, matching with an entity) and Question 2 (
즉, 본 발명의 일 실시 예에 따른 질문 응답 방법을 통해서 엔티티와 릴레이션을 동시에 추론하는 과정에서, 엔티티와 릴레이션이 서로 간에 영향을 줄 수 있으며, 그에 따라 질문 문장에 대한 보다 정확한 답변을 제공할 수 있다. That is, in the process of inferring an entity and a relation at the same time through the question answering method according to an embodiment of the present invention, the entity and the relation may influence each other, and accordingly, a more accurate answer to the question sentence can be provided. have.
이상 첨부된 도면을 참조하여 본 발명의 일 실시 예들을 더욱 상세하게 설명하였으나, 본 발명은 반드시 이러한 실시 예로 국한되는 것은 아니고, 본 발명의 기술사상을 벗어나지 않는 범위 내에서 다양하게 변형 실시될 수 있다. 따라서, 본 발명에 개시된 실시 예들은 본 발명의 기술 사상을 한정하기 위한 것이 아니라 설명하기 위한 것이고, 이러한 실시 예에 의하여 본 발명의 기술 사상의 범위가 한정되는 것은 아니다. 그러므로, 이상에서 기술한 실시 예들은 모든 면에서 예시적인 것이며 한정적이 아닌 것으로 이해해야만 한다. 본 발명의 보호 범위는 아래의 청구범위에 의하여 해석되어야 하며, 그와 동등한 범위 내에 있는 모든 기술 사상은 본 발명의 권리범위에 포함되는 것으로 해석되어야 할 것이다.Although the exemplary embodiments of the present invention have been described in more detail with reference to the accompanying drawings, the present invention is not necessarily limited to these embodiments, and various modifications may be made without departing from the spirit of the present invention. . Accordingly, the embodiments disclosed in the present invention are not intended to limit the technical idea of the present invention, but to explain the technical idea, and the scope of the technical idea of the present invention is not limited by these embodiments. Therefore, it should be understood that the embodiments described above are illustrative and non-limiting in all respects. The scope of protection of the present invention should be interpreted by the following claims, and all technical ideas within the scope equivalent thereto should be interpreted as being included in the scope of the present invention.
100: 지식기반 질문 응답 장치
110: 저장부
120: 통신부
130: 프로세서100: knowledge-based question response device
110: storage unit
120: communication department
130: processor
Claims (16)
질문 문장을 수신하는 단계;
상기 질문 문장과 적어도 하나의 엔티티(entity) 및 릴레이션(relation)을 포함하는 후보 입력군(Candidate fact)을 복수 개 생성하는 단계;
상기 후보 입력군 각각을 통합 계산 모델(Integrated Scoring Model)에 입력하여, 상기 후보 입력군 각각에 대한 정답 스코어(Fact Score)를 계산하는 단계; 및
계산된 정답 스코어 중 가장 높은 값을 가지는 정답 스코어와 매칭되는 정답을 제공하는 단계; 를 포함하되,
상기 통합 계산 모델은, 상기 후보 입력군을 구성하는 토큰화된 요소들의 정보가 상호 반영된 입력 벡터 시퀀스를 이용하는, 지식기반 질문 응답 방법.In the knowledge-based question answering method implemented by a processor,
Receiving a question sentence;
Generating a plurality of candidate input groups including the question sentence and at least one entity and a relationship;
Inputting each of the candidate input groups into an integrated scoring model to calculate a Fact Score for each of the candidate input groups; And
Providing a correct answer matching the correct answer score having the highest value among the calculated correct answer scores; Including,
The integrated calculation model uses an input vector sequence in which information on tokenized elements constituting the candidate input group is mutually reflected.
상기 통합 계산 모델은,
상기 후보 입력군을 구성하는 토큰들의 단어 단위, 위치, 속성을 기준으로 임베딩된 벡터들의 조합을 입력 시퀀스로 하는 인풋 임베딩 레이어,
상기 입력 벡터 시퀀스를 획득하는 인코딩 레이어,
상기 입력 벡터 시퀀스에서 속성 별로 마스크를 씌워 질문 문장 벡터(rq1)(rq2), 엔티티 벡터(rs), 릴레이션 벡터(rp)를 계산하는 마스크 어텐션 레이어, 와
상기 질문 문장 벡터, 상기 엔티티 벡터 및 상기 릴레이션 벡터를 이용하여 상기 정답 스코어를 계산하는 스코어 레이어, 를 포함하는 지식기반 질문 응답 방법.The method of claim 1,
The integrated calculation model,
An input embedding layer having a combination of vectors embedded based on word units, positions, and attributes of tokens constituting the candidate input group as an input sequence,
An encoding layer that obtains the input vector sequence,
A mask attention layer for calculating a question sentence vector (r q1 ) (r q2 ), an entity vector (r s ), and a relation vector (r p ) by masking each attribute in the input vector sequence, and
And a score layer for calculating the correct answer score using the question sentence vector, the entity vector, and the relation vector.
상기 후보 입력군은,
상기 토큰화된 질문 문장, 엔티티, 릴레이션에서 각 속성의 마지막 순서에 적어도 하나의 특수 토큰이 삽입되는, 지식기반 질문 응답 방법.The method of claim 2,
The candidate input group,
At least one special token is inserted in the last order of each attribute in the tokenized question sentence, entity, and relation.
상기 마스크 어텐션 레이어는,
상기 특수 토큰이 삽입된 위치를 기준으로 상기 복수의 토큰들 각각의 속성 별로 마스크를 씌우고, 상기 질문 문장, 상기 엔티티 및 상기 릴레이션을 고정된 길이의 벡터로 계산하는, 지식기반 질문 응답 방법.The method of claim 3,
The mask attention layer,
A method for answering a knowledge-based question, wherein a mask is applied for each attribute of the plurality of tokens based on the position where the special token is inserted, and the question sentence, the entity, and the relation are calculated as a vector of a fixed length.
상기 스코어 레이어는,
상기 질문 문장 벡터와 상기 엔티티 벡터 이용하여 엔티티 매칭 스코어를 계산하고, 상기 질문 문장 벡터와 릴레이션 벡터를 이용하여 릴레이션 매칭 스코어를 계산하며, 상기 엔티티 매칭 스코어와 상기 릴레이션 매칭 스코어에 학습된 파라미터를 적용하여, 상기 정답 스코어를 계산하는, 지식기반 질문 응답 방법.The method of claim 3,
The score layer,
Calculate an entity matching score using the question sentence vector and the entity vector, calculate a relation matching score using the question sentence vector and the relation vector, and apply learned parameters to the entity matching score and the relation matching score. , To calculate the correct answer score, a knowledge-based question answering method.
상기 인코딩 레이어는,
트랜스포머 엔코더(Transformer Encoder), LSTM 및 Bi-LSTM 중 어느 하나의 네트워크 구조가 적용된, 지식기반 질문 응답 방법.The method of claim 2,
The encoding layer,
A knowledge-based question answering method to which any one of a transformer encoder, LSTM, and Bi-LSTM is applied.
상기 엔티티는,
지식 베이스(Knowledge Base, KB) 내 모든 엔티티에 상기 질문 문장을 구성하는 단어 단위를 대입하고,
대입된 단어 단위와 일치하는 엔티티가 존재하는 경우,
해당 단어 단위를 엔티티로서 하나의 후보 입력군에 포함시키는, 지식기반 질문 응답 방법.The method of claim 1,
The entity,
Substitute the unit of words constituting the question sentence to all entities in the Knowledge Base (KB),
If there is an entity matching the assigned word unit,
A knowledge-based question answering method in which the word unit is included as an entity in one candidate input group.
상기 제공하는 단계 이후에,
상기 질문 문장의 정답에 해당하지 않은 후보 입력군 중 어느 하나의 후보 입력군에서 엔티티를 손상시킨 제1 네거티브 샘플, 릴레이션을 손상시킨 제2 네거티브 샘플을 생성하는 단계, 와
상기 질문 문장의 정답에 해당하는 후보 입력군을 포지티브 샘플로 설정하고, 상기 포지티브 샘플, 상기 제1 및 제2 네거티브 샘플을 하기 [수학식 1]에 대입하여, 상기 질문 문장과 상기 정답을 학습하는 단계, 를 더 포함하는 지식기반 질문 응답 방법.
[수학식 1]
여기서, 주어진 function은 scroing function, q는 질문 문장, t는 q에 대한 positive, negative sample임.The method of claim 1,
After the providing step,
Generating a first negative sample in which the entity is damaged and a second negative sample in which the relation is damaged in any one of the candidate input groups that do not correspond to the correct answer of the question sentence, and
Setting a candidate input group corresponding to the correct answer of the question sentence as a positive sample, and substituting the positive sample and the first and second negative samples into the following [Equation 1] to learn the question sentence and the correct answer Step, Knowledge-based question answering method further comprising.
[Equation 1]
Here, the given function is a scroing function, q is a question sentence, and t is a positive and negative sample for q.
통신부; 및
상기 저장부, 상기 통신부와 동작 가능하게 연결된 프로세서를 포함하되,
상기 프로세서는,
질문 문장을 수신하고,
상기 질문 문장과 적어도 하나의 엔티티(entity) 및 릴레이션(relation)을 포함하는 후보 입력군(Candidate fact)을 복수 개 생성하며,
상기 후보 입력군 각각을 통합 계산 모델(Integrated Scoring Model)에 입력하여, 상기 후보 입력군 각각에 대한 정답 스코어(Fact Score)를 계산하고,
계산된 정답 스코어 중 가장 높은 값을 가지는 정답 스코어와 매칭되는 정답을 제공하되,
상기 통합 계산 모델은, 상기 후보 입력군을 구성하는 토큰화된 요소들의 정보가 상호 반영된 입력 벡터 시퀀스를 이용하는, 지식기반 질문 응답 장치.Storage;
Communication department; And
And a processor operably connected to the storage unit and the communication unit,
The processor,
Receive the question sentence,
Generating a plurality of candidate input groups (Candidate fact) including the question sentence and at least one entity (entity) and a relation (relation),
By inputting each of the candidate input groups into an integrated scoring model, a Fact Score for each of the candidate input groups is calculated,
Provide the correct answer matching the correct answer score with the highest value among the calculated correct answer scores,
The integrated calculation model uses an input vector sequence in which information on tokenized elements constituting the candidate input group is mutually reflected.
상기 통합 계산 모델은,
상기 후보 입력군을 구성하는 토큰들의 단어 단위, 위치, 속성을 기준으로 임베딩된 벡터들의 조합을 입력 시퀀스로 하는 인풋 임베딩 레이어,
상기 입력 벡터 시퀀스를 획득하는 인코딩 레이어,
상기 입력 벡터 시퀀스에서 속성 별로 마스크를 씌워 질문 문장 벡터(rq1)(rq2), 엔티티 벡터(rs), 릴레이션 벡터(rp)를 계산하는 마스크 어텐션 레이어, 와
상기 질문 문장 벡터, 상기 엔티티 벡터 및 상기 릴레이션 벡터를 이용하여 상기 정답 스코어를 계산하는 스코어 레이어, 를 포함하는 지식기반 질문 응답 장치.The method of claim 9,
The integrated calculation model,
An input embedding layer having a combination of vectors embedded based on word units, positions, and attributes of tokens constituting the candidate input group as an input sequence,
An encoding layer that obtains the input vector sequence,
A mask attention layer for calculating a question sentence vector (r q1 ) (r q2 ), an entity vector (r s ), and a relation vector (r p ) by masking each attribute in the input vector sequence, and
And a score layer for calculating the correct answer score using the question sentence vector, the entity vector, and the relation vector.
상기 후보 입력군은,
상기 토큰화된 질문 문장, 엔티티, 릴레이션에서 각 속성의 마지막 순서에 적어도 하나의 특수 토큰이 삽입되는, 지식기반 질문 응답 장치.The method of claim 10,
The candidate input group,
At least one special token is inserted in the last order of each attribute in the tokenized question sentence, entity, and relation.
상기 마스크 어텐션 레이어는,
상기 특수 토큰이 삽입된 위치를 기준으로 상기 복수의 토큰들 각각의 속성 별로 마스크를 씌우고, 상기 질문 문장, 상기 엔티티 및 상기 릴레이션을 고정된 길이의 벡터로 계산하는, 지식기반 질문 응답 장치.The method of claim 11,
The mask attention layer,
A knowledge-based question answering apparatus that applies a mask for each attribute of each of the plurality of tokens based on the position where the special token is inserted, and calculates the question sentence, the entity, and the relation as a vector of a fixed length.
상기 스코어 레이어는,
상기 질문 문장 벡터와 상기 엔티티 벡터 이용하여 엔티티 매칭 스코어를 계산하고, 상기 질문 문장 벡터와 릴레이션 벡터를 이용하여 릴레이션 매칭 스코어를 계산하며, 상기 엔티티 매칭 스코어와 상기 릴레이션 매칭 스코어에 학습된 파라미터를 적용하여, 상기 정답 스코어를 계산하는, 지식기반 질문 응답 장치.The method of claim 11,
The score layer,
Calculate an entity matching score using the question sentence vector and the entity vector, calculate a relation matching score using the question sentence vector and the relation vector, and apply learned parameters to the entity matching score and the relation matching score. , A knowledge-based question response device for calculating the correct answer score.
상기 인코딩 레이어는,
트랜스포머 엔코더(Transformer Encoder), LSTM 및 Bi-LSTM 중 어느 하나의 네트워크 구조가 적용된, 지식기반 질문 응답 장치.The method of claim 10,
The encoding layer,
A knowledge-based question answering device to which any one of a transformer encoder, LSTM and Bi-LSTM network structure is applied.
상기 엔티티는,
지식 베이스(Knowledge Base, KB) 내 모든 엔티티에 상기 질문 문장을 구성하는 단어 단위를 대입하고,
대입된 단어 단위와 일치하는 엔티티가 존재하는 경우,
해당 단어 단위를 엔티티로서 하나의 후보 입력군에 포함시키는, 지식기반 질문 응답 장치.The method of claim 9,
The entity,
Substitute the unit of words constituting the question sentence to all entities in the Knowledge Base (KB),
If there is an entity matching the assigned word unit,
A knowledge-based question answering device that includes the word unit as an entity in one candidate input group.
상기 프로세서는,
정답을 제공한 이후에,
상기 질문 문장의 정답에 해당하지 않은 후보 입력군 중 어느 하나의 후보 입력군에서 엔티티를 손상시킨 제1 네거티브 샘플, 릴레이션을 손상시킨 제2 네거티브 샘플을 생성하고,
상기 질문 문장의 정답에 해당하는 후보 입력군을 포지티브 샘플로 설정하고, 상기 포지티브 샘플, 상기 제1 및 제2 네거티브 샘플을 하기 [수학식 1]에 대입하여, 상기 질문 문장과 상기 정답을 학습하는, 지식기반 질문 응답 장치.
[수학식 1]
여기서, 주어진 function은 scroing function, q는 질문 문장, t는 q에 대한 positive, negative sample임.
The method of claim 9,
The processor,
After providing the correct answer,
In any one of the candidate input groups that do not correspond to the correct answer of the question sentence, a first negative sample in which the entity is damaged and a second negative sample in which the relation is damaged are generated,
Setting a candidate input group corresponding to the correct answer of the question sentence as a positive sample, and substituting the positive sample and the first and second negative samples into the following [Equation 1] to learn the question sentence and the correct answer , Knowledge-based question answering device.
[Equation 1]
Here, the given function is a scroing function, q is a question sentence, and t is a positive and negative sample for q.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
KR1020200080322A KR102194837B1 (en) | 2020-06-30 | 2020-06-30 | Method and apparatus for answering knowledge-based question |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
KR1020200080322A KR102194837B1 (en) | 2020-06-30 | 2020-06-30 | Method and apparatus for answering knowledge-based question |
Publications (1)
Publication Number | Publication Date |
---|---|
KR102194837B1 true KR102194837B1 (en) | 2020-12-23 |
Family
ID=74088999
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
KR1020200080322A KR102194837B1 (en) | 2020-06-30 | 2020-06-30 | Method and apparatus for answering knowledge-based question |
Country Status (1)
Country | Link |
---|---|
KR (1) | KR102194837B1 (en) |
Cited By (17)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112800205A (en) * | 2021-02-26 | 2021-05-14 | 中国人民解放军国防科技大学 | Method and device for obtaining question-answer related paragraphs based on semantic change manifold analysis |
CN112818675A (en) * | 2021-02-01 | 2021-05-18 | 北京金山数字娱乐科技有限公司 | Knowledge base question-answer-based entity extraction method and device |
CN112966084A (en) * | 2021-03-11 | 2021-06-15 | 北京三快在线科技有限公司 | Knowledge graph-based answer query method, device, equipment and storage medium |
CN113127623A (en) * | 2021-05-06 | 2021-07-16 | 东南大学 | Knowledge base problem generation method based on hybrid expert model and joint learning |
CN113157886A (en) * | 2021-04-19 | 2021-07-23 | 西安交通大学深圳研究院 | Automatic question and answer generating method, system, terminal and readable storage medium |
CN113590799A (en) * | 2021-08-16 | 2021-11-02 | 东南大学 | Weak supervision knowledge graph question-answering method based on multi-view reasoning |
CN113743095A (en) * | 2021-07-19 | 2021-12-03 | 西安理工大学 | Chinese problem generation unified pre-training method based on word lattice and relative position embedding |
CN113761107A (en) * | 2021-09-18 | 2021-12-07 | 杭州网易智企科技有限公司 | Information processing method, medium, device and computing equipment based on question-answering system |
CN113849601A (en) * | 2021-09-17 | 2021-12-28 | 上海数熙传媒科技有限公司 | Input pruning acceleration method for question-answering task model |
CN113918694A (en) * | 2021-10-08 | 2022-01-11 | 武汉科技大学 | Question analysis method for medical knowledge map question answering |
CN113946665A (en) * | 2021-09-13 | 2022-01-18 | 东北大学 | Knowledge base question-answering method for providing background information based on text |
CN114385830A (en) * | 2022-01-14 | 2022-04-22 | 中国建设银行股份有限公司 | Operation and maintenance knowledge online question and answer method and device, electronic equipment and storage medium |
KR102416852B1 (en) | 2021-07-23 | 2022-07-05 | (주)뤼이드 | Methods and devices for predicting test scores |
KR20220114157A (en) * | 2021-02-08 | 2022-08-17 | 숭실대학교산학협력단 | Commonsense question answer reasoning method and apparatus |
CN115034302A (en) * | 2022-06-07 | 2022-09-09 | 四川大学 | Relation extraction method, device, equipment and medium for optimizing information fusion strategy |
CN115359914A (en) * | 2022-08-26 | 2022-11-18 | 山东心法科技有限公司 | Method, apparatus, and medium for discriminating psychological states based on quantization description vector |
CN117194633A (en) * | 2023-09-12 | 2023-12-08 | 河海大学 | Dam emergency response knowledge question-answering system based on multi-level multipath and implementation method |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20170337479A1 (en) * | 2016-05-17 | 2017-11-23 | Maluuba Inc. | Machine comprehension of unstructured text |
-
2020
- 2020-06-30 KR KR1020200080322A patent/KR102194837B1/en active IP Right Grant
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20170337479A1 (en) * | 2016-05-17 | 2017-11-23 | Maluuba Inc. | Machine comprehension of unstructured text |
Non-Patent Citations (4)
Title |
---|
Alan Nichol, Understandign intents and entities, https://campus.datacamp.com/courses/building-chatbots-in-python/understanding-natural-language?ex=1 * |
김민호 외, 한국어 어휘의미망의 의미 관계를 이용한 어의 중의성 해소, 정보과학회논문지 제38권제19호, pp.554-564 (2011.10.) 1부. * |
유소엽 외, BERT 모델과 지식 그래프를 활용한 지능형 챗봇, 한국전자거래학회지 v.24 no.3, pp.87-98 (2019.8.31) * |
이현우 외, 건국봇: 검색모델과 생성모델을 결합한 챗봇, 한국정보처리학회 2018년 춘계학술발표대회 논문집 25(1), pp.449-452, 2018.5 * |
Cited By (23)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112818675A (en) * | 2021-02-01 | 2021-05-18 | 北京金山数字娱乐科技有限公司 | Knowledge base question-answer-based entity extraction method and device |
KR102464998B1 (en) | 2021-02-08 | 2022-11-09 | 숭실대학교산학협력단 | Commonsense question answer reasoning method and apparatus |
KR20220114157A (en) * | 2021-02-08 | 2022-08-17 | 숭실대학교산학협력단 | Commonsense question answer reasoning method and apparatus |
CN112800205A (en) * | 2021-02-26 | 2021-05-14 | 中国人民解放军国防科技大学 | Method and device for obtaining question-answer related paragraphs based on semantic change manifold analysis |
CN112966084A (en) * | 2021-03-11 | 2021-06-15 | 北京三快在线科技有限公司 | Knowledge graph-based answer query method, device, equipment and storage medium |
CN113157886A (en) * | 2021-04-19 | 2021-07-23 | 西安交通大学深圳研究院 | Automatic question and answer generating method, system, terminal and readable storage medium |
CN113127623A (en) * | 2021-05-06 | 2021-07-16 | 东南大学 | Knowledge base problem generation method based on hybrid expert model and joint learning |
CN113743095A (en) * | 2021-07-19 | 2021-12-03 | 西安理工大学 | Chinese problem generation unified pre-training method based on word lattice and relative position embedding |
KR102416852B1 (en) | 2021-07-23 | 2022-07-05 | (주)뤼이드 | Methods and devices for predicting test scores |
WO2023003262A1 (en) * | 2021-07-23 | 2023-01-26 | (주)뤼이드 | Method and device for predicting test score |
CN113590799A (en) * | 2021-08-16 | 2021-11-02 | 东南大学 | Weak supervision knowledge graph question-answering method based on multi-view reasoning |
CN113946665A (en) * | 2021-09-13 | 2022-01-18 | 东北大学 | Knowledge base question-answering method for providing background information based on text |
CN113946665B (en) * | 2021-09-13 | 2024-05-10 | 东北大学 | Knowledge base question-answering method for providing background information based on text |
CN113849601A (en) * | 2021-09-17 | 2021-12-28 | 上海数熙传媒科技有限公司 | Input pruning acceleration method for question-answering task model |
CN113761107A (en) * | 2021-09-18 | 2021-12-07 | 杭州网易智企科技有限公司 | Information processing method, medium, device and computing equipment based on question-answering system |
CN113761107B (en) * | 2021-09-18 | 2024-06-07 | 杭州网易智企科技有限公司 | Information processing method, medium, device and computing equipment based on question-answering system |
CN113918694A (en) * | 2021-10-08 | 2022-01-11 | 武汉科技大学 | Question analysis method for medical knowledge map question answering |
CN113918694B (en) * | 2021-10-08 | 2024-04-16 | 武汉科技大学 | Question analysis method for medical knowledge graph questions and answers |
CN114385830A (en) * | 2022-01-14 | 2022-04-22 | 中国建设银行股份有限公司 | Operation and maintenance knowledge online question and answer method and device, electronic equipment and storage medium |
CN115034302A (en) * | 2022-06-07 | 2022-09-09 | 四川大学 | Relation extraction method, device, equipment and medium for optimizing information fusion strategy |
CN115034302B (en) * | 2022-06-07 | 2023-04-11 | 四川大学 | Relation extraction method, device, equipment and medium for optimizing information fusion strategy |
CN115359914A (en) * | 2022-08-26 | 2022-11-18 | 山东心法科技有限公司 | Method, apparatus, and medium for discriminating psychological states based on quantization description vector |
CN117194633A (en) * | 2023-09-12 | 2023-12-08 | 河海大学 | Dam emergency response knowledge question-answering system based on multi-level multipath and implementation method |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR102194837B1 (en) | Method and apparatus for answering knowledge-based question | |
CN110781680B (en) | Semantic similarity matching method based on twin network and multi-head attention mechanism | |
CN111708873B (en) | Intelligent question-answering method, intelligent question-answering device, computer equipment and storage medium | |
CN109271537B (en) | Text-to-image generation method and system based on distillation learning | |
KR102138130B1 (en) | Apparatus and method for answering question based on conceptual graph | |
Zhang et al. | Deep Learning+ Student Modeling+ Clustering: A Recipe for Effective Automatic Short Answer Grading. | |
CN111858896B (en) | Knowledge base question-answering method based on deep learning | |
CN113886626B (en) | Visual question-answering method of dynamic memory network model based on multi-attention mechanism | |
Shao et al. | Collaborative learning for answer selection in question answering | |
CN114238653B (en) | Method for constructing programming education knowledge graph, completing and intelligently asking and answering | |
Sadr et al. | Presentation of an efficient automatic short answer grading model based on combination of pseudo relevance feedback and semantic relatedness measures | |
CN115270752A (en) | Template sentence evaluation method based on multilevel comparison learning | |
CN114239599A (en) | Method, system, equipment and medium for realizing machine reading understanding | |
Zuin et al. | Learning transferable features for open-domain question answering | |
Meena et al. | Evaluation of the descriptive type answers using hyperspace analog to language and self-organizing map | |
CN112667797B (en) | Question-answer matching method, system and storage medium for self-adaptive transfer learning | |
Tüselmann et al. | Recognition-free question answering on handwritten document collections | |
WO2022061877A1 (en) | Event extraction and extraction model training method, apparatus and device, and medium | |
Korade et al. | Strengthening Sentence Similarity Identification Through OpenAI Embeddings and Deep Learning. | |
CN110334204B (en) | Exercise similarity calculation recommendation method based on user records | |
CN111581365A (en) | Predicate extraction method | |
CN113066358B (en) | Science teaching auxiliary system | |
CN112989001A (en) | Question and answer processing method, device, medium and electronic equipment | |
CN113011141A (en) | Buddha note model training method, Buddha note generation method and related equipment | |
Sangani et al. | Comparing deep sentiment models using quantified local explanations |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
E701 | Decision to grant or registration of patent right | ||
GRNT | Written decision to grant |