KR20230081594A - Apparatus and method for processing natural language query about relational database using transformer neural network - Google Patents

Apparatus and method for processing natural language query about relational database using transformer neural network Download PDF

Info

Publication number
KR20230081594A
KR20230081594A KR1020220117575A KR20220117575A KR20230081594A KR 20230081594 A KR20230081594 A KR 20230081594A KR 1020220117575 A KR1020220117575 A KR 1020220117575A KR 20220117575 A KR20220117575 A KR 20220117575A KR 20230081594 A KR20230081594 A KR 20230081594A
Authority
KR
South Korea
Prior art keywords
natural language
query
schema
result
attention
Prior art date
Application number
KR1020220117575A
Other languages
Korean (ko)
Inventor
한욱신
강혁규
김현지
Original Assignee
포항공과대학교 산학협력단
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 포항공과대학교 산학협력단 filed Critical 포항공과대학교 산학협력단
Priority to US17/964,807 priority Critical patent/US20230169075A1/en
Publication of KR20230081594A publication Critical patent/KR20230081594A/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/243Natural language query formulation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/211Schema design and management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2423Interactive query statement specification based on a database schema
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Computational Linguistics (AREA)
  • Artificial Intelligence (AREA)
  • Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Evolutionary Computation (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

본 발명의 목적을 달성하기 위한 일 실시예에 따른 자연어 질의 처리 장치는 사용자에 의하여 입력된 자연어 질의를 수신하고, 자연어 질의에 기반하여 구조화된 질의를 생성하고, 프로세서는 자연어 질의에 기반하여 구조화된 질의를 생성함에 있어서, 자연어 질의에 대한 자연어 처리 결과 및 자연어 질의와 관련되는 데이터베이스 내의 하위 데이터베이스 간의 관계에 기반하여 추출되는 스키마 관계의 상호 간에 생성되는 교차 어텐션 결과를 이용하여 구조화된 질의를 생성한다. A natural language query processing apparatus according to an embodiment for achieving the object of the present invention receives a natural language query input by a user, generates a structured query based on the natural language query, and a processor performs a structured query based on the natural language query. In generating a query, a structured query is created using a result of cross-attention generated between a schema relationship extracted based on a relationship between a natural language processing result of a natural language query and a lower database in a database related to the natural language query.

Description

트랜스포머 신경망을 이용하여 관계형 데이터베이스에 대한 자연어 질의를 처리하는 장치 및 방법 {APPARATUS AND METHOD FOR PROCESSING NATURAL LANGUAGE QUERY ABOUT RELATIONAL DATABASE USING TRANSFORMER NEURAL NETWORK}APPARATUS AND METHOD FOR PROCESSING NATURAL LANGUAGE QUERY ABOUT RELATIONAL DATABASE USING TRANSFORMER NEURAL NETWORK}

본 발명은 데이터베이스에 대한 질의 처리 방법 및 장치에 관한 것으로, 자연어 질의에 기반하여 규격화/구조화된 질의를 생성하는 기술에 관한 것이다. 특히 본 발명은 트랜스포머 신경망과 관계형 데이터베이스를 이용하여 자연어 질의에 기반하여 규격화/구조화된 질의를 생성하는 기술에 관한 것이다. The present invention relates to a query processing method and apparatus for a database, and relates to a technology for generating a standardized/structured query based on a natural language query. In particular, the present invention relates to a technique for generating a standardized/structured query based on a natural language query using a transformer neural network and a relational database.

최근 인터넷의 보급으로 사용자는 대단히 방대한 정보에 노출되고 있다. 이러한 방대한 정보 중 자신에게 필요한 정보만을 획득하기 위해서는 효과적인 검색이 필요하다.With the recent spread of the Internet, users are exposed to a vast amount of information. In order to acquire only the necessary information among such vast amounts of information, an effective search is required.

검색은 질의에 대한 응답으로 이루어진다. 일반적인 질의 응답 시스템은 질문에 대한 결과로 해답을 제시한다. 정보 요구자가 원하는 내용을 정확히 질의하고 탐색하는 것은 매우 어려운 일이다.A search is made in response to a query. A typical question answering system presents an answer as a result of a question. It is very difficult to query and search exactly what information requesters want.

원하는 결과를 얻기 위해서는 질의가 규격을 갖춘 구조화된 질의일 것이 요구된다. 그러나 구조화된 질의를 생성하기 위해서는 규격/규칙에 대한 전문적인 지식을 요구하는 경우가 있으므로 대부분의 사용자는 구조화된 질의를 스스로 생성해 내기 쉽지 않은 것이 현실이다.In order to obtain the desired result, it is required that the query be a structured query with specifications. However, in order to create a structured query, specialized knowledge of specifications/rules is sometimes required, so most users find it difficult to create a structured query on their own.

때문에 사용자는 자연어로 이루어진 질의를 생성하고, 자연어 질의를 규격화/구조화된 질의로 해석/변환하려는 시도가 있어 왔다.For this reason, there have been attempts by users to generate queries in natural language and interpret/convert the natural language queries into standardized/structured queries.

한국등록특허 KR 10-2150908호 "자연어 질의해석 방법 및 시스템"은 자연어 질의를 해석함에 있어 사용자의 의도를 더욱 명확히 해석하고 사용자의 의도에 효과적으로 부합하는 질의 처리 방법을 제안하였다.Korean Patent Registration No. KR 10-2150908 "Natural Language Query Interpretation Method and System" proposes a query processing method that more clearly interprets the user's intention and effectively meets the user's intention in interpreting the natural language query.

그러나 이러한 선행기술에 의해서도 자연어 질의를 구조화된 질의로 변환하는 과정이 완전하지 않으며, 자연어 질의를 구조화된 질의로 변환하는 효과적인 기법이 요구되고 있다. However, even with these prior arts, the process of converting a natural language query into a structured query is not perfect, and an effective technique for converting a natural language query into a structured query is required.

한국등록특허 KR 10-2150908호 "자연어 질의해석 방법 및 시스템" (공개일 2020년 8월 27일)Korean Registered Patent No. KR 10-2150908 "Natural language query interpretation method and system" (published on August 27, 2020) 한국등록특허 KR 10-2277787호 "신경망 기반 자연어로부터 SQL 질의 번역 시 사용되는 컬럼 및 테이블을 예측하는 방법" (공개일 2021년 7월 9일)Korean Registered Patent No. KR 10-2277787 "Method for Predicting Columns and Tables Used in Translating SQL Queries from Natural Language Based on Neural Networks" (Published on July 9, 2021) 한국등록특허 KR 10-2345568호 "자연어 단어를 데이터베이스의 컬럼 및 테이블과 연결하는 방법" (공개일 2021년 12월 27일)Korean Registered Patent No. KR 10-2345568 "Method for connecting natural language words with database columns and tables" (published on December 27, 2021)

"Attention Is All You Need", Ashish Vaswani 외, 31st Conference on Neural Information Processing Systems (NIPS 2017), (공개일 2017년 12월 6일)"Attention Is All You Need", Ashish Vaswani et al., 31st Conference on Neural Information Processing Systems (NIPS 2017), (published on December 6, 2017)

상기와 같은 문제점을 해결하기 위한 본 발명의 목적은, 데이터베이스 관리 시스템뿐만 아니라 향후 검색 시스템에도 적용이 예상되는 검색 시스템으로서, 사용자가 원하는 정보에 키워드 또는 질의를 보냈을 때 관련된 자료나 정답을 찾아주는 기술로, 비정형 데이터(unstructured data) 뿐만 아니라 데이터베이스와 같은 정형 데이터를 사용할 때 활용할 수 있는 트랜스포머 신경망 기반 자연어 질의와 관계형 데이터베이스를 의미 표현(meaning representation)으로 인코딩하는 장치 및 방법을 제공하는 것이다.The object of the present invention to solve the above problems is a search system that is expected to be applied not only to database management systems but also to future search systems, and to find related data or correct answers when a user sends a keyword or query to desired information. As a technology, an apparatus and method for encoding a transformer neural network-based natural language query and a relational database into a meaningful representation that can be utilized when using unstructured data as well as structured data such as a database are provided.

본 발명은 사용자가 구조화된 질의에 대한 지식 없이 자연어 질의를 입력하는 경우에도 자동으로 구조화된 질의를 생성하여 사용자가 원하는 질의 응답 결과를 제공하는 것을 목적으로 한다.An object of the present invention is to provide a query response result desired by a user by automatically generating a structured query even when a user inputs a natural language query without knowledge of the structured query.

본 발명은 사용자가 입력한 자연어 질의만으로는 얻을 수 있는 스키마 정보를 미리 분석하고 인코딩함으로써 사용자의 의도에 부합하는 구조화된 질의를 생성하고 질의 응답 결과를 제공하는 것을 목적으로 한다.An object of the present invention is to generate a structured query that meets the user's intention and provide a query response result by pre-analyzing and encoding schema information that can be obtained only with a natural language query input by a user.

본 발명은 사용자가 자연어 질의를 입력하는 경우에 구조화된 질의 및 질의 응답 결과를 생성하는 과정을 고도화하는 것을 목적으로 한다.An object of the present invention is to advance a process of generating a structured query and query response result when a user inputs a natural language query.

본 발명은 자연어 질의 입력에 응답하여 구조화된 질의를 생성하는 과정을 고도화하는 교차 어텐션 기반의 새로운 신경망 구조를 제안하는 것을 목적으로 한다.An object of the present invention is to propose a new neural network structure based on cross-attention that advances the process of generating a structured query in response to a natural language query input.

본 발명은 자연어 질의 입력에 응답하여 구조화된 질의를 생성하는 과정을 고도화하는, 하위 데이터베이스 간의 관계에 기반한 스키마 관계 추출 기법을 제안하는 것을 목적으로 한다. An object of the present invention is to propose a scheme for extracting schema relationships based on relationships between sub-databases, which advances the process of generating a structured query in response to a natural language query input.

본 발명의 목적을 달성하기 위한 일 실시예에 따른 자연어 질의 처리 장치는, 프로세서(processor)를 포함한다. 프로세서는 사용자에 의하여 입력된 자연어 질의를 수신하고, 자연어 질의에 기반하여 구조화된 질의를 생성하고, 프로세서는 자연어 질의에 기반하여 구조화된 질의를 생성함에 있어서, 자연어 질의에 대한 자연어 처리 결과 및 자연어 질의와 관련되는 데이터베이스 내의 하위 데이터베이스 간의 관계에 기반하여 추출되는 스키마 관계의 상호 간에 생성되는 교차 어텐션 결과를 이용하여 구조화된 질의를 생성한다. A natural language query processing apparatus according to an embodiment for achieving the object of the present invention includes a processor. The processor receives a natural language query input by a user, generates a structured query based on the natural language query, and in generating the structured query based on the natural language query, the natural language processing result for the natural language query and the natural language query A structured query is created using the mutually generated cross-attention result of schema relationships extracted based on relationships between sub-databases in the database related to .

프로세서는 자연어 처리 결과의 스키마 관계와의 관련도를 나타내는 제1 교차 어텐션 결과, 및 스키마 관계의 자연어 처리 결과와의 관련도를 나타내는 제2 교차 어텐션 결과를 이용하여 구조화된 질의를 생성할 수 있고, 교차 어텐션 결과는 제1 교차 어텐션 결과 및 제2 교차 어텐션 결과를 포함할 수 있다. The processor may generate a structured query using a first cross-attention result indicating a degree of relevance of a natural language processing result with a schema relationship and a second cross-attention result indicating a degree of relevance of a schema relationship with a natural language processing result, The cross-attention result may include a first cross-attention result and a second cross-attention result.

본 발명의 일 실시예에 따른 자연어 질의 처리 장치는 자연어 질의에 기반하여 자연어 처리 결과를 생성하는 자연어 처리 모델; 및 스키마 관계를 출력하는 스키마 인코더 모델을 더 포함할 수 있다. A natural language query processing apparatus according to an embodiment of the present invention includes a natural language processing model that generates a natural language processing result based on a natural language query; and a schema encoder model outputting a schema relationship.

스키마 인코더 모델은 입력 스키마 그래프에 기반하여 스키마 의미 표현을 스키마 관계로서 출력할 수 있다. The schema encoder model may output a schema semantic expression as a schema relationship based on an input schema graph.

자연어 처리 모델은 자연어 질의의 전처리 결과를 입력받고 자연어 요소 의미 표현을 자연어 처리 결과로서 출력할 수 있다. The natural language processing model may receive a preprocessing result of a natural language query and output a semantic expression of a natural language element as a natural language processing result.

본 발명의 일 실시예에 따른 자연어 질의 처리 장치는 자연어 처리 결과의 스키마 관계와의 관련도를 나타내는 제1 교차 어텐션 결과를 생성하는 제1 교차 어텐션 계층; 및 스키마 관계의 자연어 처리 결과와의 관련도를 나타내는 제2 교차 어텐션 결과를 생성하는 제2 교차 어텐션 계층을 더 포함할 수 있다. A natural language query processing apparatus according to an embodiment of the present invention includes a first cross-attention layer generating a first cross-attention result indicating a degree of relevance of a result of natural language processing with a schema relationship; and a second cross-attention layer generating a second cross-attention result indicating a degree of relevance of the schema relationship with the natural language processing result.

자연어 처리 모델은 내부에 셀프 어텐션 기능을 가지는 제1 내부 어텐션 계층을 포함할 수 있고, 스키마 인코더 모델은 내부에 셀프 어텐션 및 교차 어텐션 중 적어도 하나 이상의 기능을 가지는 제2 내부 어텐션 계층을 포함할 수 있다. The natural language processing model may include a first inner attention layer having a self-attention function therein, and the schema encoder model may include a second inner attention layer having at least one function of self-attention and cross-attention therein. .

프로세서는 제1 내부 어텐션 계층의 출력에 기반한 자연어 처리 모델 내부의 파라미터의 업데이트를 차단할 수 있다. The processor may block updating of parameters within the natural language processing model based on the output of the first inner attention layer.

프로세서는 교차 어텐션 결과에 기반한 자연어 처리 모델 내부의 파라미터의 업데이트를 차단할 수 있다. The processor may block updating of parameters within the natural language processing model based on the cross-attention result.

본 발명의 일 실시예에 따른 자연어 질의 처리 장치는 교차 어텐션 결과에 기반하여 구조화된 질의를 생성하는 디코더 계층을 더 포함할 수 있다. The apparatus for processing a natural language query according to an embodiment of the present invention may further include a decoder layer generating a structured query based on a cross attention result.

본 발명의 일 실시예에 따른 자연어 질의 처리 방법은 프로세서(processor)를 포함하는 컴퓨팅 시스템에 의하여 실행될 수 있다. 본 발명의 일 실시예에 따른 자연어 질의 처리 방법은 사용자에 의하여 입력되는 자연어 질의를 수신하는 단계; 및 자연어 질의에 기반하여 구조화된 질의를 생성하는 단계를 포함하고, 구조화된 질의를 생성하는 단계는, 자연어 질의에 대한 자연어 처리 결과를 획득하는 단계; 자연어 질의와 관련되는 데이터베이스 내의 하위 데이터베이스 간의 관계에 기반하여 추출되는 스키마 관계를 획득하는 단계; 자연어 처리 결과 및 스키마 관계의 상호 간에 생성되는 교차 어텐션 결과를 획득하는 단계; 및 교차 어텐션 결과를 이용하여 구조화된 질의를 생성하는 단계를 포함한다. A natural language query processing method according to an embodiment of the present invention may be executed by a computing system including a processor. A natural language query processing method according to an embodiment of the present invention includes receiving a natural language query input by a user; and generating a structured query based on the natural language query, wherein generating the structured query comprises: obtaining a natural language processing result for the natural language query; obtaining a schema relationship extracted based on a relationship between sub-databases in a database related to a natural language query; obtaining a cross-attention result generated between the natural language processing result and the schema relationship; and generating a structured query using the cross attention result.

교차 어텐션 결과를 획득하는 단계는, 자연어 처리 결과의 스키마 관계와의 관련도를 나타내는 제1 교차 어텐션 결과를 획득하는 단계; 및 스키마 관계의 자연어 처리 결과와의 관련도를 나타내는 제2 교차 어텐션 결과를 획득하는 단계를 포함할 수 있다. The obtaining of the cross-attention result may include: obtaining a first cross-attention result indicating a degree of relation between the natural language processing result and the schema relationship; and obtaining a second cross-attention result indicating a degree of relevance of the schema relationship with the natural language processing result.

스키마 관계를 획득하는 단계에서는, 입력 스키마 그래프에 기반하여 스키마 의미 표현이 스키마 관계로서 획득될 수 있다. 자연어 처리 결과를 획득하는 단계에서는, 자연어 질의의 전처리 결과가 입력되고 자연어 요소 의미 표현이 자연어 처리 결과로서 획득될 수 있다. In the step of obtaining a schema relationship, a schema semantic expression may be obtained as a schema relationship based on an input schema graph. In the step of obtaining a natural language processing result, a preprocessing result of a natural language query may be input and a semantic expression of a natural language element may be obtained as a natural language processing result.

자연어 처리 결과를 획득하는 단계는, 내부 어텐션 계층의 출력에 기반한 자연어 처리 모델 내부의 파라미터의 업데이트가 차단된 상태에서 수행될 수 있다. Obtaining the natural language processing result may be performed in a state in which updating of internal parameters of the natural language processing model based on the output of the internal attention layer is blocked.

자연어 처리 결과를 획득하는 단계는, 교차 어텐션 결과에 기반한 자연어 처리 모델 내부의 파라미터의 업데이트가 차단된 상태에서 수행될 수 있다. Obtaining the natural language processing result may be performed in a state in which updating of internal parameters of the natural language processing model based on the cross attention result is blocked.

본 발명의 일 실시예에 따른 프로세서(processor)를 포함하는 컴퓨팅 시스템에 의하여 실행되는 자연어 질의 처리 방법은 자연어 질의와 관련되는 데이터베이스 내의 하위 데이터베이스 간의 스키마 관계를 일대일(one-to-one) 대응, 및 일대다(one-to-many) 대응 중 어느 하나로서 추출하는 단계; 및 스키마 관계에 기반하여 자연어 질의로부터 구조화된 질의를 생성하는 단계를 포함한다. A natural language query processing method executed by a computing system including a processor according to an embodiment of the present invention provides a one-to-one correspondence between sub-databases in a database related to a natural language query, and extracting as either one-to-many correspondence; and generating a structured query from the natural language query based on the schema relationship.

본 발명의 일 실시예에 따른 자연어 질의 처리 방법은, 하위 데이터베이스 간의 비교를 통해 스키마 관계를 강제적(mandatory) 관계, 및 선택적(optional) 관계 중 어느 하나로서 예측하는 단계를 더 포함할 수 있다. The natural language query processing method according to an embodiment of the present invention may further include predicting a schema relationship as one of a mandatory relationship and an optional relationship through comparison between lower databases.

본 발명의 일 실시예에 따른 자연어 질의 처리 방법은, 하위 데이터베이스 중 제1 하위 데이터베이스에 대응하는 제1 자연어 모델 및 제2 하위 데이터베이스에 대응하는 제2 자연어 모델을 이용하여 스키마 관계를 인코딩하는 단계를 더 포함할 수 있다. A natural language query processing method according to an embodiment of the present invention includes encoding a schema relationship using a first natural language model corresponding to a first sub-database and a second natural language model corresponding to a second sub-database among sub-databases. can include more.

본 발명의 일 실시예에 따른 자연어 질의 처리 방법은, 하위 데이터베이스 중 일부에 대한 마스크 컬럼 모델링을 이용하여 스키마 관계의 적어도 일부를 미리 인코딩하는 단계를 더 포함할 수 있다. The natural language query processing method according to an embodiment of the present invention may further include pre-encoding at least a portion of a schema relationship by using mask column modeling for a portion of lower databases.

본 발명의 일 실시예에 따른 자연어 질의 처리 방법은, 자연어 질의에 기반하여 자연어 처리 결과를 획득하는 단계를 더 포함할 수 있다. 이때 구조화된 질의를 생성하는 단계는, 자연어 처리 결과 및 스키마 관계의 상호 간에 생성되는 교차 어텐션 결과를 획득하는 단계; 및 교차 어텐션 결과를 이용하여 구조화된 질의를 생성하는 단계를 포함할 수 있다. The natural language query processing method according to an embodiment of the present invention may further include obtaining a natural language processing result based on the natural language query. In this case, the generating of the structured query may include obtaining a result of natural language processing and a cross-attention result generated between schema relationships; and generating a structured query using the cross attention result.

본 발명의 일 실시예에 따른 자연어 질의 처리 방법은, 미리 학습된 언어 모델을 이용하여 자연어 질의에 기반하여 자연어 처리 결과를 획득하는 단계를 더 포함할 수 있다. 이때 자연어 처리 결과를 획득하는 단계는, 언어 모델의 내부 파라미터의 업데이트가 차단된 상태에서 수행될 수 있다. The natural language query processing method according to an embodiment of the present invention may further include obtaining a natural language processing result based on a natural language query using a pre-learned language model. In this case, the step of obtaining the natural language processing result may be performed in a state in which updating of internal parameters of the language model is blocked.

본 발명의 실시예에 따르면, 자연어 질의를 SQL 질의와 같은 규격화/구조화된 질의로 번역하는데 있어서 필요한 자연어 질의와 데이터베이스 스키마에 대한 의미 표현을 더욱 정확하게 계산하여 번역 시스템의 성능을 높일 수 있다.According to an embodiment of the present invention, in translating a natural language query into a standardized/structured query such as an SQL query, it is possible to more accurately calculate a semantic expression for a natural language query and a database schema, thereby increasing the performance of the translation system.

본 발명의 실시예에 따르면 사용자가 구조화된 질의에 대한 지식 없이 자연어 질의를 입력하는 경우에도 자동으로 구조화된 질의를 생성하여 사용자가 원하는 질의 응답 결과를 제공할 수 있다. According to an embodiment of the present invention, even when a user inputs a natural language query without knowledge of the structured query, a structured query may be automatically generated and a query response result desired by the user may be provided.

본 발명의 실시예에 따르면 사용자가 입력한 자연어 질의만으로는 얻을 수 있는 스키마 정보를 미리 분석하고 인코딩함으로써 사용자의 의도에 부합하는 구조화된 질의를 생성하고 질의 응답 결과를 제공할 수 있다. According to an embodiment of the present invention, it is possible to generate a structured query that meets the user's intention and provide a query response result by pre-analyzing and encoding schema information that can be obtained only with a natural language query input by a user.

본 발명의 실시예에 따르면 사용자가 자연어 질의를 입력하는 경우에 구조화된 질의 및 질의 응답 결과를 생성하는 과정을 고도화할 수 있다. According to an embodiment of the present invention, when a user inputs a natural language query, a process of generating a structured query and query response result can be advanced.

본 발명의 실시예에 따르면 자연어 질의 입력에 응답하여 구조화된 질의를 생성하는 과정을 고도화하는 교차 어텐션 기반의 새로운 신경망 구조를 구현할 수 있다. According to an embodiment of the present invention, it is possible to implement a new neural network structure based on cross attention that advances the process of generating a structured query in response to a natural language query input.

본 발명의 실시예에 따르면 자연어 질의 입력에 응답하여 구조화된 질의를 생성하는 과정을 고도화하는, 하위 데이터베이스 간의 관계에 기반한 스키마 관계를 추출할 수 있다. According to an embodiment of the present invention, a schema relationship based on a relationship between sub-databases may be extracted, which enhances a process of generating a structured query in response to a natural language query input.

도 1은 본 발명의 일 실시예에 따른 자연어 질의 처리 장치를 포함하는 시스템을 도시하는 개념도이다.
도 2는 본 발명의 일 실시예에 따른 자연어 질의 처리 장치에 의하여 실행되는 자연어 처리 시나리오의 일 예를 도시하는 개념도이다.
도 3은 본 발명의 일 실시예에 따른 자연어 질의 처리 장치에 의하여 실행되는 자연어 질의 처리 과정을 설명하기 위한 가상의 사용자에 의한 등가적인 질의 생성 과정을 도시하는 개념도이다.
도 4는 본 발명의 일 실시예에 따른 자연어 질의 처리 장치의 내부 구조로서 자연어 처리를 위한 언어 모델, 스키마 인코더, 및 교차 어텐션(Cross-attention) 계층을 도시하는 개념도이다.
도 5는 본 발명의 일 실시예에 따른 자연어 질의 처리 장치의 내부 구조로서 언어 모델의 내부 파라미터의 업데이트가 차단되는 경우를 도시하는 개념도이다.
도 6은 본 발명의 일 실시예에 따른 자연어 질의 처리 장치의 내부 구조로서 교차 어텐션 결과에 기반하여 구조화된 질의를 생성하는 디코더 계층을 더 포함하는 실시예를 도시하는 개념도이다.
도 7은 본 발명의 일 실시예에 따른 자연어 질의 처리 장치에 의하여 실행되는 자연어 질의 처리 방법을 도시하는 동작 흐름도이다.
도 8은 도 7의 단계 S350 및 그 전후의 과정을 더욱 상세하게 도시하는 동작 흐름도이다.
도 9는 본 발명의 다른 일 실시예에 따른 자연어 질의 처리 방법을 도시하는 동작 흐름도이다.
도 10은 본 발명의 일 실시예에 따른 자연어 질의 처리 장치에서 수행되는 자연어 질의 처리 방법에서, 자동차 관련된 자연어 질의와 스키마가 주어졌을 때의 스키마 링킹 과정의 일 실시예를 설명하기 위한 개념도이다.
도 11은 본 발명의 일 실시예에 따른 자연어 질의 처리 장치에서 수행되는 자연어 질의 처리 방법에서, 하나의 자연어 질의가 데이터베이스 내의 하위 데이터베이스(테이블) 간의 관계에 따라 서로 다른 구조화된 질의로 번역될 수 있음을 설명하기 위한 개념도이다.
도 12는 본 발명의 일 실시예에 따른 자연어 질의 처리 장치에서 수행되는 자연어 질의 처리 방법에서, 데이터베이스 레코드 값을 활용하여 하위 데이터베이스(테이블) 간의 관계를 추출하는 실시예를 도시하는 개념도이다.
도 13은 본 발명의 일 실시예에 따른 자연어 질의 처리 장치에서 수행되는 자연어 질의 처리 방법에서, 스키마 인코딩 예시를 도시하는 개념도이다.
도 14는 본 발명의 일 실시예에 따른 일반화된 자연어 처리 장치 또는 컴퓨팅 시스템을 도시하는 블록도이다.
1 is a conceptual diagram illustrating a system including a natural language query processing apparatus according to an embodiment of the present invention.
2 is a conceptual diagram illustrating an example of a natural language processing scenario executed by a natural language query processing apparatus according to an embodiment of the present invention.
3 is a conceptual diagram illustrating a process of generating an equivalent query by a virtual user to explain a process of processing a natural language query executed by a natural language query processing apparatus according to an embodiment of the present invention.
4 is a conceptual diagram illustrating a language model, a schema encoder, and a cross-attention layer for natural language processing as an internal structure of a natural language query processing apparatus according to an embodiment of the present invention.
5 is a conceptual diagram illustrating an internal structure of a natural language query processing apparatus according to an embodiment of the present invention, when updating of internal parameters of a language model is blocked.
6 is a conceptual diagram illustrating an embodiment further including a decoder layer generating a structured query based on a result of cross attention as an internal structure of a natural language query processing apparatus according to an embodiment of the present invention.
7 is an operational flowchart illustrating a natural language query processing method executed by a natural language query processing apparatus according to an embodiment of the present invention.
FIG. 8 is an operation flow chart showing steps S350 of FIG. 7 and the processes before and after it in more detail.
9 is an operational flowchart illustrating a natural language query processing method according to another embodiment of the present invention.
10 is a conceptual diagram illustrating an embodiment of a schema linking process when a natural language query and a schema related to automobiles are given in a natural language query processing method performed by a natural language query processing apparatus according to an embodiment of the present invention.
11 illustrates that in a natural language query processing method performed by a natural language query processing apparatus according to an embodiment of the present invention, one natural language query can be translated into different structured queries according to relationships between sub-databases (tables) in a database. It is a conceptual diagram to explain.
12 is a conceptual diagram illustrating an embodiment of extracting relationships between lower databases (tables) by utilizing database record values in a natural language query processing method performed by a natural language query processing apparatus according to an embodiment of the present invention.
13 is a conceptual diagram illustrating an example of schema encoding in a natural language query processing method performed by a natural language query processing apparatus according to an embodiment of the present invention.
14 is a block diagram illustrating a generalized natural language processing device or computing system according to an embodiment of the present invention.

본 발명은 다양한 변경을 가할 수 있고 여러 가지 실시예를 가질 수 있는 바, 특정 실시예들을 도면에 예시하여 상세하게 설명하고자 한다. 그러나, 이는 본 발명을 특정한 실시 형태에 대해 한정하려는 것이 아니며, 본 발명의 사상 및 기술 범위에 포함되는 모든 변경, 균등물 내지 대체물을 포함하는 것으로 이해되어야 한다. 각 도면을 설명하면서 유사한 참조부호를 유사한 구성요소에 대해 사용하였다. Since the present invention can have various changes and various embodiments, it will be described in detail by exemplifying specific embodiments in the drawings. However, this is not intended to limit the present invention to specific embodiments, and should be understood to include all modifications, equivalents, and substitutes included in the spirit and scope of the present invention. Like reference numerals have been used for like elements throughout the description of each figure.

제1, 제2, A, B 등의 용어는 다양한 구성요소들을 설명하는 데 사용될 수 있지만, 상기 구성요소들은 상기 용어들에 의해 한정되어서는 안 된다. 상기 용어들은 하나의 구성요소를 다른 구성요소로부터 구별하는 목적으로만 사용된다. 예를 들어, 본 발명의 권리 범위를 벗어나지 않으면서 제1 구성요소는 제2 구성요소로 명명될 수 있고, 유사하게 제2 구성요소도 제1 구성요소로 명명될 수 있다. "및/또는"이라는 용어는 복수의 관련된 기재된 항목들의 조합 또는 복수의 관련된 기재된 항목들 중의 어느 항목을 포함한다. Terms such as first, second, A, and B may be used to describe various components, but the components should not be limited by the terms. These terms are only used for the purpose of distinguishing one component from another. For example, a first element may be termed a second element, and similarly, a second element may be termed a first element, without departing from the scope of the present invention. The term “and/or” includes any combination of a plurality of related listed items or any of a plurality of related listed items.

어떤 구성요소가 다른 구성요소에 "연결되어" 있다거나 "접속되어" 있다고 언급된 때에는, 그 다른 구성요소에 직접적으로 연결되어 있거나 또는 접속되어 있을 수도 있지만, 중간에 다른 구성요소가 존재할 수도 있다고 이해되어야 할 것이다. 반면에, 어떤 구성요소가 다른 구성요소에 "직접 연결되어" 있다거나 "직접 접속되어" 있다고 언급된 때에는, 중간에 다른 구성요소가 존재하지 않는 것으로 이해되어야 할 것이다. It is understood that when an element is referred to as being "connected" or "connected" to another element, it may be directly connected or connected to the other element, but other elements may exist in the middle. It should be. On the other hand, when an element is referred to as “directly connected” or “directly connected” to another element, it should be understood that no other element exists in the middle.

본 출원에서 사용한 용어는 단지 특정한 실시예를 설명하기 위해 사용된 것으로, 본 발명을 한정하려는 의도가 아니다. 단수의 표현은 문맥상 명백하게 다르게 뜻하지 않는 한, 복수의 표현을 포함한다. 본 출원에서, "포함하다" 또는 "가지다" 등의 용어는 명세서상에 기재된 특징, 숫자, 단계, 동작, 구성요소, 부품 또는 이들을 조합한 것이 존재함을 지정하려는 것이지, 하나 또는 그 이상의 다른 특징들이나 숫자, 단계, 동작, 구성요소, 부품 또는 이들을 조합한 것들의 존재 또는 부가 가능성을 미리 배제하지 않는 것으로 이해되어야 한다.Terms used in this application are only used to describe specific embodiments, and are not intended to limit the present invention. Singular expressions include plural expressions unless the context clearly dictates otherwise. In this application, the terms "include" or "have" are intended to designate that there is a feature, number, step, operation, component, part, or combination thereof described in the specification, but one or more other features It should be understood that the presence or addition of numbers, steps, operations, components, parts, or combinations thereof is not precluded.

다르게 정의되지 않는 한, 기술적이거나 과학적인 용어를 포함해서 여기서 사용되는 모든 용어들은 본 발명이 속하는 기술 분야에서 통상의 지식을 가진 자에 의해 일반적으로 이해되는 것과 동일한 의미를 가지고 있다. 일반적으로 사용되는 사전에 정의되어 있는 것과 같은 용어들은 관련 기술의 문맥 상 가지는 의미와 일치하는 의미를 가지는 것으로 해석되어야 하며, 본 출원에서 명백하게 정의하지 않는 한, 이상적이거나 과도하게 형식적인 의미로 해석되지 않는다.Unless defined otherwise, all terms used herein, including technical or scientific terms, have the same meaning as commonly understood by one of ordinary skill in the art to which the present invention belongs. Terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with the meaning in the context of the related art, and unless explicitly defined in the present application, they should not be interpreted in an ideal or excessively formal meaning. don't

상기 제시한 선행기술인 한국등록특허 KR 10-2150908호 "자연어 질의해석 방법 및 시스템", 한국등록특허 KR 10-2277787호 "신경망 기반 자연어로부터 SQL 질의 번역 시 사용되는 컬럼 및 테이블을 예측하는 방법", 한국등록특허 KR 10-2345568호 "자연어 단어를 데이터베이스의 컬럼 및 테이블과 연결하는 방법" 등에 의하여 개시된 자연어 질의를 구조화된 질의로 번역하는 방법, 이때 필요한 메타 데이터인 스키마를 해석하기 위하여 필요한 데이터베이스의 하위 데이터베이스 간의 관계를 분석하는 방법과, "Attention Is All You Need", Ashish Vaswani 외, 31st Conference on Neural Information Processing Systems (NIPS 2017) (2017월 12월 6일)에서 개시된 트랜스포머 신경망 구조 등을 포함하여 선행문헌들에 개시된 사항은 본 발명의 목적에 부합하는 범위 내에서 본 발명의 구성의 일부 또는 전부로서 포함될 수 있다. 당업자라면 상기 선행기술 문헌들의 내용으로부터 본 발명의 목적 및 구성과의 연관성을 자명하게 유추할 수 있을 것이므로 본 발명의 취지를 흐릴 수 있는 지나치게 자세한 설명은 생략하며, 상기 선행기술 문헌을 소개하는 것으로 설명에 갈음한다. Korean Patent Registration No. KR 10-2150908 "Natural Language Query Interpretation Method and System", Korean Patent Registration No. KR 10-2277787 "Method for Predicting Columns and Tables Used in SQL Query Translation from Neural Network-based Natural Language", A method for translating a natural language query into a structured query disclosed in Korean Patent Registration No. KR 10-2345568 "Method of connecting natural language words with columns and tables of a database", etc. A method for analyzing the relationship between databases and prior studies, including transformer neural network structure disclosed in "Attention Is All You Need", Ashish Vaswani et al., 31st Conference on Neural Information Processing Systems (NIPS 2017) (December 6, 2017) Matters disclosed in the literature may be included as part or all of the configuration of the present invention within the scope consistent with the purpose of the present invention. Since those skilled in the art will be able to clearly infer the connection between the object and configuration of the present invention from the contents of the prior art documents, excessively detailed descriptions that may obscure the purpose of the present invention will be omitted, and the prior art documents will be introduced. substitute for

이하, 첨부한 도면들을 참조하여, 본 발명의 바람직한 실시예를 보다 상세하게 설명하고자 한다. 본 발명을 설명함에 있어 전체적인 이해를 용이하게 하기 위하여 도면상의 동일한 구성요소에 대해서는 동일한 참조부호를 사용하고 동일한 구성요소에 대해서 중복된 설명은 생략한다. Hereinafter, with reference to the accompanying drawings, preferred embodiments of the present invention will be described in more detail. In order to facilitate overall understanding in the description of the present invention, the same reference numerals are used for the same components in the drawings, and redundant descriptions of the same components are omitted.

도 1은 본 발명의 일 실시예에 따른 자연어 질의 처리 장치를 포함하는 시스템을 도시하는 개념도이다.1 is a conceptual diagram illustrating a system including a natural language query processing apparatus according to an embodiment of the present invention.

도 1을 참조하면, 시스템은 데이터베이스에 대한 자연어 질의를 번역하는 시스템으로 이해될 수 있다. 또한 시스템은 데이터베이스에 사용자(100)가 자연어 질의를 입력하는 경우, 자연어 질의에 대응하는 응답 결과를 자동으로 생성하는 시스템으로 이해될 수 있다. Referring to Figure 1, the system can be understood as a system for translating natural language queries to a database. Also, the system may be understood as a system that automatically generates a response result corresponding to the natural language query when the user 100 inputs a natural language query to the database.

시스템 내의 질의 번역기(240)는 트랜스포머 신경망을 내부에 포함할 수 있으며, 트랜스포머 신경망에 기반하여 자연어 질의와 관계형 데이터베이스의 스키마 추출 결과를 의미 표현(meaning representation)으로 인코딩할 수 있다. 질의 번역기(240)는 인코딩된 결과를 디코딩하여 구조화된 질의로 변환하고, 답변 엔진(260)에 전달할 수 있다. The query translator 240 in the system may include a transformer neural network therein, and may encode a natural language query and a schema extraction result of a relational database into a meaning representation based on the transformer neural network. The query translator 240 may decode the encoded result, convert it into a structured query, and transmit it to the answer engine 260 .

일반적인 데이터베이스 관리 시스템(DBMS)을 사용하기 위해서는 일반적인 사용자는 해당 데이터베이스의 구조 및 구조화된 질의를 생성하기 위한 문법을 이해하고 있어야 한다. 이때 일반적인 사용자는 구조화된 질의를 적절하게 작성하고 입력하기 위하여 해당 데이터베이스의 구조에 따르는 스키마(schema)에 대한 지식을 필요로 한다. 이때 구조화된 질의는 일반적으로 널리 알려진 SQL(Structured Query Language)일 수 있고, 알려진 다른 형태의 구조화된 질의일 수 있다. 일반적인 사용자가 필요로 하는 스키마에 대한 지식 및 구조화된 질의에 대한 지식의 예시는 후술할 도 3에서 설명하기로 한다. In order to use a general database management system (DBMS), a general user must understand the structure of the database and the syntax for creating a structured query. At this time, general users need knowledge of the schema according to the structure of the database in order to properly write and input a structured query. At this time, the structured query may be a generally well-known Structured Query Language (SQL) or may be a structured query of another known type. An example of schema knowledge and structured query knowledge required by a general user will be described in FIG. 3 to be described later.

도 1의 시스템에서는 사용자(100)는 구조화된 질의 및/또는 스키마에 대한 직접적인 지식을 필요로 하지 않을 수 있다. 사용자(100)는 대화 관리자(220)에 자연어 질의를 입력할 수 있다. 이때 자연어 질의의 입력 방식은 키보드/키패드를 경유하는 텍스트 입력일 수도 있고, 음성 입력일 수도 있다. 음성 입력의 경우에는 대화 관리자(220)에 의하여 음성 인식 결과를 자연어 질의로 변환하는 전처리 과정을 거칠 수 있다. In the system of FIG. 1, user 100 may not require direct knowledge of structured queries and/or schemas. The user 100 may input a natural language query into the conversation manager 220 . In this case, the natural language query input method may be text input via a keyboard/keypad or voice input. In the case of voice input, a pre-processing process of converting a voice recognition result into a natural language query may be performed by the dialog manager 220 .

대화 관리자(220)는 자연어로 형성된 질의를 질의 번역기(240)로 전달할 수 있다. 질의 번역기(240)는 자연어 질의 입력을 구조화된 질의로 번역할 수 있다. 질의 번역기(240)는 구조화된 질의를 응답 엔진(260)으로 전달할 수 있다. The dialog manager 220 may transmit a query formed in natural language to the query translator 240 . Query translator 240 may translate a natural language query input into a structured query. Query translator 240 may pass the structured query to response engine 260 .

응답 엔진(260)은 공지된 인공지능 기반 대화형 비서와 같은 기능을 포함할 수 있다. 응답 엔진(260)은 구조화된 질의에 대응하는 데이터베이스 내의 검색 결과를 제공할 수 있다. 응답 엔진(260)은 검색 결과를 자연어 응답 및/또는 시각화된 결과로서 사용자(100)에게 제공할 수 있다. The response engine 260 may include functions such as a known artificial intelligence-based interactive assistant. Response engine 260 may provide search results in the database corresponding to the structured query. The response engine 260 may provide the search results to the user 100 as natural language responses and/or visualized results.

설명의 편의상 도 1에 도시되지는 않았지만 도 1의 대화 관리자(220), 질의 번역기(240), 및 응답 엔진(260)은 적어도 하나 이상의 프로세서와 전자적으로 연결되고, 프로세서에 의하여 관리 및 제어될 수 있다. 프로세서는 적어도 하나 이상의 메모리와 전자적으로 연결되고, 메모리에 저장된 적어도 하나 이상의 명령어가 프로세서에 의하여 실행됨으로써 도 1의 대화 관리자(220), 질의 번역기(240), 및 응답 엔진(260)의 기능이 제공될 수 있다. 본 발명의 또 다른 실시예에서는 도 1의 대화 관리자(220), 질의 번역기(240), 및 응답 엔진(260) 중 적어도 일부가 전용 하드웨어의 형태로 구현될 수도 있다. Although not shown in FIG. 1 for convenience of description, the dialog manager 220, query translator 240, and response engine 260 of FIG. 1 may be electronically connected to at least one processor and managed and controlled by the processor. there is. The processor is electronically connected to at least one memory, and at least one command stored in the memory is executed by the processor, thereby providing functions of the dialog manager 220, the query translator 240, and the response engine 260 of FIG. 1. It can be. In another embodiment of the present invention, at least some of the dialog manager 220, query translator 240, and response engine 260 of FIG. 1 may be implemented in the form of dedicated hardware.

본 발명의 목적을 달성하기 위한 일 실시예에 따른 시스템/장치는 트랜스포머 신경망 기반 자연어 질의와 관계형 데이터베이스를 의미 있는 표현으로 인코딩하는 기능을 포함할 수 있다. A system/device according to an embodiment for achieving the object of the present invention may include a function of encoding a transformer neural network-based natural language query and a relational database into a meaningful expression.

시스템/장치는 다국어 음성인식이 필요한 상황에서 단말기기의 하드웨어적 제약으로 인해 단일어만 음성인식이 가능한 경우 적어도 하나의 인공지능 모델로 다국어 음성인식을 수행하고, 자동으로 사용자의 발화를 인식하여 처리할 수 있는 음성인식 서비스를 제공할 수 있다. In a situation where multilingual speech recognition is required, the system/device performs multilingual speech recognition with at least one artificial intelligence model when only a single language can be recognized due to hardware limitations of the terminal device, and automatically recognizes and processes the user's utterance. Voice recognition service can be provided.

시스템/장치는 영어(EN)와 한국어(KO)의 오디오 입력을 7개 층의 CNN(Convolutional Neural Network) 구조의 Feature Extractor를 거친 후, 24개 층의 Transformer Encoder를 거쳐 음성 특징 정보를 추출하고, 한국어(KO), 영어(EN) 또는 한국어와 영어를 모두(ALL) 출력가능한 CTC Projection 출력 계층을 통해 최종 음성인식 결과를 출력할 수 있다.The system/device passes audio input in English (EN) and Korean (KO) through a 7-layer Convolutional Neural Network (CNN) feature extractor, and then extracts voice feature information through a 24-layer Transformer Encoder, The final voice recognition result can be output through the CTC Projection output layer capable of outputting Korean (KO), English (EN), or both Korean and English (ALL).

시스템/장치는, 각 CTC Projection 출력 계층의 출력 단위는 1byte(8bit)에 해당하는 유니코드(Unicode) 단위이고, 이를 재조합해 최종 결과를 생성할 수 있다. 이때 byte 단위의 정보는 8진수 표현 방식으로 0x00 ~ 0xff 로 표현될 수 있다. byte 단위의 유니코드 표현은 전세계의 모든 언어를 256(2의8승)개의 8bit(1byte)의 조합으로 표현할 수 있으므로, 지원하는 언어의 수가 증가하더라도 전체 모델의 크기는 256 단계의 출력을 지원하는 CTC Projection 출력 계층만큼만 증가할 수 있다.In the system/device, the output unit of each CTC projection output layer is a Unicode unit corresponding to 1 byte (8 bits), and it can be recombined to generate a final result. At this time, the information in byte units may be expressed as 0x00 to 0xff in an octal representation method. Unicode representation in byte units can express all languages in the world as a combination of 256 (2 to the 8th power) of 8 bits (1 byte), so even if the number of supported languages increases, the size of the entire model supports 256 levels of output. It can only increase as much as the CTC Projection output layer.

시스템/장치는, 인식하는 모든 언어가 공통적으로 공유되고, 각 언어별로 별도의 CTC Projection 출력 계층을 가지도록 구현될 수 있다. 음성 언어 분류가 확실하지 않은 경우 모든 언어가 동시에 학습되어 모든 언어가 출력이 가능한 범용(ALL) 출력 계층이 이용될 수 있다. 범용 출력 계층은 전용(KO or EN) 출력 계층보다 성능이 떨어지지만, 음성 언어 인식이 제대로 이뤄지지 않았을 때 잘못된 언어의 출력을 생성하는 오작동을 방지할 수 있다.The system/device may be implemented such that all recognized languages are commonly shared and have a separate CTC projection output layer for each language. If the speech language classification is not certain, a universal (ALL) output layer in which all languages are simultaneously learned and all languages can be output may be used. The general-purpose output layer performs worse than the dedicated (KO or EN) output layer, but it can prevent malfunctions that generate output of the wrong language when speech language recognition is not performed properly.

시스템/장치는, 다국어 음성인식의 성능을 증진시키기 위해, 음성 언어 분류 모델을 탑재할 수 있다.The system/device may be equipped with a speech language classification model to improve the performance of multilingual speech recognition.

시스템/장치의 음성 언어 분류 모델은, Wav2Vec2.0 모델을 기반으로 하며, 음성 정보를 25ms(밀리초) 단위로 나누어 Wav2Vec2.0 모델을 이용해 음성 정보를 추출하고, Projector 계층을 통해 25ms 단위의 추출된 음성 정보들의 평균값(Mean Pooling 연산 수행)을 음성 언어 분류기(Classifier)를 통해 분류할 수 있다.The voice language classification model of the system/device is based on the Wav2Vec2.0 model, divides voice information into 25ms (millisecond) units, extracts voice information using the Wav2Vec2.0 model, and extracts 25ms units through the Projector layer. The average value of the received speech information (mean pooling operation performed) can be classified through a speech language classifier.

시스템/장치는, 입력으로 받은 오디오 데이터를 Wav2Byte 음성인식기와 Wav2Vec2.0기반 음성 언어 분류기에 각각 입력하고, Wav2Byte 구조의 음성인식기의 언어별 CTC Projection 출력 계층을 선택할 때 Wav2Vec2.0 기반 음성 언어 분류기의 출력(언어 분류 정보)를 이용해 출력 계층을 선택하여 최종 음성 인식 결과를 생성할 수 있다. 시스템/장치는 음성 언어 분류의 확실성 (Confidence)가 70% 미만일 경우에는 오작동을 방지하기 위하여 전용 언어 출력 계층이 아닌 범용(ALL) 언어 출력 계층을 이용해 음성 인식 결과를 생성할 수 있다.When the system/device inputs the audio data received as input to the Wav2Byte speech recognizer and the Wav2Vec2.0-based speech language classifier, respectively, and selects the CTC projection output layer for each language of the speech recognizer of the Wav2Byte structure, the Wav2Vec2.0-based speech language classifier The final speech recognition result can be generated by selecting an output layer using the output (language classification information). When the confidence of speech language classification is less than 70%, the system/device may generate a speech recognition result using an ALL language output layer instead of a dedicated language output layer in order to prevent malfunction.

도 2는 본 발명의 일 실시예에 따른 자연어 질의 처리 장치에 의하여 실행되는 자연어 처리 시나리오의 일 예를 도시하는 개념도이다.2 is a conceptual diagram illustrating an example of a natural language processing scenario executed by a natural language query processing apparatus according to an embodiment of the present invention.

도 2를 참조하면, 도 1의 대화 관리자(220), 질의 번역기(240), 및 응답 엔진(260)을 경유하여 사용자(100)가 데이터베이스 관리 시스템(DBMS)(200)과 대화형 인터페이스를 이용하여 질의 및 검색 결과를 제공받는 시나리오가 도시된다.Referring to FIG. 2 , a user 100 uses a database management system (DBMS) 200 and a conversational interface via the dialog manager 220, the query translator 240, and the response engine 260 of FIG. 1 A scenario in which queries and search results are provided is shown.

사용자(100)는 300,000을 초과하는 ATM 거래량을 가지는 도시에 대하여 자연어 질의를 입력할 수 있다. DBMS(200)는 300,000을 초과하는 거래량을 가지는 도시는 검색되지 않으나, 300,000과 가장 가까운 299,580 건을 가지는 도시로서 서울(Seoul)이 검색되었음을 리포트할 수 있다. 도 1에서 사용자(100)는 은행 또는 금융기관 종사자를 가정하였으나, 본 발명의 사상은 이러한 가정에 국한되어 해석되지 아니 한다. The user 100 may input a natural language query for a city having an ATM transaction volume exceeding 300,000. The DBMS 200 may report that a city with a transaction volume exceeding 300,000 is not searched, but that Seoul is searched as a city having 299,580 transactions closest to 300,000. In FIG. 1, it is assumed that the user 100 is a bank or financial institution employee, but the scope of the present invention is not limited to this assumption.

이때 도 1과 도 2를 함께 참고하면, 도 1의 질의 번역기(240) 및 응답 엔진(260) 중 적어도 하나 이상은 상호 협력하여, 또는 단독으로 구조화된 질의에 따른 검색 결과에 기반하여 보조적인 구조화된 질의를 추가로 생성할 수 있고 이에 따른 지능형 응답을 사용자(100)에게 제공할 수 있다. 예를 들어 질의 검색 결과 적절한 수의 결과가 검색되면 원본 검색 결과가 그대로 사용자(100)에게 제공될 수 있고, 적절한 수의 결과가 검색되지 않으면 보조 검색 결과가 함께 사용자(100)에게 제공될 수도 있다. At this time, referring to FIGS. 1 and 2 together, at least one of the query translator 240 and the response engine 260 of FIG. 1 cooperates with each other or independently performs auxiliary structuring based on the search result according to the structured query. The query may be additionally generated, and an intelligent response based thereon may be provided to the user 100. For example, if an appropriate number of results are retrieved as a query search result, the original search result may be provided to the user 100 as it is, and if an appropriate number of results are not retrieved, an auxiliary search result may be provided to the user 100 together. .

사용자(100)는 첫번째 질의 응답 결과를 수신한 후 두번째 질의를 입력할 수 있다. 이때 사용자(100)는 무엇에 대한 검색인 지를 일부 생략한 채로 자연어 질의를 입력할 수 있고, DBMS(200)는 스키마 관계에 기반하여 사용자(100)의 의도에 부합하는 구조화된 질의를 생성하고, 데이터베이스에서 질의를 검색하고, 질의 응답 결과를 사용자(100)에게 제공할 수 있다. The user 100 may input a second query after receiving the first query response result. At this time, the user 100 may input a natural language query while partially omitting what the search is for, and the DBMS 200 generates a structured query that meets the user 100's intention based on the schema relationship, A query may be retrieved from the database, and a query response result may be provided to the user 100 .

도 3은 본 발명의 일 실시예에 따른 자연어 질의 처리 장치에 의하여 실행되는 자연어 질의 처리 과정을 설명하기 위한 가상의 사용자에 의한 등가적인 질의 생성 과정을 도시하는 개념도이다.3 is a conceptual diagram illustrating a process of generating an equivalent query by a virtual user to explain a process of processing a natural language query executed by a natural language query processing apparatus according to an embodiment of the present invention.

도 3을 참조하면, 본 발명의 일 실시예에 따른 자연어 질의 처리 장치에 사용자(100)는 자연어 질의를 입력할 수 있다. 이때 자연어 질의 처리 장치 내부의 동작을 설명하기 위하여 가상의 사용자(120)를 가정한다. 가상의 사용자(120)는 사용자(100)의 자연어 질의에 응답하여 구조화된 질의를 생성할 수 있다. Referring to FIG. 3 , a user 100 may input a natural language query to the natural language query processing apparatus according to an embodiment of the present invention. In this case, a virtual user 120 is assumed to explain the internal operation of the natural language query processing device. Virtual user 120 may generate a structured query in response to user 100's natural language query.

가상의 사용자(120)가 생성하는 구조화된 질의는 도 3의 시스템 내에서 사용자(100)의 자연어 질의와 등가적인 질의일 수 있다. The structured query generated by the virtual user 120 may be a query equivalent to the natural language query of the user 100 in the system of FIG. 3 .

도 3의 실시예를 달리 설명하면, 종래 기술에서는 가상의 사용자(120)는 도 3에서 도시된 것처럼 구조화된 질의를 직접 작성하여 입력할 필요가 있었다. 이때 가상의 사용자(120)는 300,000건 이상의 거래가 발생한 도시를 확인하기 위하여, 해당 사용자는 세 개의 테이블 스키마를 숙지해야 하고 복잡한 중첩 SQL질의를 작성할 수 있어야 함을 알 수 있다. In other words, in the prior art, the virtual user 120 needs to directly write and input a structured query as shown in FIG. 3 . At this time, the virtual user 120 can know that in order to identify a city where more than 300,000 transactions have occurred, the corresponding user must be familiar with three table schemas and must be able to write a complex nested SQL query.

그러나 일반 대중들은 SQL 언어에 대해 알지 못하며, SQL 질의에 대한 지식을 가진 전문가일 지라도 데이터베이스의 특수성까지를 고려하여 자신의 의도를 정확히 반영한 질의를 작성하는 것은 쉽지 않다. However, the general public does not know about the SQL language, and it is not easy for even experts with knowledge of SQL queries to write queries that accurately reflect their intentions, taking into account the uniqueness of databases.

또한, 종래 기술의 DBMS의 사용자는 SQL 질의를 제대로 작성하였는지 스스로 확인하기 어렵다. In addition, it is difficult for users of the prior art DBMS to check whether they have correctly written SQL queries.

예를 들어 가상의 사용자(120)가 SQL 기반 질의를 정확히 작성하더라도, DBMS가 반환하는 질의 응답 결과가 검색 결과 없음으로 제공될 경우에 사용자는 본인이 SQL 질의를 정확히 작성하였는지 확신할 수 없을 것이다. For example, even if the virtual user 120 correctly writes the SQL-based query, if the query response result returned by the DBMS is provided as no search result, the user may not be sure that the user 120 correctly writes the SQL query.

하지만 도 3의 실시예에서는 사용자(100)는 DBMS(200)에 자연어로 질의를 할 수 있고, 사용자(200)는 자신이 원하는 정보를 말로 정확하게 표현할 수 있으며 복잡한 하위 데이터베이스(테이블)의 스키마를 이해할 필요가 없다.However, in the embodiment of FIG. 3, the user 100 can query the DBMS 200 in natural language, the user 200 can accurately express desired information in words, and understand the schema of a complex sub-database (table). no need.

본 발명의 일 실시예에서는 신경망 기반의 자연어 처리 기술을 이용할 수 있다. 이러한 자연어 처리 기술은 공지된 트랜스포머 신경망 등을 이용할 수 있으며, 필요에 따라 본 발명의 구성의 일부로서 포함될 수 있다. In one embodiment of the present invention, a neural network-based natural language processing technique may be used. Such natural language processing technology may use a known transformer neural network or the like, and may be included as part of the configuration of the present invention, if necessary.

최근 몇 년간 신경망 기반의 여러 자연어 질의 번역 기술들이 등장하였다. 초기에는 순환 신경망/장단기 기억 네트워크(recurrent neural networks/Long Short Term Memory networks) 기반의 연구들이 소개되었으나, 입력 길이가 길어졌을 때 기울기 폭주/손실(gradient exploding/vanishing) 문제가 발생하여 최근 연구에서는 트랜스포머 구조의 신경망이 많이 사용되고 있다. In recent years, several natural language query translation technologies based on neural networks have emerged. In the early days, studies based on recurrent neural networks/Long Short Term Memory networks were introduced, but when the input length became long, gradient exploding/vanishing problems occurred. Structured neural networks are widely used.

트랜스포머 구조를 활용하는 대표적인 기술로 RAT-SQL이 있다. RAT-SQL은 인코더-디코더(encoder-decoder) 모델로 자연어 질의와 스키마를 사전 학습된 언어 모델 BERT에 동시에 넣어 의미 표현(meaning representation)을 계산하고 관계 인식 트랜스포머 신경망을 이용하여 입력 토큰들간의 명시적인 관계정보를 활용하여 토큰들의 최종 의미 표현을 계산한다. RAT-SQL is a representative technology that utilizes the transformer structure. RAT-SQL is an encoder-decoder model that simultaneously puts a natural language query and schema into a pre-learned language model BERT to calculate a meaning representation, and uses a relational recognition transformer neural network to express explicit information between input tokens. Calculate the final semantic expression of tokens using relational information.

자연어 질의와 스키마를 종래 기술의 트랜스포머 신경망에 입력하기 위해서는 스키마 정보를 연속적인 단어로 만들어 토큰화 과정을 거쳐야 한다. RAT-SQL은 schema에 포함되는 테이블 이름과 컬럼 이름을 일렬로 나열하여 [SEP](분리자)라는 특별한 토큰을 사이에 두고 자연어 질의와 연결한다. In order to input a natural language query and schema into a transformer neural network of the prior art, schema information must be formed into continuous words and undergo a tokenization process. RAT-SQL lists the table names and column names included in the schema in a row and connects them with a natural language query with a special token called [SEP] (separator) in between.

또한, 관계인식 트랜스포머를 사용하기 위해서는 토큰들끼리의 명시적인 관계를 추출해야 하는데, 스키마 토큰들 사이의 관계는 스키마 그래프 상의 연결 관계를 사용하고, 자연어 질의와 스키마 토큰 사이의 관계는 스키마 링킹(schema-linking)을 통해 알아낸다. 이렇게 계산된 최종 의미 표현을 가지고 디코더에서 SQL phrase를 순차적으로 생성한다. In addition, in order to use a relation-aware transformer, an explicit relationship between tokens must be extracted. The relationship between schema tokens uses a connection relationship on the schema graph, and the relationship between a natural language query and schema tokens is schema linking (schema -linking) to find out. With the final semantic expression calculated in this way, the decoder sequentially generates SQL phrases.

RAT-SQL 이후 다양한 자연어 질의 번역 기술들이 추가로 등장하고 있으나, 대부분 RAT-SQL의 인코더 방식을 따른다. 인코딩 방식에서 모델 파라미터(model parameter)를 효과적으로 초기화하는 방식이 제안되었고, 이후 디코더가 새롭게 제안되었다. Although various natural language query translation technologies have been added since RAT-SQL, most of them follow the RAT-SQL encoder method. A method of effectively initializing model parameters in an encoding method was proposed, and then a decoder was newly proposed.

RAT-SQL 모델은 사전 학습된 언어 모델 BERT를 활용해 자연어 질의 번역 성능을 많이 끌어 올릴 수 있다. The RAT-SQL model can greatly increase the translation performance of natural language queries by utilizing the pretrained language model BERT.

하지만 종래 기술인 RAT-SQL이 BERT를 사용하는 방식은 몇 가지의 문제점이 있다. However, the prior art RAT-SQL method using BERT has several problems.

첫 번째로 BERT는 자연어 문장을 받도록 학습되었는데 RAT-SQL은 자연어 질의 문장과 함께 테이블과 컬럼 이름을 나열하여 입력받는다. 이러한 경우 BERT는 새로운 입력 형식에 대해서 효과적인 의미 표현을 추출하기 위하여 추가학습을 해야 하지만 자연어 질의와 스키마 쌍에 대한 학습 데이터가 많지 않다. First, BERT is trained to receive natural language sentences, and RAT-SQL receives input by enumerating table and column names together with natural language query sentences. In this case, BERT needs additional training to extract effective semantic expressions for new input formats, but there is not much training data for natural language queries and schema pairs.

두 번째로 BERT는 입력 길이는 토큰 개수 512개로 제한이 있어 현재와 같은 구조는 컬럼과 테이블의 개수가 많은 스키마에 대해서는 적용이 불가능하다는 단점이 있다. Second, BERT has a disadvantage that the input length is limited to 512 tokens, so the current structure cannot be applied to a schema with a large number of columns and tables.

세 번째로는 입력 토큰들의 관계정보를 효과적으로 사용하지 못한다는 단점이 있다. Thirdly, there is a disadvantage that the relationship information of input tokens cannot be used effectively.

종래 기술인 RAT-SQL은 컬럼과 테이블을 비롯한 토큰들 사이의 연결 관계를 활용하기 위해서 관계 인식 트랜스포머에 토큰끼리의 연결 관계를 명시적으로 입력할 수 있다. RAT-SQL, which is a prior art, can explicitly input a connection relationship between tokens to a relation recognition transformer in order to utilize a connection relationship between tokens including columns and tables.

하지만, 관계 인식 트랜스포머는 인코더의 뒤편에서 사용되는 모듈로, 입력 토큰이 처음 주어진 앞부분에서 토큰들 간의 관계정보가 전혀 활용되지 않는다는 문제가 있다. 이러한 모델 구조는 잘못된 중간 의미 표현을 만들어 모델의 뒷부분에 영향을 줄 가능성이 높다.However, the relationship-aware transformer is a module used at the back of the encoder, and there is a problem in that the relationship information between tokens is not utilized at all in the front part where the input token is first given. Such a model structure is likely to affect the later part of the model by creating incorrect intermediate semantic representations.

또 다른 종래 기술들은 자연어 질의를 해석하는 과정을 고도화하기 위하여 메타 데이터 또는 스키마를 이용한다. 예를 들어 앞에서 설명한 한국등록특허 KR 10-2150908호 "자연어 질의해석 방법 및 시스템"에서는 형태소 분석에 기반하여 결정되는 각 자연어 텀들의 제1 유형들을 스키마를 이용하여 더욱 상세한 하위 유형들인 제2 유형/성분 패턴으로 구체화하는 구성이 개시된다. Another prior art uses meta data or schema to enhance the process of interpreting a natural language query. For example, in Korean Registered Patent No. KR 10-2150908 "Natural Language Query Interpretation Method and System" described above, the first types of each natural language term determined based on morpheme analysis are further detailed second type/subtypes using a schema. Configurations embodied in component patterns are disclosed.

그러나 이러한 종래 기술들은 자연어 질의를 구성하는 각 텀들의 의미를 더욱 상세하게 추출할 수는 있지만 여전히 구조화된 질의(예를 들어 SQL 질의)를 생성하기 위하여 필요한 정보를 모두 추출하지는 못한다. However, although these conventional techniques can extract the meaning of each term constituting a natural language query in more detail, they still cannot extract all information required to generate a structured query (eg, SQL query).

이러한 종래 기술의 문제점을 해결하기 위하여 본 발명은 자연어 질의 처리 장치를 고도화할 수 있는 새로운 내부 구조를 제안한다. In order to solve the problems of the prior art, the present invention proposes a new internal structure capable of upgrading a natural language query processing apparatus.

도 4는 본 발명의 일 실시예에 따른 자연어 질의 처리 장치의 내부 구조로서 자연어 처리를 위한 언어 모델, 스키마 인코더, 및 교차 어텐션(Cross-attention) 계층을 도시하는 개념도이다. 4 is a conceptual diagram illustrating a language model, a schema encoder, and a cross-attention layer for natural language processing as an internal structure of a natural language query processing apparatus according to an embodiment of the present invention.

도 4는 본 발명의 일 실시예의 트랜스포머 신경망 기반 자연어 질의와 관계형 데이터베이스를 의미 있는 표현으로 인코딩하는 장치의 자연어 질의와 스키마를 각자 인코딩한 후 두 관계를 고려하여 의미 표현을 다시 계산하는 과정을 설명하기 위한 개념도이다. 도 4에서는 도시되지 않았지만 도 4의 각 구성요소들은 프로세서와 전자적으로 연결되고, 프로세서에 의하여 각 구성요소들의 동작 및 기능이 제어 및 관리될 수 있다.4 illustrates a process of encoding a natural language query and a schema of an apparatus for encoding a transformer neural network-based natural language query and a relational database into a meaningful expression according to an embodiment of the present invention, and then recalculating a semantic expression in consideration of the two relationships. It is a concept for Although not shown in FIG. 4 , each component of FIG. 4 may be electronically connected to a processor, and operations and functions of each component may be controlled and managed by the processor.

도 4를 참조하면, 본 발명의 일 실시예에 따른 자연어 질의 처리 장치는 사용자(100)에 의하여 입력된 자연어 질의를 수신하고, 자연어 질의에 기반하여 구조화된 질의를 생성하는 질의 번역기(240)일 수 있다. Referring to FIG. 4 , the natural language query processing apparatus according to an embodiment of the present invention is a query translator 240 that receives a natural language query input by a user 100 and generates a structured query based on the natural language query. can

본 발명의 일 실시예에 따른 자연어 질의 처리 장치는 자연어 질의에 기반하여 구조화된 질의를 생성함에 있어서, 자연어 질의에 대한 1) 자연어 처리 결과 및 자연어 질의와 관련되는 데이터베이스 내의 하위 데이터베이스 간의 관계에 기반하여 추출되는 스키마 관계의 상호 간에 생성되는 2) 교차 어텐션 결과를 이용하여 구조화된 질의를 생성할 수 있다. In generating a structured query based on a natural language query, a natural language query processing apparatus according to an embodiment of the present invention generates a structured query based on 1) a natural language query result based on a relationship between a natural language query result and a sub-database in a database related to the natural language query. A structured query can be created using the result of 2) cross attention generated between extracted schema relationships.

본 발명의 일 실시예에 따른 자연어 질의 처리 장치는 자연어 처리 결과의 스키마 관계와의 관련도를 나타내는 제1 교차 어텐션 결과, 및 스키마 관계의 자연어 처리 결과와의 관련도를 나타내는 제2 교차 어텐션 결과를 이용하여 구조화된 질의를 생성할 수 있고, 교차 어텐션 결과는 제1 교차 어텐션 결과 및 제2 교차 어텐션 결과를 포함할 수 있다. A natural language query processing apparatus according to an embodiment of the present invention includes a first cross-attention result indicating the degree of relevance of a natural language processing result to a schema relationship, and a second cross-attention result indicating a degree of relevance of a schema relationship to a natural language processing result. A structured query may be created using the query, and the cross-attention result may include a first cross-attention result and a second cross-attention result.

본 발명의 일 실시예에 따른 자연어 질의 처리 장치는 자연어 질의에 기반하여 자연어 처리 결과를 생성하는 자연어 처리 모델로서 언어 모델(244); 및 스키마 관계를 출력하는 스키마 인코더(242) 모델을 더 포함할 수 있다. A natural language query processing apparatus according to an embodiment of the present invention includes a language model 244 as a natural language processing model that generates a natural language processing result based on a natural language query; and a schema encoder 242 model that outputs a schema relationship.

스키마 인코더(242) 모델은 입력 스키마 그래프에 기반하여 스키마 의미 표현을 스키마 관계로서 출력할 수 있다. The schema encoder 242 model may output a schema semantic expression as a schema relationship based on an input schema graph.

자연어 처리 모델인 언어 모델(244)은 자연어 질의의 전처리 결과를 입력받고 자연어 요소(예를 들어 파싱된 단어, 형태소, 토큰) 의미 표현을 자연어 처리 결과로서 출력할 수 있다. The language model 244 , which is a natural language processing model, may receive a preprocessing result of a natural language query and output semantic expressions of natural language elements (eg, parsed words, morphemes, and tokens) as a natural language processing result.

본 발명의 일 실시예에 따른 자연어 질의 처리 장치는 자연어 처리 결과의 스키마 관계와의 관련도를 나타내는 제1 교차 어텐션 결과를 생성하는 제1 교차 어텐션 계층(246); 및 스키마 관계의 자연어 처리 결과와의 관련도를 나타내는 제2 교차 어텐션 결과를 생성하는 제2 교차 어텐션 계층(248)을 더 포함할 수 있다. A natural language query processing apparatus according to an embodiment of the present invention includes a first cross-attention layer 246 generating a first cross-attention result indicating a degree of relevance of a result of natural language processing with a schema relationship; and a second cross-attention layer 248 generating a second cross-attention result indicating a degree of relevance of the schema relationship with the natural language processing result.

자연어 처리 모델인 언어 모델(244)은 내부에 셀프 어텐션의 기능을 가지는 제1 내부 어텐션 계층을 포함할 수 있고, 스키마 인코더(242) 모델은 내부에 셀프 어텐션 및 교차 어텐션 중 적어도 하나 이상의 기능을 가지는 제2 내부 어텐션 계층을 포함할 수 있다. The language model 244, which is a natural language processing model, may include a first inner attention layer having a self-attention function therein, and the schema encoder 242 model has at least one of self-attention and cross-attention functions therein. A second inner attention layer may be included.

도 5는 본 발명의 일 실시예에 따른 자연어 질의 처리 장치의 내부 구조로서 언어 모델의 내부 파라미터의 업데이트가 차단되는 경우를 도시하는 개념도이다.5 is a conceptual diagram illustrating an internal structure of a natural language query processing apparatus according to an embodiment of the present invention, when updating of internal parameters of a language model is blocked.

본 발명의 일 실시예에 따른 자연어 질의 처리 장치는 제1 내부 어텐션 계층의 출력에 기반한 자연어 처리 모델/언어 모델(244) 내부의 파라미터의 업데이트를 차단할 수 있다. The natural language query processing apparatus according to an embodiment of the present invention may block updating of internal parameters of the natural language processing model/language model 244 based on the output of the first internal attention layer.

본 발명의 일 실시예에 따른 자연어 질의 처리 장치는 교차 어텐션 결과에 기반한 자연어 처리 모델/언어 모델(244) 내부의 파라미터의 업데이트를 차단할 수 있다. The natural language query processing apparatus according to an embodiment of the present invention may block updating of internal parameters of the natural language processing model/language model 244 based on a cross-attention result.

도 5를 참조하면, 자연어 처리 과정과 스키마 인코딩 과정이 분리됨으로써 스키마 인코더(242) 모델만 자연어 처리 과정과 독립적으로 사전 학습할 수 있다. 이는 본 발명과 종래 기술을 구분하는 큰 차이점으로서 본 발명의 실시예에 따른 자연어 질의 처리 기법을 더욱 고도화할 수 있는 요소이기도 하다. Referring to FIG. 5 , since the natural language processing process and the schema encoding process are separated, only the schema encoder 242 model can be pre-learned independently of the natural language processing process. This is a big difference between the present invention and the prior art, and is also a factor that can further advance the natural language query processing technique according to the embodiment of the present invention.

스키마 인코더(242) 모델의 사전 학습 과정을 자연어 처리 과정과 분리함으로써, 웹에서 쉽게 구할 수 있는 하위 데이터베이스(테이블)의 정보로부터 스키마를 생성하여 스키마 인코더(242) 모델을 비지도 학습할 수 있다. 스키마 인코더(242) 모델을 사전 학습함으로써 종래 기술의 문제점이었던 스키마 입력 형태가 사전 학습된 모델의 입력 형태와 맞지 않는 문제가 해결될 수 있다. By separating the pre-learning process of the schema encoder 242 model from the natural language processing process, the schema encoder 242 model can be unsupervised by generating a schema from information in a lower database (table) that can be easily obtained from the web. By pre-learning the schema encoder 242 model, a problem in the prior art that the schema input form does not match the input form of the pre-learned model can be solved.

사전 학습을 위한 2가지 학습 과정은, 마스크 컬럼 모델링(masked column modeling) 및/또는 테이블 관계 예측(table relationship prediction)을 이용할 수 있다. Two learning processes for pre-learning may use masked column modeling and/or table relationship prediction.

테이블 내의 연관성을 학습할 수 있는 마스크 컬럼 모델링은 마스크 언어 모델링과 유사하게 15%의 확률로 테이블 컬럼의 이름을 마스킹한 후 해당 컬럼의 이름을 예측하는 방식으로 수행될 수 있다. 이때 컬럼의 이름을 예측하기 위하여 사용되는 의미 표현으로는 BERT를 통과한 이후에 2층의 완전 연결 계층(fully-connected layer)를 통해서 나온 의미 표현이 이용될 수 있고, 모델이 마스킹된 컬럼의 이름을 예측하는 분류문제를 풀도록 제어될 수 있다. Similar to mask language modeling, mask column modeling capable of learning associations in tables can be performed by masking table column names with a probability of 15% and then predicting the corresponding column names. At this time, as the semantic expression used to predict the name of the column, the semantic expression obtained through the fully-connected layer of the second layer after passing through BERT can be used, and the name of the column masked by the model It can be controlled to solve a classification problem that predicts .

테이블 간의 연결성을 잘 이해하기 위한 학습으로서 수행될 수 있는 테이블 관계 예측 기법은 관계 인식 트랜스포머에 들어가는 관계 정보를 15%의 확률로 마스킹하고, 해당 위치에 어떤 관계가 배치되어야 하는 지 맞추는 분류문제를 모델이 풀도록 제어됨으로써 수행될 수 있다. The table relationship prediction technique, which can be performed as a learning to understand the connectivity between tables, masks the relationship information entering the relationship recognition transformer with a probability of 15%, and models the classification problem to match which relationship should be placed in the corresponding position. This can be performed by being controlled to solve.

마스크 컬럼 모델링(masked column modeling) 및/또는 테이블 관계 예측(table relationship prediction)의 더욱 구체적인 과정은 후술할 도 10 내지 도 13에 의하여 설명하기로 한다. A more specific process of masked column modeling and/or table relationship prediction will be described with reference to FIGS. 10 to 13 to be described later.

다시 도 4 및 도 5를 참조하면, 본 발명의 일 실시예에 따른 자연어 질의 처리 장치는 인코딩 단계에서 자연어 질의의 자연어 관계와 스키마 관계를 개별적으로 고려하여 인코딩 결과를 생성할 수 있다. 언어 모델(244) 및 스키마 인코더(242)는 서로 독립적으로 각자의 입력에 대한 의미 표현을 계산할 수 있다. Referring back to FIGS. 4 and 5 , the natural language query processing apparatus according to an embodiment of the present invention may generate an encoding result by individually considering the natural language relationship and the schema relationship of the natural language query in the encoding step. The language model 244 and the schema encoder 242 may independently calculate semantic representations for their respective inputs.

자연어 질의에 기반하여 구조화된 질의를 효과적으로 생성하기 위해서는, 스키마와 자연어 간의 관련성을 정확히 인식하는 것이 중요하다. 이를 위하여 본 발명의 일 실시예에 따른 자연어 질의 처리 장치는 교차 어텐션 (cross-attention)을 이용할 수 있다. In order to effectively create a structured query based on a natural language query, it is important to accurately recognize the relationship between a schema and a natural language. To this end, the natural language query processing apparatus according to an embodiment of the present invention may use cross-attention.

본 발명의 일 실시예에 따른 자연어 질의 처리 장치는 교차 어텐션을 이용하여 각각 인코딩된 두 입력(자연어 처리 결과 및 스키마 관계) 간의 정보가 서로 참조되어 활용될 수 있도록 구성될 수 있다. 교차 어텐션에서 어텐션 점수(attention score)를 계산하는 수학식은 관계 정보를 뜻하는 r을 포함할 수 있다. 이때 관계 정보 r로서 스키마 링킹을 통해서 계산된 관계가 이용될 수 있다. 교차 어텐션을 활용해 자연어 처리 관계와 스키마 관계의 최종적인 의미 표현이 계산될 수 있다. A natural language query processing apparatus according to an embodiment of the present invention may be configured so that information between two inputs (a result of natural language processing and a schema relationship) respectively encoded using cross attention can be referenced and utilized. An equation for calculating an attention score in cross attention may include r denoting relationship information. In this case, a relationship calculated through schema linking may be used as relationship information r. The final semantic expression of the natural language processing relationship and the schema relationship can be calculated using cross attention.

이와 같은 구성을 통하여 본 발명의 실시예는 자연어 질의를 SQL 질의와 같은 규격화/구조화된 질의로 번역하는데 있어서 필요한 자연어 처리 결과와 데이터베이스 스키마에 대한 의미 표현을 더욱 정확하게 계산하여 번역 시스템의 성능을 높일 수 있다. Through this configuration, the embodiment of the present invention can more accurately calculate the natural language processing result and the semantic expression for the database schema necessary for translating a natural language query into a standardized/structured query such as an SQL query, thereby improving the performance of the translation system. there is.

도 6은 본 발명의 일 실시예에 따른 자연어 질의 처리 장치의 내부 구조로서 교차 어텐션 결과에 기반하여 구조화된 질의를 생성하는 디코더 계층을 더 포함하는 실시예를 도시하는 개념도이다.6 is a conceptual diagram illustrating an embodiment further including a decoder layer generating a structured query based on a result of cross attention as an internal structure of a natural language query processing apparatus according to an embodiment of the present invention.

본 발명의 일 실시예에 따른 자연어 질의 처리 장치는 교차 어텐션 결과에 기반하여 구조화된 질의를 생성하는 디코더 계층(250)을 더 포함할 수 있다. The apparatus for processing a natural language query according to an embodiment of the present invention may further include a decoder layer 250 that generates a structured query based on a cross attention result.

도 4 내지 도 6의 실시예를 참조하면, 구조화된 질의를 생성하기 위하여 자연어 질의 내의 자연어 처리 결과 및 자연어 질의에 직접적으로 포함되지 않을 수 있는 스키마 관계를 상호 참조하여 추가적으로 의미 표현을 인코딩할 수 있다. 스키마 관계는 자연어 질의 내에 포함되는 정보 및 자연어 질의 내에 포함되지 않는 정보를 모두 포함할 수 있다. Referring to the embodiments of FIGS. 4 to 6 , in order to generate a structured query, a semantic expression may be additionally encoded by cross-referencing a natural language processing result in a natural language query and a schema relationship that may not be directly included in the natural language query. . The schema relationship may include both information included in the natural language query and information not included in the natural language query.

스키마 관계에 대한 자연어 처리 결과의 제2 교차 어텐션(248)을 이용하여 스키마 관계 중 자연어 질의 번역을 위하여 집중해야 할 하위 데이터베이스(테이블/컬럼) 정보가 얻어질 수 있다. 결과적으로 전체 스키마 중 일부분의 테이블/컬럼이 유의미하게 선택되어 이용될 수 있다. Sub-database (table/column) information to be focused on for natural language query translation among schema relationships may be obtained by using the second intersection attention 248 of the natural language processing result for the schema relationship. As a result, some tables/columns from the entire schema can be selected and used meaningfully.

자연어 처리 결과에 대한 스키마 관계의 제1 교차 어텐션(246)을 이용하여 자연어 질의를 구성하는 자연어 요소(파싱 결과, 단어, 형태소, 토큰)들 중 어떤 요소가 어떤 테이블/컬럼과 관련되는 지에 대한 정보를 얻을 수 있다. 이때 얻어지는 자연어 질의 내의 단어와 데이터베이스 내의 테이블/컬럼 간의 의미 대응 관계를 이용하여 구조화된 질의가 생성될 수 있다. Information on which of the natural language elements (parsing result, word, morpheme, token) constituting the natural language query is related to which table/column by using the first cross attention 246 of the schema relationship for the natural language processing result can be obtained. At this time, a structured query may be created using a semantic correspondence between words in a natural language query and tables/columns in a database.

도 7은 본 발명의 일 실시예에 따른 자연어 질의 처리 장치에 의하여 실행되는 자연어 질의 처리 방법을 도시하는 동작 흐름도이다.7 is an operational flowchart illustrating a natural language query processing method executed by a natural language query processing apparatus according to an embodiment of the present invention.

본 발명의 일 실시예에 따른 자연어 질의 처리 방법은 프로세서(processor)를 포함하는 컴퓨팅 시스템에 의하여 실행될 수 있다. 본 발명의 일 실시예에 따른 자연어 질의 처리 방법은 사용자(100)에 의하여 입력되는 자연어 질의를 수신하는 단계(S310); 및 자연어 질의에 기반하여 구조화된 질의를 생성하는 단계(S320)를 포함하고, 구조화된 질의를 생성하는 단계(S320)는, 자연어 질의에 대한 자연어 처리 결과를 획득하는 단계(S340); 자연어 질의와 관련되는 데이터베이스 내의 하위 데이터베이스(테이블/컬럼) 간의 관계에 기반하여 추출되는 스키마 관계를 획득하는 단계(S330)); 자연어 처리 결과 및 스키마 관계의 상호 간에 생성되는 교차 어텐션 결과를 획득하는 단계(S350); 및 교차 어텐션 결과를 이용하여 구조화된 질의를 생성하는 단계(S360)를 포함한다. A natural language query processing method according to an embodiment of the present invention may be executed by a computing system including a processor. A natural language query processing method according to an embodiment of the present invention includes receiving a natural language query input by a user 100 (S310); and generating a structured query based on the natural language query (S320), wherein generating the structured query (S320) includes obtaining a natural language processing result for the natural language query (S340); Obtaining a schema relationship extracted based on a relationship between lower databases (tables/columns) in the database related to the natural language query (S330)); Obtaining a cross-attention result generated between the natural language processing result and the schema relationship (S350); and generating a structured query using the cross attention result (S360).

도 8은 도 7의 단계 S350 및 그 전후의 과정을 더욱 상세하게 도시하는 동작 흐름도이다.FIG. 8 is an operation flow chart showing steps S350 of FIG. 7 and the processes before and after it in more detail.

교차 어텐션 결과를 획득하는 단계(S350)는, 자연어 처리 결과의 스키마 관계와의 관련도를 나타내는 제1 교차 어텐션 결과를 획득하는 단계(S352); 및 스키마 관계의 자연어 처리 결과와의 관련도를 나타내는 제2 교차 어텐션 결과를 획득하는 단계(S354)를 포함할 수 있다. Obtaining a cross-attention result (S350) may include obtaining a first cross-attention result indicating a degree of relevance of a result of natural language processing with a schema relationship (S352); and acquiring a second cross-attention result indicating the degree of relevance of the schema relationship with the natural language processing result (S354).

스키마 관계를 획득하는 단계(S330)에서는, 입력 스키마 그래프에 기반하여 스키마 의미 표현이 스키마 관계로서 획득될 수 있다. 자연어 처리 결과를 획득하는 단계(S340)에서는, 자연어 질의의 전처리 결과가 입력되고 자연어 요소(파싱 결과, 단어, 형태소, 토큰) 의미 표현이 자연어 처리 결과로서 획득될 수 있다. In the step of obtaining a schema relationship ( S330 ), a schema semantic expression may be obtained as a schema relationship based on an input schema graph. In step S340 of obtaining a natural language processing result, a preprocessing result of a natural language query is input, and semantic expressions of natural language elements (parsing results, words, morphemes, and tokens) may be obtained as the natural language processing result.

자연어 처리 결과를 획득하는 단계(S340)는, 내부 어텐션 계층의 출력에 기반한 자연어 처리 모델 내부의 파라미터의 업데이트가 차단된 상태에서 수행될 수 있다. Obtaining the natural language processing result (S340) may be performed in a state in which updating of parameters within the natural language processing model based on the output of the internal attention layer is blocked.

자연어 처리 결과를 획득하는 단계(S340)는, 교차 어텐션 결과에 기반한 자연어 처리 모델 내부의 파라미터의 업데이트가 차단된 상태에서 수행될 수 있다. Obtaining the natural language processing result ( S340 ) may be performed in a state in which updating of internal parameters of the natural language processing model based on the cross attention result is blocked.

도 9는 본 발명의 다른 일 실시예에 따른 자연어 질의 처리 방법을 도시하는 동작 흐름도이다.9 is an operational flowchart illustrating a natural language query processing method according to another embodiment of the present invention.

본 발명의 일 실시예에 따른 프로세서(processor)를 포함하는 컴퓨팅 시스템에 의하여 실행되는 자연어 질의 처리 방법은 자연어 질의와 관련되는 데이터베이스 내의 하위 데이터베이스 간의 스키마 관계를 일대일(one-to-one) 대응, 및 일대다(one-to-many) 대응 중 어느 하나로서 추출하는 단계(S430); 및 스키마 관계에 기반하여 자연어 질의로부터 구조화된 질의를 생성하는 단계(S460)를 포함한다. 본 발명의 일 실시예에 따른 자연어 질의 처리 방법은, 자연어 질의를 수신하는 단계(S410)를 더 포함할 수 있다. A natural language query processing method executed by a computing system including a processor according to an embodiment of the present invention provides a one-to-one correspondence between sub-databases in a database related to a natural language query, and Extracting as one of one-to-many correspondence (S430); and generating a structured query from the natural language query based on the schema relationship (S460). The natural language query processing method according to an embodiment of the present invention may further include receiving a natural language query (S410).

본 발명의 일 실시예에 따른 자연어 질의 처리 방법은, 하위 데이터베이스 간의 비교를 통해 스키마 관계를 강제적(mandatory) 관계, 및 선택적(optional) 관계 중 어느 하나로서 예측하는 단계를 더 포함할 수 있다. The natural language query processing method according to an embodiment of the present invention may further include predicting a schema relationship as one of a mandatory relationship and an optional relationship through comparison between lower databases.

본 발명의 일 실시예에 따른 자연어 질의 처리 방법은, 하위 데이터베이스 중 제1 하위 데이터베이스에 대응하는 제1 자연어 모델 및 제2 하위 데이터베이스에 대응하는 제2 자연어 모델을 이용하여 스키마 관계를 인코딩하는 단계를 더 포함할 수 있다. A natural language query processing method according to an embodiment of the present invention includes encoding a schema relationship using a first natural language model corresponding to a first sub-database and a second natural language model corresponding to a second sub-database among sub-databases. can include more.

본 발명의 일 실시예에 따른 자연어 질의 처리 방법은, 하위 데이터베이스 중 일부에 대한 마스크 컬럼 모델링을 이용하여 스키마 관계의 적어도 일부를 미리 인코딩하는 단계를 더 포함할 수 있다. The natural language query processing method according to an embodiment of the present invention may further include pre-encoding at least a portion of a schema relationship by using mask column modeling for a portion of lower databases.

본 발명의 일 실시예에 따른 자연어 질의 처리 방법은, 자연어 질의에 기반하여 자연어 처리 결과를 획득하는 단계를 더 포함할 수 있다. 이때 구조화된 질의를 생성하는 단계는, 자연어 처리 결과 및 스키마 관계의 상호 간에 생성되는 교차 어텐션 결과를 획득하는 단계; 및 교차 어텐션 결과를 이용하여 구조화된 질의를 생성하는 단계를 포함할 수 있다. The natural language query processing method according to an embodiment of the present invention may further include obtaining a natural language processing result based on the natural language query. In this case, the generating of the structured query may include obtaining a result of natural language processing and a cross-attention result generated between schema relationships; and generating a structured query using the cross attention result.

본 발명의 일 실시예에 따른 자연어 질의 처리 방법은, 미리 학습된 언어 모델을 이용하여 자연어 질의에 기반하여 자연어 처리 결과를 획득하는 단계를 더 포함할 수 있다. 이때 자연어 처리 결과를 획득하는 단계는, 언어 모델의 내부 파라미터의 업데이트가 차단된 상태에서 수행될 수 있다. The natural language query processing method according to an embodiment of the present invention may further include obtaining a natural language processing result based on a natural language query using a pre-learned language model. In this case, the step of obtaining the natural language processing result may be performed in a state in which updating of internal parameters of the language model is blocked.

도 9의 실시예에 따르는 자연어 질의 처리 방법은 트랜스포머 신경망 기반 자연어 질의와 관계형 데이터베이스를 의미 있는 표현으로 인코딩하는 과정을 포함할 수 있다. The natural language query processing method according to the embodiment of FIG. 9 may include encoding a transformer neural network-based natural language query and a relational database into a meaningful expression.

이때 방법은 종래의 기술과 동일한 방식의 인코더를 이용할 수 있지만 결과적으로 자연어 질의와 SQL 쌍 데이터를 새롭게 만들어 사전 학습하는 방식이 제안될 수 있다. At this time, the method may use the same encoder as in the prior art, but as a result, a method of pre-learning by newly creating natural language query and SQL pair data may be proposed.

종래 기술에서 드러난 문제점인 자연어 질의와 스키마 쌍에 대한 학습 데이터의 부족, 자연어 처리 모델의 입력 토큰의 개수에 제한(컬럼과 테이블의 개수가 많은 스키마에 대해서는 적용 불가), 입력들의 관계 정보가 비효율적으로 이용되는 점을 해결하기 위하여, 본 발명의 실시예에서는 자연어 질의와 스키마를 인코딩하는 과정이 분리될 수 있다. 자연어 질의는 일반적인 자연어 문장과 유사하므로 사전 학습된 언어모델이 추가 학습 없이 이용될 수 있고 자연어 요소 의미 표현이 계산될 수 있다. Problems revealed in the prior art include lack of training data for natural language queries and schema pairs, limitations on the number of input tokens of natural language processing models (not applicable to schemas with a large number of columns and tables), and inefficient relationship information between inputs. In order to solve the problem of use, in an embodiment of the present invention, a process of encoding a natural language query and a schema may be separated. Since a natural language query is similar to a general natural language sentence, a pretrained language model can be used without additional training, and a semantic expression of a natural language element can be calculated.

스키마를 분석하기 위하여 각 테이블과 테이블에 속한 컬럼들에 대한 의미 표현이 먼저 계산되고, 관계 인식 트랜스포머 신경망을 이용하여 다른 테이블 정보와 상호 작용하여 최종 의미 표현이 계산될 수 있다. 이때 사용되는 테이블 간의 자세한 관계 정보는 전처리 과정에서 예측될 수 있다. In order to analyze the schema, a semantic expression for each table and columns belonging to the table is first calculated, and a final semantic expression may be calculated by interacting with other table information using a relational recognition transformer neural network. Detailed relationship information between the tables used at this time can be predicted in the pre-processing process.

종래 기술에서는 하나의 모델로 자연어 질의와 스키마를 동시에 인코딩을 하였기 때문에 해당 모델을 사전학습 하려면 자연어 질의와 스키마 쌍의 학습 데이터가 필요한 문제가 있었다. 하지만, 제안하는 모델은 자연어 질의와 스키마를 인코딩하는 과정/모듈이 분리되기 때문에 스키마를 인코딩하는 모듈을 독립적으로 사전 학습할 수 있다. In the prior art, since a natural language query and a schema are simultaneously encoded as one model, there is a problem in that training data of a natural language query and schema pair is required to pre-learn the corresponding model. However, since the proposed model separates the natural language query and the schema encoding process/module, the schema encoding module can be pre-learned independently.

본 발명의 실시예에서는 스키마 정보는 인터넷 등의 일반화된 데이터로부터 추출되는 테이블로부터 생성될 수 있다. 스키마 정보는 마스크 언어 모델링을 통해 비지도 학습될 수 있다. 스키마 인코더(242) 모듈만 독립적으로 사전 학습함으로써 종래 기술에서 드러난 문제점인 사전 학습된 모델과 입력 형태가 일치하지 않는 문제가 해결될 수 있다. In an embodiment of the present invention, schema information may be generated from a table extracted from generalized data such as the Internet. Schema information may be unsupervised learning through mask language modeling. By independently pre-learning only the schema encoder 242 module, the problem of mismatch between the pre-learned model and the input form, which is a problem in the prior art, can be solved.

본 발명의 실시예에서는 언어 모델(244)로 자연어 질의와 테이블 정보를 각각 인코딩하기 때문에 길이 제한을 초과하지 않고 다수의 테이블로 구성된 스키마를 처리할 수 있다. In the embodiment of the present invention, since the language model 244 encodes a natural language query and table information, a schema composed of a plurality of tables can be processed without exceeding the length limit.

본 발명의 실시예에서는 테이블 단위로 먼저 인코딩하고 각 테이블의 연관성을 고려한 관계인식 트랜스포머를 활용해 스키마를 인코딩하기 때문에 종래 기술에서 드러나는 문제점인 테이블 간 연결 관계 고려 없이 상호 작용이 일어나는 문제가 발생하지 않는다.In the embodiment of the present invention, the problem of interaction without considering the connection relationship between tables, which is a problem revealed in the prior art, does not occur because the schema is encoded using a relational recognition transformer that encodes in table units first and considers the association of each table. .

본 발명의 실시예에 따르면, 자연어 질의와 스키마가 주어지면 전처리 과정을 통해서 입력 값들 간의 관계정보가 추출될 수 있다. According to an embodiment of the present invention, when a natural language query and a schema are given, relational information between input values may be extracted through a preprocessing process.

전처리 과정은 스키마 링킹 및 스키마 관계 추출을 포함할 수 있다. The pre-processing process may include schema linking and schema relation extraction.

스키마 링킹에서는 자연어 질의에 있는 단어w 들과 테이블t 또는 컬럼c 간의 관계정보가 얻어질 수 있다. In schema linking, relational information between words w in a natural language query and table t or column c can be obtained.

스키마 관계 추출에서는 테이블과 컬럼의 포함 관계, 스키마 그래프에 있는 기본 키-외래 키(primary-foreign key), 그리고 테이블 레코드(record)를 통해서 알아내는 테이블 간의 관계가 추출될 수 있다. In schema relation extraction, relations between tables found through the inclusion relation between tables and columns, primary-foreign keys in the schema graph, and table records can be extracted.

전처리가 끝나면 자연어 질의는 사전 학습된 언어 모델(244)에 의하여 인코딩되어 자연어 처리 결과가 생성될 수 있다. 사전 학습된 스키마 인코더(242)에 의하여 스키마 관계가 얻어질 수 있다. 자연어 처리 결과는 자연어 요소 의미 표현으로서 계산되고, 스키마 관계는 스키마 의미 표현으로서 계산될 수 있다. After the preprocessing is finished, the natural language query is encoded by the pretrained language model 244, and a natural language processing result may be generated. A schema relationship may be obtained by the pretrained schema encoder 242 . A natural language processing result may be calculated as a semantic expression of a natural language element, and a schema relation may be calculated as a semantic expression of a schema.

스키마 의미 표현을 계산할 때 전처리 단계에서 추출된 테이블 관계가 이용될 수 있다. Table relationships extracted in the preprocessing step can be used when calculating the schema semantic expression.

각 입력에 대한 의미 표현이 일차적으로 계산이 완료되면, 관계 인식 트랜스포머를 통해서 자연어 질의와 스키마 간의 정보 교환을 통해서 두 입력의 최종 의미 표현이 계산될 수 있다. 이때 전처리 단계인 스키마 링킹에서 추출한 정보에 기반하여 자연어 질의의 어떤 단어가 어떤 스키마 개체와 연관이 있는지 정보가 얻어질 수 있다. When the calculation of the semantic expression for each input is primarily completed, the final semantic expression of the two inputs may be calculated through information exchange between the natural language query and the schema through the relation recognition transformer. At this time, information on which word of the natural language query is related to which schema entity may be obtained based on information extracted in schema linking, which is a preprocessing step.

이때 전처리 과정 중 일부인 스키마 링킹 과정은 공지의 기술인 KR 10-2277787호 "신경망 기반 자연어로부터 SQL 질의 번역 시 사용되는 컬럼 및 테이블을 예측하는 방법" 및 KR 10-2345568호 "자연어 단어를 데이터베이스의 컬럼 및 테이블과 연결하는 방법"에 개시된 내용의 적어도 일부인 '자연어 문장과 데이터베이스를 단어 단위로 비교하여 매칭하는 구성'을 이용하여 실행될 수 있다. At this time, the schema linking process, which is a part of the preprocessing process, is a well-known technique, KR 10-2277787, "Method of Predicting Columns and Tables Used in Translating SQL Queries from Neural Network-Based Natural Language" and KR 10-2345568, "Natural Language Words in Database Columns and It can be executed using a 'configuration for matching by comparing a natural language sentence and a database word by word', which is at least a part of the contents disclosed in "How to connect to a table".

도 10은 본 발명의 일 실시예에 따른 자연어 질의 처리 장치에서 수행되는 자연어 질의 처리 방법에서, 자동차 관련된 자연어 질의와 스키마가 주어졌을 때의 스키마 링킹 과정의 일 실시예를 설명하기 위한 개념도이다.10 is a conceptual diagram illustrating an embodiment of a schema linking process when a natural language query and a schema related to automobiles are given in a natural language query processing method performed by a natural language query processing apparatus according to an embodiment of the present invention.

도 10은 자동차 관련된 자연어 질의와 스키마가 주어졌을 때의 스키마 링킹 예시를 도시한다. 10 illustrates an example of schema linking when a natural language query and a schema related to automobiles are given.

도 10을 참조하면, 본 발명의 일 실시예의 자연어 처리 장치 및/또는 트랜스포머 신경망 기반 자연어 질의와 관계형 데이터베이스를 의미 있는 표현으로 인코딩하는 장치에서는 입력 텍스트 전처리 과정으로 스키마 링킹 단계가 수행될 수 있다.Referring to FIG. 10 , a schema linking step may be performed as an input text preprocessing process in a natural language processing apparatus and/or an apparatus for encoding a natural language query and a relational database based on a transformer neural network according to an embodiment of the present invention into a meaningful expression.

스키마 링킹은 개체 링킹(entity linking)과 상당히 유사한 문제를 해결하는 과정으로서 연결할 개체를 지식 그래프(knowledge graph)가 아닌 스키마에서 찾는다. 즉, 자연어 질의에 있는 단어를 해당 단어가 의미하고 있는 테이블 또는 컬럼과 연결시키는 것이다. 도 10에서 볼 수 있듯이 자연어 질의의 단어는 하나 이상의 컬럼/테이블과 연결이 될 수 있다. 스키마 링킹은 여러 연구에서 이미 사용되고 있는 방식으로 본 발명에서는 필요에 따라 종래 기술의 스키마 링킹의 알고리즘을 적어도 부분적으로 이용할 수 있다. Schema linking is a process of solving a problem quite similar to entity linking, in which an entity to be linked is found in a schema rather than a knowledge graph. That is, a word in a natural language query is linked to a table or column that the word refers to. As shown in FIG. 10, words of a natural language query may be connected to one or more columns/tables. Schema linking is a scheme that has already been used in various studies, and in the present invention, a prior art schema linking algorithm can be used at least partially as needed.

스키마 링킹에서는 주어진 자연어 질의 L의 각 단어 w에 대해서 스키마에 있는 각 테이블 t들과 문자열 비교를 한다. 이때 도 10의 cylinders와 horsepower와 같이 완전히 일치하는 단어가 발견되면 이를 연결한다. 하지만 만약 완전히 일치하는 단어가 없다면 부분 일치하는 단어를 찾고 발견된 모든 개체를 연결시킨다. 이때 부분 일치하는 문자열이 아닌 단어 기준으로 연결될 수 있다. 만약 부분 일치하는 테이블이 없으면 컬럼에 대해서 같은 동작을 반복한다.In schema linking, string comparison is performed with each table t in the schema for each word w of the given natural language query L. At this time, if completely matching words such as cylinders and horsepower in FIG. 10 are found, they are connected. However, if there is no complete match, it finds a partial match and connects all found objects. At this time, it can be connected based on words rather than partial matching strings. If there is no partial matching table, the same operation is repeated for the column.

도 11은 본 발명의 일 실시예에 따른 자연어 질의 처리 장치에서 수행되는 자연어 질의 처리 방법에서, 하나의 자연어 질의가 데이터베이스 내의 하위 데이터베이스(테이블) 간의 관계에 따라 서로 다른 구조화된 질의로 번역될 수 있음을 설명하기 위한 개념도이다.11 illustrates that in a natural language query processing method performed by a natural language query processing apparatus according to an embodiment of the present invention, one natural language query can be translated into different structured queries according to relationships between sub-databases (tables) in a database. It is a conceptual diagram to explain.

도 11을 참조하면, 테이블 관계 추출은 두 테이블 간의 관계를 찾는 과정으로 정확한 질의 번역에 있어서 필요한 과정이다. 도 11에 도시된 바와 같이, 동일한 자연어 질의에 대해서 스키마의 테이블의 관계에 따라서 번역되는 SQL이 달라질 수 있다. SQL1의 경우는 student와 has_pet 테이블의 관계가 one-to-one인 경우에 맞는 번역이고 one-to-many 관계일 때는 SQL2가 올바른 번역이다.Referring to FIG. 11 , table relationship extraction is a process of finding a relationship between two tables and is a necessary process for accurate query translation. As shown in FIG. 11 , for the same natural language query, SQL to be translated may vary according to the relationship between tables in the schema. In the case of SQL1, the translation is correct when the relationship between the student and has_pet tables is one-to-one, and SQL2 is the correct translation when the relationship is one-to-many.

즉, 동일한 자연어 질의에 대해서도 student 및 pet(has_pet) 간의 관계가 one-to-one인 경우의 구조화된 질의와 student 및 pet 간의 관계가 one-to-many인 경우의 구조화된 질의는 동일하지 않다. 따라서 올바른 구조화된 질의를 생성하기 위해서는 자연어 질의에 직접적으로 포함되지 않는 스키마 관계를 더 필요로 한다. That is, even for the same natural language query, a structured query when the relationship between student and pet (has_pet) is one-to-one and a structured query when the relationship between student and pet is one-to-many are not the same. Therefore, in order to generate a correct structured query, more schema relationships that are not directly included in the natural language query are required.

도 12는 본 발명의 일 실시예에 따른 자연어 질의 처리 장치에서 수행되는 자연어 질의 처리 방법에서, 데이터베이스 레코드 값을 활용하여 하위 데이터베이스(테이블) 간의 관계를 추출하는 실시예를 도시하는 개념도이다. 12 is a conceptual diagram illustrating an embodiment of extracting relationships between lower databases (tables) by utilizing database record values in a natural language query processing method performed by a natural language query processing apparatus according to an embodiment of the present invention.

도 12를 참조하면, 본 발명의 일 실시예에서는 두 테이블 간의 관계를 추출하는 방법으로 데이터베이스 레코드 값을 활용한다. Referring to FIG. 12 , in one embodiment of the present invention, a database record value is used as a method of extracting a relationship between two tables.

기본 키로 설정된 컬럼 C1과 외래 키로 설정된 컬럼 C2가 있을 때, 테이블 레코드에서 각 컬럼에 해당하는 값들을 V1와 V2라고 한다. 이때, V2에 중복되는 값이 있으면 one-to-many, 중복되는 값이 없으면 one-to-one 관계가 추출될 수 있다. When there is a column C1 set as the primary key and column C2 set as the foreign key, the values corresponding to each column in the table record are called V1 and V2. In this case, if there is an overlapping value in V2, a one-to-many relationship may be extracted, and if there is no overlapping value, a one-to-one relationship may be extracted.

또한, V1의 집합과 V2의 집합이 일치하면 mandatory 관계, 일치하지 않으면 optional 관계가 추출/예측될 수 있다. In addition, a mandatory relationship can be extracted/predicted if the set of V1 and the set of V2 match, and an optional relationship can be extracted/predicted if they do not match.

도 12를 참조하면, student 테이블의 id와 has_pet 테이블의 student_id의 관계는 one-to-many optional인 것을 알 수 있다. has_pet 테이블과 pet 테이블의 관계는 one-to-one mandatory이다.Referring to FIG. 12, it can be seen that the relationship between id of the student table and student_id of the has_pet table is one-to-many optional. The relationship between the has_pet table and the pet table is one-to-one mandatory.

도 13은 본 발명의 일 실시예에 따른 자연어 질의 처리 장치에서 수행되는 자연어 질의 처리 방법에서, 스키마 인코딩 예시를 도시하는 개념도이다.13 is a conceptual diagram illustrating an example of schema encoding in a natural language query processing method performed by a natural language query processing apparatus according to an embodiment of the present invention.

도 13을 참조하면, 본 발명의 일 실시예에서는 의미 표현 계산 과정으로 자연어 질의 인코딩 단계와 스키마 인코딩 단계가 수행된다.Referring to FIG. 13 , in an embodiment of the present invention, a natural language query encoding step and a schema encoding step are performed as a semantic expression calculation process.

설명의 편의상 자연어 질의 인코딩은 사전 학습된 언어 모델 BERT를 통해서 진행하는 것으로 가정한다. For convenience of description, it is assumed that the encoding of natural language queries proceeds through a pretrained language model BERT.

바이트 쌍 방식의 토큰화를 통해 자연어 문장을 토큰으로 분리한다. 이때 토큰의 어휘(vocabulary)는 BERT와 같은 것을 사용한다. 그 후, 토큰으로 변환된 자연어 질의를 BERT의 입력으로 넣어 각 토큰에 대한 의미 표현을 얻을 수 있다. 이때, 문장 L에 대해서 각 단어 w에 대한 의미 표현이 계산될 수 있다. 한 단어가 여러 개의 토큰으로 분리된 경우 각 토큰의 의미 표현을 평균하여 단어 별 의미 표현이 계산될 수 있다. Natural language sentences are separated into tokens through byte-pair tokenization. At this time, the vocabulary of the token uses the same as BERT. Then, the semantic expression for each token can be obtained by inputting the natural language query converted into tokens as input to BERT. At this time, a semantic expression for each word w in the sentence L may be calculated. When a word is divided into several tokens, a semantic expression for each word may be calculated by averaging the semantic expressions of each token.

스키마 인코딩은 도 13과 같이 2가지 단계로 나누어진다. 첫번째로 사전 학습된 언어 모델 BERT을 사용하여 스키마에 S에 있는 각 테이블 t에 대한 의미 표현이 독립적으로 계산될 수 있다. 테이블 정보를 BERT에 넣어주기 위해서 테이블 정보를 문장으로 펼치는(flatten) 과정이 진행될 수 있다. 테이블 정보로는 테이블의 이름과 테이블에 속한 컬럼들의 이름이 활용될 수 있다. 테이블 정보를 문장으로 펼치는 과정은 다음과 같다. Schema encoding is divided into two steps as shown in FIG. 13 . First, using the pre-trained language model BERT, the semantic representation for each table t in S in the schema can be computed independently. In order to put table information into BERT, a process of flattening table information into sentences may be performed. As table information, the name of the table and the names of columns belonging to the table can be used. The process of unfolding table information into sentences is as follows.

먼저 [CLS](분류자)라는 특별 토큰(special token) 뒤에 테이블 이름을 토큰화하여 연결할 수 있다. 그 후, 테이블에 속한 모든 컬럼 이름들을 토큰화하여 테이블 이름 뒤에 연결할 수 있다. 이때 컬럼들 사이에 [SEP](분리자)라는 특별 토큰을 이용하여 컬럼들을 분리시킨다. 연결된 토큰들을 BERT에 입력하여 각 테이블과 컬럼에 대한 의미 표현을 계산하고, 전처리 단계에서 추출한 테이블 간의 관계, 및 테이블/컬럼 간의 관계 정보에 기반하여 관계 인식 트랜스포머를 사용하여 스키마를 다시 한 번 인코딩할 수 있다. First, you can connect by tokenizing the table name after a special token called [CLS] (classifier). After that, all column names belonging to the table can be tokenized and concatenated after the table name. At this time, columns are separated using a special token called [SEP] (separator) between columns. Connected tokens are input into BERT to calculate the semantic expression for each table and column, and based on the relationship information between tables and between tables/columns extracted in the preprocessing step, the schema is encoded again using a relationship-aware transformer. can

본 발명의 일 실시예는 트랜스포머 신경망 기반 자연어 질의와 관계형 데이터베이스를 의미 있는 표현으로 인코딩하는 방법, 및/또는 자연어 질의를 처리하는 방법을 구현하기 위한 컴퓨터 판독 가능한 기록매체에 저장된 컴퓨터 프로그램일 수 있다.An embodiment of the present invention may be a computer program stored in a computer-readable storage medium for implementing a method of encoding a transformer neural network-based natural language query and a relational database into a meaningful expression, and/or a method of processing a natural language query.

본 발명의 일 실시예는 트랜스포머 신경망 기반 자연어 질의와 관계형 데이터베이스를 의미 있는 표현으로 인코딩하는 방법, 및/또는 자연어 질의를 처리하는 방법의 프로그램을 구현하기 위한 컴퓨터 판독 가능한 기록매체일 수 있다.An embodiment of the present invention may be a computer readable recording medium for implementing a program of a method of encoding a transformer neural network-based natural language query and a relational database into a meaningful expression and/or a method of processing a natural language query.

도 1 내지 도 13의 실시예에 따르면, 테이블 간의 관계를 추출하여 올바른 구조화된 질의를 생성할 수 있다.According to the embodiments of FIGS. 1 to 13 , a correct structured query may be generated by extracting relationships between tables.

도 1 내지 도 13의 실시예에 따르면, 자연어 처리 과정의 학습과 스키마 인코딩의 학습을 분리함으로써 입력 데이터의 크기가 제한되지 않을 수 있다. 따라서 기업에서 실제로 필요로 하는 수백 개 이상의 컬럼을 이용하는 데이터베이스에 대한 자연어 질의 자동 번역 기능을 구현할 수 있다. According to the embodiments of FIGS. 1 to 13 , the size of input data may not be limited by separating learning of natural language processing and learning of schema encoding. Therefore, it is possible to implement an automatic translation function for natural language queries for databases using hundreds of columns that companies actually need.

도 1 내지 도 13의 실시예에 따르면, 사전 학습된 언어 모델을 이용한 자연어 인코딩과 관계 인식 트랜스포머를 이용한 스키마 인코딩이 제안될 수 있다.According to the embodiments of FIGS. 1 to 13 , natural language encoding using a pretrained language model and schema encoding using a relation recognition transformer may be proposed.

도 1 내지 도 13의 실시예에 따르면, 테이블 별로 언어 모델 또한 개별적으로 적용할 수 있으므로 테이블 개수에 제한 없이 인코딩이 이루어질 수 있다.According to the embodiments of FIGS. 1 to 13 , since language models can also be individually applied for each table, encoding can be performed without limitation on the number of tables.

도 1 내지 도 13의 실시예에 따르면, 예측된 테이블 간의 관계 정보를 이용하여 구조화된 질의를 생성하기 위한 인코딩이 이루어질 수 있다.According to the embodiments of FIGS. 1 to 13 , encoding for generating a structured query may be performed using relationship information between predicted tables.

도 1 내지 도 13의 실시예에 따르면, 교차 어텐션을 이용하여 스키마에서 자연어와의 관계에서 집중해야 할 하위 데이터베이스에 대한 정보를 얻을 수 있다.According to the embodiments of FIGS. 1 to 13 , information on a lower level database to be focused on in relation to a natural language in a schema may be obtained using cross attention.

도 1 내지 도 13의 실시예에 따르면, 교차 어텐션을 이용하여 자연어 중 어떤 단어에 집중해야 할 지에 대한 정보(어떤 단어가 어떤 스키마와 관련도가 높은 지에 대한 정보)를 얻을 수 있다. According to the embodiments of FIGS. 1 to 13 , cross attention can be used to obtain information on which words in natural language to focus on (information on which words are highly related to which schema).

도 1 내지 도 13의 실시예에 따르면, 교차 어텐션을 이용하여 자연어와 스키마 각각의 집중해야 할 요소들을 인식할 수 있으므로 구조화된 질의를 생성하는 과정을 고도화할 수 있다. According to the embodiments of FIGS. 1 to 13 , elements to be focused on in each of the natural language and schema can be recognized using cross attention, so that the process of creating a structured query can be advanced.

도 14는 본 발명의 일 실시예에 따른 도 1 내지 도 13의 과정의 적어도 일부를 수행할 수 있는 일반화된 자연어 처리 장치 또는 컴퓨팅 시스템을 도시하는 블록도이다. 14 is a block diagram illustrating a generalized natural language processing device or computing system capable of performing at least a part of the processes of FIGS. 1 to 13 according to an embodiment of the present invention.

도 1 내지 도 3의 실시예에서 대화 관리자(220), 질의 번역기(240), 및 응답 엔진(260)에 프로세서, 메모리와 전자적으로 연결되고 프로세서에 의하여 제어되거나 관리될 수 있음은 앞에서 설명한 바와 같다. As described above, in the embodiments of FIGS. 1 to 3, the dialogue manager 220, the query translator 240, and the response engine 260 are electronically connected to the processor and memory and can be controlled or managed by the processor. .

도 4 내지 도 13의 실시예에서도 도면 상으로는 생략되었으나 프로세서, 및 메모리가 전자적으로 각 구성 요소와 연결되고, 프로세서에 의하여 각 구성 요소의 동작이 제어되거나 관리될 수 있다. Although omitted in the drawings in the embodiments of FIGS. 4 to 13 , a processor and a memory may be electronically connected to each component, and operations of each component may be controlled or managed by the processor.

본 발명의 일 실시예에 따른 자연어 처리 방법의 적어도 일부의 과정은 도 14의 컴퓨팅 시스템(1000)에 의하여 실행될 수 있다. At least some processes of the natural language processing method according to an embodiment of the present invention may be executed by the computing system 1000 of FIG. 14 .

도 14를 참조하면, 본 발명의 일 실시예에 따른 컴퓨팅 시스템(1000)은, 프로세서(1100), 메모리(1200), 통신 인터페이스(1300), 저장 장치(1400), 입력 인터페이스(1500), 출력 인터페이스(1600) 및 버스(bus)(1700)를 포함하여 구성될 수 있다.Referring to FIG. 14 , a computing system 1000 according to an embodiment of the present invention includes a processor 1100, a memory 1200, a communication interface 1300, a storage device 1400, an input interface 1500, and an output It may be configured to include an interface 1600 and a bus 1700.

본 발명의 일 실시예에 따른 컴퓨팅 시스템(1000)은, 적어도 하나의 프로세서(processor)(1100) 및 상기 적어도 하나의 프로세서(1100)가 적어도 하나의 단계를 수행하도록 지시하는 명령어들(instructions)을 저장하는 메모리(memory)(1200)를 포함할 수 있다. 본 발명의 일 실시예에 따른 방법의 적어도 일부의 단계는 상기 적어도 하나의 프로세서(1100)가 상기 메모리(1200)로부터 명령어들을 로드하여 실행함으로써 수행될 수 있다. The computing system 1000 according to an embodiment of the present invention includes at least one processor 1100 and instructions instructing the at least one processor 1100 to perform at least one step. It may include a memory (memory) 1200 for storing. At least some steps of the method according to an embodiment of the present invention may be performed by the at least one processor 1100 loading instructions from the memory 1200 and executing them.

프로세서(1100)는 중앙 처리 장치(central processing unit, CPU), 그래픽 처리 장치(graphics processing unit, GPU), 또는 본 발명의 실시예들에 따른 방법들이 수행되는 전용의 프로세서를 의미할 수 있다. The processor 1100 may mean a central processing unit (CPU), a graphics processing unit (GPU), or a dedicated processor on which methods according to embodiments of the present invention are performed.

메모리(1200) 및 저장 장치(1400) 각각은 휘발성 저장 매체 및 비휘발성 저장 매체 중에서 적어도 하나로 구성될 수 있다. 예를 들어, 메모리(1200)는 읽기 전용 메모리(read only memory, ROM) 및 랜덤 액세스 메모리(random access memory, RAM) 중에서 적어도 하나로 구성될 수 있다. Each of the memory 1200 and the storage device 1400 may include at least one of a volatile storage medium and a non-volatile storage medium. For example, the memory 1200 may include at least one of a read only memory (ROM) and a random access memory (RAM).

또한, 컴퓨팅 시스템(1000)은, 무선 네트워크를 통해 통신을 수행하는 통신 인터페이스(1300)를 포함할 수 있다. Also, the computing system 1000 may include a communication interface 1300 that performs communication through a wireless network.

또한, 컴퓨팅 시스템(1000)은, 저장 장치(1400), 입력 인터페이스(1500), 출력 인터페이스(1600) 등을 더 포함할 수 있다.In addition, the computing system 1000 may further include a storage device 1400, an input interface 1500, an output interface 1600, and the like.

또한, 컴퓨팅 시스템(1000)에 포함된 각각의 구성 요소들은 버스(bus)(1700)에 의해 연결되어 서로 통신을 수행할 수 있다.In addition, each component included in the computing system 1000 may be connected by a bus 1700 to communicate with each other.

본 발명의 컴퓨팅 시스템(1000)의 예를 들면, 통신 가능한 데스크탑 컴퓨터(desktop computer), 랩탑 컴퓨터(laptop computer), 노트북(notebook), 스마트폰(smart phone), 태블릿 PC(tablet PC), 모바일폰(mobile phone), 스마트 워치(smart watch), 스마트 글래스(smart glass), e-book 리더기, PMP(portable multimedia player), 휴대용 게임기, 네비게이션(navigation) 장치, 디지털 카메라(digital camera), DMB(digital multimedia broadcasting) 재생기, 디지털 음성 녹음기(digital audio recorder), 디지털 음성 재생기(digital audio player), 디지털 동영상 녹화기(digital video recorder), 디지털 동영상 재생기(digital video player), PDA(Personal Digital Assistant) 등일 수 있다.For example, the computing system 1000 of the present invention includes a communicable desktop computer, a laptop computer, a notebook, a smart phone, a tablet PC, and a mobile phone. (mobile phone), smart watch, smart glass, e-book reader, PMP (portable multimedia player), portable game device, navigation device, digital camera, DMB (digital It may be a multimedia broadcasting) player, digital audio recorder, digital audio player, digital video recorder, digital video player, personal digital assistant (PDA), and the like. .

본 발명의 실시예에 따른 방법의 동작은 컴퓨터로 읽을 수 있는 기록매체에 컴퓨터가 읽을 수 있는 프로그램 또는 코드로서 구현하는 것이 가능하다. 컴퓨터가 읽을 수 있는 기록매체는 컴퓨터 시스템에 의해 읽힐 수 있는 정보가 저장되는 모든 종류의 기록장치를 포함한다. 또한 컴퓨터가 읽을 수 있는 기록매체는 네트워크로 연결된 컴퓨터 시스템에 분산되어 분산 방식으로 컴퓨터로 읽을 수 있는 프로그램 또는 코드가 저장되고 실행될 수 있다.The operation of the method according to the embodiment of the present invention can be implemented as a computer readable program or code on a computer readable recording medium. A computer-readable recording medium includes all types of recording devices in which information readable by a computer system is stored. In addition, computer-readable recording media may be distributed to computer systems connected through a network to store and execute computer-readable programs or codes in a distributed manner.

또한, 컴퓨터가 읽을 수 있는 기록매체는 롬(rom), 램(ram), 플래시 메모리(flash memory) 등과 같이 프로그램 명령을 저장하고 수행하도록 특별히 구성된 하드웨어 장치를 포함할 수 있다. 프로그램 명령은 컴파일러(compiler)에 의해 만들어지는 것과 같은 기계어 코드뿐만 아니라 인터프리터(interpreter) 등을 사용해서 컴퓨터에 의해 실행될 수 있는 고급 언어 코드를 포함할 수 있다.In addition, the computer-readable recording medium may include hardware devices specially configured to store and execute program instructions, such as ROM, RAM, and flash memory. The program command may include high-level language codes that can be executed by a computer using an interpreter or the like as well as machine code generated by a compiler.

본 발명의 일부 측면들은 장치의 문맥에서 설명되었으나, 그것은 상응하는 방법에 따른 설명 또한 나타낼 수 있고, 여기서 블록 또는 장치는 방법 단계 또는 방법 단계의 특징에 상응한다. 유사하게, 방법의 문맥에서 설명된 측면들은 또한 상응하는 블록 또는 아이템 또는 상응하는 장치의 특징으로 나타낼 수 있다. 방법 단계들의 몇몇 또는 전부는 예를 들어, 마이크로프로세서, 프로그램 가능한 컴퓨터 또는 전자 회로와 같은 하드웨어 장치에 의해(또는 이용하여) 수행될 수 있다. 몇몇의 실시 예에서, 가장 중요한 방법 단계들의 적어도 하나 이상은 이와 같은 장치에 의해 수행될 수 있다.Although some aspects of the present invention have been described in the context of an apparatus, it may also represent a description according to a corresponding method, where a block or apparatus corresponds to a method step or feature of a method step. Similarly, aspects described in the context of a method may also be represented by a corresponding block or item or a corresponding feature of a device. Some or all of the method steps may be performed by (or using) a hardware device such as, for example, a microprocessor, programmable computer, or electronic circuitry. In some embodiments, at least one or more of the most important method steps may be performed by such a device.

실시예들에서, 프로그램 가능한 로직 장치(예를 들어, 필드 프로그래머블 게이트 어레이)가 여기서 설명된 방법들의 기능의 일부 또는 전부를 수행하기 위해 사용될 수 있다. 실시예들에서, 필드 프로그래머블 게이트 어레이(field-programmable gate array)는 여기서 설명된 방법들 중 하나를 수행하기 위한 마이크로프로세서(microprocessor)와 함께 작동할 수 있다. 일반적으로, 방법들은 어떤 하드웨어 장치에 의해 수행되는 것이 바람직하다.In embodiments, a programmable logic device (eg, a field programmable gate array) may be used to perform some or all of the functions of the methods described herein. In embodiments, a field-programmable gate array may operate in conjunction with a microprocessor to perform one of the methods described herein. Generally, methods are preferably performed by some hardware device.

이상 본 발명의 바람직한 실시 예를 참조하여 설명하였지만, 해당 기술 분야의 숙련된 당업자는 하기의 특허 청구의 범위에 기재된 본 발명의 사상 및 영역으로부터 벗어나지 않는 범위 내에서 본 발명을 다양하게 수정 및 변경시킬 수 있음을 이해할 수 있을 것이다.Although the above has been described with reference to preferred embodiments of the present invention, those skilled in the art can variously modify and change the present invention without departing from the spirit and scope of the present invention described in the claims below. You will understand that you can.

Claims (20)

프로세서(processor);
를 포함하고,
상기 프로세서는
사용자에 의하여 입력된 자연어 질의를 수신하고,
상기 자연어 질의에 기반하여 구조화된 질의를 생성하고,
상기 프로세서는 상기 자연어 질의에 기반하여 상기 구조화된 질의를 생성함에 있어서,
상기 자연어 질의에 대한 자연어 처리 결과; 및
상기 자연어 질의와 관련되는 데이터베이스 내의 하위 데이터베이스 간의 관계에 기반하여 추출되는 스키마 관계;
의 상호 간에 생성되는 교차 어텐션 결과를 이용하여 상기 구조화된 질의를 생성하는, 자연어 질의 처리 장치.
processor;
including,
The processor
Receive a natural language query entered by a user;
Create a structured query based on the natural language query;
When the processor generates the structured query based on the natural language query,
a natural language processing result for the natural language query; and
a schema relationship extracted based on a relationship between sub-databases within a database related to the natural language query;
Natural language query processing apparatus for generating the structured query by using a mutually generated cross-attention result of
제1항에 있어서,
상기 프로세서는 상기 자연어 처리 결과의 상기 스키마 관계와의 관련도를 나타내는 제1 교차 어텐션 결과, 및 상기 스키마 관계의 상기 자연어 처리 결과와의 관련도를 나타내는 제2 교차 어텐션 결과를 이용하여 상기 구조화된 질의를 생성하고,
상기 교차 어텐션 결과는 상기 제1 교차 어텐션 결과 및 상기 제2 교차 어텐션 결과를 포함하는, 자연어 질의 처리 장치.
According to claim 1,
The processor queries the structured query using a first cross-attention result indicating the degree of relevance of the natural language processing result with the schema relationship, and a second cross-attention result indicating the degree of relevance of the schema relationship with the natural language processing result. create,
The natural language query processing apparatus of claim 1 , wherein the cross-attention result includes the first cross-attention result and the second cross-attention result.
제1항에 있어서,
상기 자연어 질의에 기반하여 상기 자연어 처리 결과를 생성하는 자연어 처리 모델; 및
상기 스키마 관계를 출력하는 스키마 인코더 모델;
을 더 포함하는, 자연어 질의 처리 장치.
According to claim 1,
a natural language processing model generating the natural language processing result based on the natural language query; and
a schema encoder model outputting the schema relationship;
Further comprising a natural language query processing device.
제3항에 있어서,
상기 스키마 인코더 모델은 입력 스키마 그래프에 기반하여 스키마 의미 표현을 상기 스키마 관계로서 출력하고,
상기 자연어 처리 모델은 상기 자연어 질의의 전처리 결과를 입력받고 자연어 요소 의미 표현을 상기 자연어 처리 결과로서 출력하는, 자연어 질의 처리 장치.
According to claim 3,
The schema encoder model outputs a schema semantic expression as the schema relationship based on an input schema graph,
wherein the natural language processing model receives a preprocessing result of the natural language query and outputs a semantic expression of a natural language element as the natural language processing result.
제3항에 있어서,
상기 자연어 처리 결과의 상기 스키마 관계와의 관련도를 나타내는 제1 교차 어텐션 결과를 생성하는 제1 교차 어텐션 계층; 및
상기 스키마 관계의 상기 자연어 처리 결과와의 관련도를 나타내는 제2 교차 어텐션 결과를 생성하는 제2 교차 어텐션 계층;
을 더 포함하고,
상기 교차 어텐션 결과는 상기 제1 교차 어텐션 결과 및 상기 제2 교차 어텐션 결과를 포함하는, 자연어 질의 처리 장치.
According to claim 3,
a first cross-attention layer that generates a first cross-attention result indicating a degree of relevance of the natural language processing result with the schema relationship; and
a second cross-attention layer generating a second cross-attention result indicating a degree of relevance of the schema relationship with the natural language processing result;
Including more,
The natural language query processing apparatus of claim 1 , wherein the cross-attention result includes the first cross-attention result and the second cross-attention result.
제3항에 있어서,
상기 자연어 처리 모델은 내부에 셀프 어텐션 기능을 가지는 제1 내부 어텐션 계층을 포함하고,
상기 스키마 인코더 모델은 내부에 셀프 어텐션 및 교차 어텐션 중 적어도 하나 이상의 기능을 가지는 제2 내부 어텐션 계층을 포함하는, 자연어 질의 처리 장치.
According to claim 3,
The natural language processing model includes a first inner attention layer having a self-attention function therein,
The natural language query processing apparatus of claim 1, wherein the schema encoder model includes a second inner attention layer having at least one function of self-attention and cross-attention.
제6항에 있어서,
상기 프로세서는
상기 제1 내부 어텐션 계층의 출력에 기반한 상기 자연어 처리 모델 내부의 파라미터의 업데이트를 차단하는, 자연어 질의 처리 장치.
According to claim 6,
The processor
The natural language query processing apparatus for blocking updating of parameters within the natural language processing model based on an output of the first inner attention layer.
제3항에 있어서,
상기 프로세서는
상기 교차 어텐션 결과에 기반한 상기 자연어 처리 모델 내부의 파라미터의 업데이트를 차단하는, 자연어 질의 처리 장치.
According to claim 3,
The processor
A natural language query processing device that blocks updating of parameters within the natural language processing model based on a result of the cross attention.
제3항에 있어서,
상기 교차 어텐션 결과에 기반하여 상기 구조화된 질의를 생성하는 디코더 계층;
을 더 포함하는, 자연어 질의 처리 장치.
According to claim 3,
a decoder layer generating the structured query based on the cross attention result;
Further comprising a natural language query processing device.
프로세서(processor)를 포함하는 컴퓨팅 시스템에 의하여 실행되는 자연어 질의 처리 방법에 있어서,
사용자에 의하여 입력되는 자연어 질의를 수신하는 단계; 및
상기 자연어 질의에 기반하여 구조화된 질의를 생성하는 단계;
를 포함하고,
상기 구조화된 질의를 생성하는 단계는,
상기 자연어 질의에 대한 자연어 처리 결과를 획득하는 단계;
상기 자연어 질의와 관련되는 데이터베이스 내의 하위 데이터베이스 간의 관계에 기반하여 추출되는 스키마 관계를 획득하는 단계;
상기 자연어 처리 결과 및 상기 스키마 관계의 상호 간에 생성되는 교차 어텐션 결과를 획득하는 단계; 및
상기 교차 어텐션 결과를 이용하여 상기 구조화된 질의를 생성하는 단계;
를 포함하는, 자연어 질의 처리 방법.
In the natural language query processing method executed by a computing system including a processor,
Receiving a natural language query input by a user; and
generating a structured query based on the natural language query;
including,
Generating the structured query,
obtaining a natural language processing result for the natural language query;
obtaining a schema relationship extracted based on a relationship between sub-databases in a database related to the natural language query;
obtaining a cross-attention result generated between the natural language processing result and the schema relationship; and
generating the structured query using the cross attention result;
Including, natural language query processing method.
제10항에 있어서,
상기 교차 어텐션 결과를 획득하는 단계는,
상기 자연어 처리 결과의 상기 스키마 관계와의 관련도를 나타내는 제1 교차 어텐션 결과를 획득하는 단계; 및
상기 스키마 관계의 상기 자연어 처리 결과와의 관련도를 나타내는 제2 교차 어텐션 결과를 획득하는 단계;
를 포함하는, 자연어 질의 처리 방법.
According to claim 10,
Obtaining the cross attention result,
obtaining a first cross-attention result indicating a degree of relevance of the natural language processing result with the schema relationship; and
obtaining a second cross-attention result indicating a degree of relevance of the schema relationship with the natural language processing result;
Including, natural language query processing method.
제10항에 있어서,
상기 스키마 관계를 획득하는 단계는,
입력 스키마 그래프에 기반하여 스키마 의미 표현을 상기 스키마 관계로서 획득하고,
상기 자연어 처리 결과를 획득하는 단계는,
상기 자연어 질의의 전처리 결과를 입력받고 자연어 요소 의미 표현을 상기 자연어 처리 결과로서 획득하는, 자연어 질의 처리 방법.
According to claim 10,
Obtaining the schema relationship,
Obtaining a schema semantic expression as the schema relationship based on an input schema graph;
Obtaining the natural language processing result,
The natural language query processing method of receiving a preprocessing result of the natural language query and obtaining a semantic expression of a natural language element as the natural language processing result.
제10항에 있어서,
상기 자연어 처리 결과를 획득하는 단계는,
내부 어텐션 계층의 출력에 기반한 자연어 처리 모델 내부의 파라미터의 업데이트가 차단된 상태에서 수행되는, 자연어 질의 처리 방법.
According to claim 10,
Obtaining the natural language processing result,
A natural language query processing method performed in a state in which updating of parameters in a natural language processing model based on an output of an internal attention layer is blocked.
제10항에 있어서,
상기 자연어 처리 결과를 획득하는 단계는,
상기 교차 어텐션 결과에 기반한 자연어 처리 모델 내부의 파라미터의 업데이트가 차단된 상태에서 수행되는, 자연어 질의 처리 방법.
According to claim 10,
Obtaining the natural language processing result,
The natural language query processing method, which is performed in a state in which updating of parameters in the natural language processing model based on the result of the cross attention is blocked.
프로세서(processor)를 포함하는 컴퓨팅 시스템에 의하여 실행되는 자연어 질의 처리 방법에 있어서,
자연어 질의와 관련되는 데이터베이스 내의 하위 데이터베이스 간의 스키마 관계를 일대일(one-to-one) 대응, 및 일대다(one-to-many) 대응 중 어느 하나로서 추출하는 단계; 및
상기 스키마 관계에 기반하여 상기 자연어 질의로부터 구조화된 질의를 생성하는 단계;
를 포함하는, 자연어 질의 처리 방법.
In the natural language query processing method executed by a computing system including a processor,
extracting a schema relationship between sub-databases in a database related to a natural language query as one of one-to-one correspondence and one-to-many correspondence; and
generating a structured query from the natural language query based on the schema relationship;
Including, natural language query processing method.
제15항에 있어서,
상기 하위 데이터베이스 간의 비교를 통해 상기 스키마 관계를 강제적(mandatory) 관계, 및 선택적(optional) 관계 중 어느 하나로서 예측하는 단계;
를 더 포함하는 자연어 질의 처리 방법.
According to claim 15,
predicting the schema relationship as one of a mandatory relationship and an optional relationship through comparison between the lower databases;
Natural language query processing method further comprising a.
제15항에 있어서,
상기 하위 데이터베이스 중 제1 하위 데이터베이스에 대응하는 제1 자연어 모델 및 제2 하위 데이터베이스에 대응하는 제2 자연어 모델을 이용하여 상기 스키마 관계를 인코딩하는 단계;
를 더 포함하는 자연어 질의 처리 방법.
According to claim 15,
encoding the schema relationship using a first natural language model corresponding to a first sub-database and a second natural language model corresponding to a second sub-database among the sub-databases;
Natural language query processing method further comprising a.
제15항에 있어서,
상기 하위 데이터베이스 중 일부에 대한 마스크 컬럼 모델링을 이용하여 상기 스키마 관계의 적어도 일부를 미리 인코딩하는 단계;
를 더 포함하는 자연어 질의 처리 방법.
According to claim 15,
pre-encoding at least a portion of the schema relationship by using mask column modeling for a portion of the sub-database;
Natural language query processing method further comprising a.
제15항에 있어서,
상기 자연어 질의에 기반하여 자연어 처리 결과를 획득하는 단계;
를 더 포함하고,
상기 구조화된 질의를 생성하는 단계는,
상기 자연어 처리 결과 및 상기 스키마 관계의 상호 간에 생성되는 교차 어텐션 결과를 획득하는 단계; 및
상기 교차 어텐션 결과를 이용하여 상기 구조화된 질의를 생성하는 단계;
를 포함하는, 자연어 질의 처리 방법.
According to claim 15,
obtaining a natural language processing result based on the natural language query;
Including more,
Generating the structured query,
obtaining a cross-attention result generated between the natural language processing result and the schema relationship; and
generating the structured query using the cross attention result;
Including, natural language query processing method.
제15항에 있어서,
미리 학습된 언어 모델을 이용하여 상기 자연어 질의에 기반하여 자연어 처리 결과를 획득하는 단계;
를 더 포함하고,
상기 자연어 처리 결과를 획득하는 단계는, 상기 언어 모델의 내부 파라미터의 업데이트가 차단된 상태에서 수행되는, 자연어 질의 처리 방법.
According to claim 15,
obtaining a natural language processing result based on the natural language query by using a pre-learned language model;
Including more,
The natural language query processing method of claim 1 , wherein the obtaining of the natural language processing result is performed in a state in which updating of internal parameters of the language model is blocked.
KR1020220117575A 2021-11-30 2022-09-19 Apparatus and method for processing natural language query about relational database using transformer neural network KR20230081594A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US17/964,807 US20230169075A1 (en) 2021-11-30 2022-10-12 Apparatus and method for processing natural language query about relational database using transformer neural network

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
KR20210169562 2021-11-30
KR1020210169562 2021-11-30

Publications (1)

Publication Number Publication Date
KR20230081594A true KR20230081594A (en) 2023-06-07

Family

ID=86761865

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020220117575A KR20230081594A (en) 2021-11-30 2022-09-19 Apparatus and method for processing natural language query about relational database using transformer neural network

Country Status (1)

Country Link
KR (1) KR20230081594A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR102150908B1 (en) 2019-01-31 2020-09-03 주식회사 카카오 Method and system for analysis of natural language query
KR102277787B1 (en) 2019-12-26 2021-07-14 포항공과대학교 산학협력단 Column and table prediction method for text to SQL query translation based on a neural network
KR102345568B1 (en) 2019-12-26 2021-12-31 포항공과대학교 산학협력단 Semantic linking of natural language words with columns and tables in databases

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR102150908B1 (en) 2019-01-31 2020-09-03 주식회사 카카오 Method and system for analysis of natural language query
KR102277787B1 (en) 2019-12-26 2021-07-14 포항공과대학교 산학협력단 Column and table prediction method for text to SQL query translation based on a neural network
KR102345568B1 (en) 2019-12-26 2021-12-31 포항공과대학교 산학협력단 Semantic linking of natural language words with columns and tables in databases

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
"Attention Is All You Need", Ashish Vaswani 외, 31st Conference on Neural Information Processing Systems (NIPS 2017), (공개일 2017년 12월 6일)

Similar Documents

Publication Publication Date Title
Zhang et al. SG-Net: Syntax guided transformer for language representation
CN111325029B (en) Text similarity calculation method based on deep learning integrated model
CN112487190B (en) Method for extracting relationships between entities from text based on self-supervision and clustering technology
CN114580382A (en) Text error correction method and device
US11170169B2 (en) System and method for language-independent contextual embedding
CN116737759B (en) Method for generating SQL sentence by Chinese query based on relation perception attention
CN117076653B (en) Knowledge base question-answering method based on thinking chain and visual lifting context learning
CN115759119B (en) Financial text emotion analysis method, system, medium and equipment
CN115495563A (en) Intelligent session method and server based on table data retrieval
CN113449514A (en) Text error correction method and device suitable for specific vertical field
CN115827819A (en) Intelligent question and answer processing method and device, electronic equipment and storage medium
CN113779062A (en) SQL statement generation method and device, storage medium and electronic equipment
US20220245361A1 (en) System and method for managing and optimizing lookup source templates in a natural language understanding (nlu) framework
CN113408307B (en) Neural machine translation method based on translation template
CN115437626A (en) OCL statement automatic generation method and device based on natural language
Gao et al. A joint extraction model of entities and relations based on relation decomposition
Ahkouk et al. Comparative study of existing approaches on the Task of Natural Language to Database Language
CN111831624A (en) Data table creating method and device, computer equipment and storage medium
US20220229990A1 (en) System and method for lookup source segmentation scoring in a natural language understanding (nlu) framework
US20220229986A1 (en) System and method for compiling and using taxonomy lookup sources in a natural language understanding (nlu) framework
US20220229987A1 (en) System and method for repository-aware natural language understanding (nlu) using a lookup source framework
US20230169075A1 (en) Apparatus and method for processing natural language query about relational database using transformer neural network
KR20230081594A (en) Apparatus and method for processing natural language query about relational database using transformer neural network
CN115062603A (en) Alignment enhancement semantic parsing method, alignment enhancement semantic parsing device and computer program product
CN114548113A (en) Event-based reference resolution system, method, terminal and storage medium