KR20230103782A - Transformer-based text summarization method and device using pre-trained language model - Google Patents

Transformer-based text summarization method and device using pre-trained language model Download PDF

Info

Publication number
KR20230103782A
KR20230103782A KR1020220009998A KR20220009998A KR20230103782A KR 20230103782 A KR20230103782 A KR 20230103782A KR 1020220009998 A KR1020220009998 A KR 1020220009998A KR 20220009998 A KR20220009998 A KR 20220009998A KR 20230103782 A KR20230103782 A KR 20230103782A
Authority
KR
South Korea
Prior art keywords
model
text
transformer
embedding matrix
abstract
Prior art date
Application number
KR1020220009998A
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 국민대학교산학협력단
Publication of KR20230103782A publication Critical patent/KR20230103782A/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/34Browsing; Visualisation therefor
    • G06F16/345Summarisation for human users
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/205Parsing
    • G06F40/211Syntactic parsing, e.g. based on context-free grammar [CFG] or unification grammars
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/284Lexical analysis, e.g. tokenisation or collocates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N20/00Machine learning

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • Software Systems (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Data Mining & Analysis (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Medical Informatics (AREA)
  • Evolutionary Computation (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Databases & Information Systems (AREA)
  • Machine Translation (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

본 발명은 사전학습 언어모델을 활용한 트랜스포머 기반 텍스트 요약 방법 및 장치에 관한 것으로, 상기 방법은 텍스트의 문맥 정보를 사전학습하여 구축된 언어모델로부터 임베딩 행렬(embedding matrix)를 추출하는 임베딩 행렬 추출단계; 상기 임베딩 행렬이 적용된 추상 요약 모델을 정의하고 학습 데이터셋을 기초로 텍스트 요약문 생성을 위한 요약 학습을 수행하여 상기 추상 요약 모델을 구축하는 추상 요약 모델 구축단계; 및 상기 추상 요약 모델을 이용하여 입력 텍스트에 대한 요약문을 생성하는 텍스트 요약문 생성단계;를 포함한다.The present invention relates to a transformer-based text summarization method and apparatus using a pre-learning language model, which includes an embedding matrix extraction step of extracting an embedding matrix from a language model built by pre-learning contextual information of text. ; an abstract summary model building step of defining an abstract summary model to which the embedding matrix is applied and constructing the abstract summary model by performing summary learning for text summary generation based on a training dataset; and a text summary generating step of generating a summary of the input text using the abstract summary model.

Description

사전학습 언어모델을 활용한 트랜스포머 기반 텍스트 요약 방법 및 장치{TRANSFORMER-BASED TEXT SUMMARIZATION METHOD AND DEVICE USING PRE-TRAINED LANGUAGE MODEL}Transformer-based text summarization method and apparatus using pretraining language model {TRANSFORMER-BASED TEXT SUMMARIZATION METHOD AND DEVICE USING PRE-TRAINED LANGUAGE MODEL}

본 발명은 텍스트 요약 기술에 관한 것으로, 보다 상세하게는 소량의 학습 데이터가 주어진 상황에서도 양질의 요약문을 생성하기 위해 사전학습 언어 모델의 일부 요소를 추출하여 트랜스포머 기반의 추상 요약 모델에 적용함으로써 요약 품질을 높일 수 있는 기술에 관한 것이다.The present invention relates to text summarization technology, and more particularly, in order to generate a high-quality summary sentence even when a small amount of training data is given, some elements of a pre-learning language model are extracted and applied to a transformer-based abstract summary model for summary quality. It is about technology that can enhance

텍스트는 다양한 정보를 쉽게 표현하고 전달할 수 있는 대표적인 수단으로 사용되어 왔으며, 최근 정보 전달 기기가 대중화됨에 따라 더욱 많은 양의 텍스트 데이터가 생산 및 유통되고 있다. 특히, 소셜 미디어(Social Media)의 등장으로 정보 생산자는 정보 이용자에게 손쉽게 정보를 전달할 수 있게 되었고, 이는 오늘날 방대한 양의 텍스트 데이터가 온라인상에서 활발하게 유통되는 계기가 되었다. 하지만, 이로 인해 정보 이용자가 방대한 정보로부터 필요한 정보만을 추려내는 작업은 더욱 어렵게 되었으며, 이는 정보의 손실을 최소화하면서 방대한 텍스트 정보를 자동으로 적은 양으로 축약하려는 시도, 즉 자동 텍스트 요약(Automatic Text Summarization) 연구가 등장하는 배경이 되었다.Text has been used as a representative means to easily express and transmit various information, and as information delivery devices have recently become popular, a larger amount of text data is being produced and distributed. In particular, with the advent of social media, information producers can easily deliver information to information users, which has become an opportunity for a vast amount of text data to be actively distributed online today. However, this makes it more difficult for information users to extract only the necessary information from the vast amount of information. It became the background for the research to emerge.

자동 텍스트 요약 연구는 요약을 생성하는 방식에 따라 크게 추출 요약(Extractive Summarization) 접근과 추상 요약(Abstractive Summarization) 접근으로 구분될 수 있다. 추출 요약은 원문(Source Text)을 이루고 있는 문장 중 어떤 문장이 요약문으로서 의미가 있는지를 점수화(Scoring)하고, 이를 기반으로 주요 문장을 발췌하는 요약 방법이다. 이렇게 생성된 요약문은 원문으로부터 문장 단위로 발췌되었기 때문에, 문법적 오류가 적고 문장 내 표현이 자연스럽다는 장점이 있다.Automated text summarization research can be largely divided into extractive summarization and abstract summarization approaches according to the method of generating summaries. Extraction summary is a summary method in which the main sentences are extracted based on scoring which sentences among the sentences composing the source text are meaningful as summary sentences. Since the summary generated in this way is extracted sentence by sentence from the original text, it has the advantage that there are few grammatical errors and the expression within the sentence is natural.

따라서, 빠르게 서비스화에 성공했으며, 대표적인 예로 네이버 뉴스의 요약봇 서비스, 다음 뉴스의 자동 요약 서비스, 연합뉴스의 인공지능 기사요약 서비스 등이 있다. 하지만, 해당 방식은 원문 내에 존재하는 문장만 요약문에 포함될 수 있기 때문에 원본 문서에 없는 표현은 사용이 불가능하고, 문장간 연결이 어색할 수 있다는 단점을 가질 수 있다.Therefore, it quickly succeeded in servicing, and representative examples include the summary bot service of Naver News, the automatic summary service of Daum News, and the artificial intelligence article summary service of Yonhap News. However, since only sentences existing in the original text can be included in the abstract, expressions not in the original document cannot be used, and the connection between sentences may be awkward.

이와 달리, 추상 요약은 요약문을 생성하기 위해 원문에 존재하는 텍스트를 사용하되, 요약문 작성 과정에서 어휘를 재구성 및 변환하여 원문에 존재하지 않는 새로운 텍스트 시퀀스(Sequence)를 생성할 수 있다. 따라서, 추상 요약의 요약문은 새로운 표현을 풍부하게 사용할 수 있으며, 이로 인해 마치 사람이 요약한 것과 같은 요약문을 생성할 수 있다. 이러한 장점에도 불구하고 전통적인 추상 요약 연구는 문법적으로 오류가 많거나 문맥이 자연스럽지 않은 텍스트 시퀀스를 생성하는 경우가 많다는 한계로 인해 현업에서 쉽게 적용되지 못했다.Unlike this, the abstract summary uses the text that exists in the original text to create a summary, but can create a new text sequence that does not exist in the original text by reconstructing and converting vocabulary in the process of writing the abstract. Therefore, the summary of the abstract summary can use new expressions abundantly, thereby generating a summary that looks like a human summary. In spite of these advantages, traditional abstract summarization studies have not been easily applied in the field due to limitations in that they often generate text sequences with many grammatical errors or unnatural contexts.

한국등록특허 제10-0669534호 (2007.01.16)Korean Patent Registration No. 10-0669534 (2007.01.16)

본 발명의 일 실시예는 소량의 학습 데이터가 주어진 상황에서도 양질의 요약문을 생성하기 위해 사전학습 언어 모델의 일부 요소를 추출하여 트랜스포머 기반의 추상 요약 모델에 적용함으로써 요약 품질을 높일 수 있는 사전학습 언어모델을 활용한 트랜스포머 기반 텍스트 요약 방법 및 장치를 제공하고자 한다.An embodiment of the present invention extracts some elements of a pre-learning language model and applies them to a transformer-based abstract summary model to generate a high-quality summary sentence even when a small amount of training data is given, thereby increasing the quality of the summary. It is intended to provide a transformer-based text summarization method and apparatus using a model.

실시예들 중에서, 사전학습 언어모델을 활용한 트랜스포머 기반 텍스트 요약 방법은 텍스트의 문맥 정보를 사전학습하여 구축된 언어모델로부터 임베딩 행렬(embedding matrix)를 추출하는 임베딩 행렬 추출단계; 상기 임베딩 행렬이 적용된 추상 요약 모델을 정의하고 학습 데이터셋을 기초로 텍스트 요약문 생성을 위한 요약 학습을 수행하여 상기 추상 요약 모델을 구축하는 추상 요약 모델 구축단계; 및 상기 추상 요약 모델을 이용하여 입력 텍스트에 대한 요약문을 생성하는 텍스트 요약문 생성단계;를 포함한다.Among embodiments, a transformer-based text summarization method using a pre-learning language model includes an embedding matrix extraction step of extracting an embedding matrix from a language model built by pre-learning contextual information of text; an abstract summary model building step of defining an abstract summary model to which the embedding matrix is applied and constructing the abstract summary model by performing summary learning for text summary generation based on a training dataset; and a text summary generating step of generating a summary of the input text using the abstract summary model.

상기 임베딩 행렬 추출단계는 사전학습된 코버트(KoBERT) 모델의 입력 계층(layer)에서 토큰 임베딩 행렬을 상기 임베딩 행렬로서 추출하는 단계를 포함할 수 있다.The step of extracting the embedding matrix may include extracting a token embedding matrix as the embedding matrix from an input layer of a pretrained KoBERT model.

상기 임베딩 행렬 추출단계는 상기 입력 계층의 임베딩 계층들에서 적어도 토큰 임베딩 행렬을 포함하는 임베딩 조합을 통해 상기 임베딩 행렬을 생성하는 단계를 포함할 수 있다.The step of extracting the embedding matrix may include generating the embedding matrix through an embedding combination including at least a token embedding matrix in the embedding layers of the input layer.

상기 추상 요약 모델 구축단계는 트랜스포머(transformer) 모델을 상기 추상 요약 모델로서 정의하고 상기 트랜스포머 모델의 임베딩 계층에 상기 임베딩 행렬을 적용하는 단계를 포함할 수 있다.The constructing the abstract summary model may include defining a transformer model as the abstract summary model and applying the embedding matrix to an embedding layer of the transformer model.

상기 추상 요약 모델 구축단계는 상기 트랜스포머 모델의 인코더 임베딩 행렬과 디코더(decoder) 임베딩 행렬을 각각 상기 임베딩 행렬로 대체하는 단계를 포함할 수 있다.The constructing the abstract summary model may include replacing an encoder embedding matrix and a decoder embedding matrix of the transformer model with the embedding matrix, respectively.

상기 추상 요약 모델 구축단계는 상기 학습 데이터셋의 원문 텍스트를 상기 트랜스포머 모델의 인코더(encoder)에 입력하는 단계; 상기 인코더의 임베딩 계층을 통해 상기 원문 텍스트에 대한 단어 벡터를 생성하는 단계; 상기 단어 벡터를 상기 인코더의 인코더 계층에 통과시켜 상기 디코더에 전달하는 단계; 상기 디코더를 통해 상기 원문 텍스트에 대응되는 요약 텍스트를 생성하는 단계; 및 상기 원문 텍스트의 정답 텍스트와 상기 요약 텍스트 간의 차이를 비교하여 상기 인코더 및 상기 디코더를 갱신하는 단계를 포함할 수 있다.The step of constructing the abstract summary model may include inputting original text of the training dataset to an encoder of the transformer model; generating word vectors for the original text through an embedding layer of the encoder; passing the word vector through an encoder layer of the encoder to the decoder; generating summary text corresponding to the original text through the decoder; and updating the encoder and the decoder by comparing differences between the correct text of the original text and the summary text.

상기 텍스트 요약문 생성단계는 상기 입력 텍스트를 복수의 부분 텍스트들로 분할하는 단계; 상기 복수의 부분 텍스트들 각각을 상기 추상 요약 모델에 입력하여 복수의 부분 요약문들을 생성하는 단계; 및 상기 복수의 부분 요약문들을 통합하여 상기 요약문을 생성하는 단계를 포함할 수 있다.The generating of the text summary may include dividing the input text into a plurality of partial texts; generating a plurality of partial summaries by inputting each of the plurality of partial texts into the abstract summary model; and generating the summary by integrating the plurality of partial summaries.

상기 방법은 상기 요약문의 품질을 평가하는 요약문 품질 평가단계;를 더 포함할 수 있다.The method may further include a summary sentence quality evaluation step of evaluating the quality of the summary sentence.

상기 요약문 품질 평가단계는 상기 요약문과 사용자에 의해 입력된 정답문 사이의 단어 일치 정도에 따라 적어도 하나의 평가 지표를 산출하는 단계를 포함할 수 있다.The step of evaluating the quality of the summary sentence may include calculating at least one evaluation index according to a word matching degree between the summary sentence and the correct answer input by the user.

실시예들 중에서, 사전학습 언어모델을 활용한 트랜스포머 기반 텍스트 요약 장치는 텍스트의 문맥 정보를 사전학습하여 구축된 언어모델로부터 임베딩 행렬(embedding matrix)를 추출하는 임베딩 행렬 추출부; 상기 임베딩 행렬이 적용된 추상 요약 모델을 정의하고 학습 데이터셋을 기초로 텍스트 요약문 생성을 위한 요약 학습을 수행하여 상기 추상 요약 모델을 구축하는 추상 요약 모델 구축부; 및 상기 추상 요약 모델을 이용하여 입력 텍스트에 대한 요약문을 생성하는 텍스트 요약문 생성부;를 포함한다.Among the embodiments, a transformer-based text summarization apparatus using a pre-learning language model includes an embedding matrix extractor extracting an embedding matrix from a language model built by pre-learning contextual information of text; an abstract summary model builder defining an abstract summary model to which the embedding matrix is applied and constructing the abstract summary model by performing summary learning for text summary generation based on a training dataset; and a text summary generator generating a summary of the input text using the abstract summary model.

상기 임베딩 행렬 추출부는 사전학습된 코버트(KoBERT) 모델의 입력 계층(layer)에서 토큰 임베딩 행렬을 상기 임베딩 행렬로서 추출할 수 있다.The embedding matrix extraction unit may extract a token embedding matrix as the embedding matrix from an input layer of a pretrained KoBERT model.

상기 추상 요약 모델 구축부는 트랜스포머(transformer) 모델을 상기 추상 요약 모델로서 정의하고 상기 트랜스포머 모델의 임베딩 계층에 상기 임베딩 행렬을 적용할 수 있다.The abstract summary model building unit may define a transformer model as the abstract summary model and apply the embedding matrix to an embedding layer of the transformer model.

상기 추상 요약 모델 구축부는 상기 트랜스포머 모델의 인코더 임베딩 행렬과 디코더(decoder) 임베딩 행렬을 각각 상기 임베딩 행렬로 대체할 수 있다.The abstract summary model building unit may replace an encoder embedding matrix and a decoder embedding matrix of the transformer model with the embedding matrix, respectively.

개시된 기술은 다음의 효과를 가질 수 있다. 다만, 특정 실시예가 다음의 효과를 전부 포함하여야 한다거나 다음의 효과만을 포함하여야 한다는 의미는 아니므로, 개시된 기술의 권리범위는 이에 의하여 제한되는 것으로 이해되어서는 아니 될 것이다.The disclosed technology may have the following effects. However, it does not mean that a specific embodiment must include all of the following effects or only the following effects, so it should not be understood that the scope of rights of the disclosed technology is limited thereby.

본 발명의 일 실시예에 따른 사전학습 언어모델을 활용한 트랜스포머 기반 텍스트 요약 방법 및 장치는 소량의 학습 데이터가 주어진 상황에서도 양질의 요약문을 생성하기 위해 사전학습 언어 모델의 일부 요소를 추출하여 트랜스포머 기반의 추상 요약 모델에 적용함으로써 요약 품질을 높일 수 있다.Transformer-based text summarization method and apparatus using a pre-learning language model according to an embodiment of the present invention extracts some elements of a pre-learning language model to generate a high-quality summary sentence even when a small amount of training data is given. The summary quality can be improved by applying to the abstract summary model of

도 1은 본 발명에 따른 텍스트 요약 시스템을 설명하는 도면이다.
도 2는 도 1의 텍스트 요약 장치의 기능적 구성을 설명하는 도면이다.
도 3은 본 발명에 따른 사전학습 언어모델을 활용한 트랜스포머 기반 텍스트 요약 방법을 설명하는 순서도이다.
도 4는 본 발명에 따른 텍스트 요약 과정을 설명하는 도면이다.
도 5는 KoBERT의 내부 구조를 설명하는 도면이다.
도 6은 KoBERT 입력 계층의 벡터 표현을 설명하는 도면이다.
도 7은 사전학습에 의한 토큰 임베딩 값의 변화를 설명하는 도면이다.
도 8은 본 발명에 따른 트랜스포머 기반 요약 모델의 학습 과정을 설명하는 도면이다.
도 9는 본 발명에 따른 요약문 생성 및 품질 평가 과정을 설명하는 도면이다.
도 10 내지 13는 본 발명에 따른 텍스트 요약 방법에 관한 실험 내용을 설명하는 도면이다.
1 is a diagram illustrating a text summary system according to the present invention.
FIG. 2 is a diagram explaining the functional configuration of the text summary device of FIG. 1 .
3 is a flowchart illustrating a transformer-based text summarization method using a pre-learning language model according to the present invention.
4 is a diagram illustrating a text summarization process according to the present invention.
5 is a diagram explaining the internal structure of KoBERT.
6 is a diagram illustrating a vector representation of a KoBERT input layer.
7 is a diagram illustrating a change in a token embedding value due to prior learning.
8 is a diagram illustrating a learning process of a transformer-based summary model according to the present invention.
9 is a diagram illustrating a process of generating a summary statement and evaluating quality according to the present invention.
10 to 13 are diagrams explaining experimental contents related to the text summarization method according to the present invention.

본 발명에 관한 설명은 구조적 내지 기능적 설명을 위한 실시예에 불과하므로, 본 발명의 권리범위는 본문에 설명된 실시예에 의하여 제한되는 것으로 해석되어서는 아니 된다. 즉, 실시예는 다양한 변경이 가능하고 여러 가지 형태를 가질 수 있으므로 본 발명의 권리범위는 기술적 사상을 실현할 수 있는 균등물들을 포함하는 것으로 이해되어야 한다. 또한, 본 발명에서 제시된 목적 또는 효과는 특정 실시예가 이를 전부 포함하여야 한다거나 그러한 효과만을 포함하여야 한다는 의미는 아니므로, 본 발명의 권리범위는 이에 의하여 제한되는 것으로 이해되어서는 아니 될 것이다.Since the description of the present invention is only an embodiment for structural or functional description, the scope of the present invention should not be construed as being limited by the embodiments described in the text. That is, since the embodiment can be changed in various ways and can have various forms, it should be understood that the scope of the present invention includes equivalents capable of realizing the technical idea. In addition, since the object or effect presented in the present invention does not mean that a specific embodiment should include all of them or only such effects, the scope of the present invention should not be construed as being limited thereto.

한편, 본 출원에서 서술되는 용어의 의미는 다음과 같이 이해되어야 할 것이다.Meanwhile, the meaning of terms described in this application should be understood as follows.

"제1", "제2" 등의 용어는 하나의 구성요소를 다른 구성요소로부터 구별하기 위한 것으로, 이들 용어들에 의해 권리범위가 한정되어서는 아니 된다. 예를 들어, 제1 구성요소는 제2 구성요소로 명명될 수 있고, 유사하게 제2 구성요소도 제1 구성요소로 명명될 수 있다.Terms such as "first" and "second" are used to distinguish one component from another, and the scope of rights should not be limited by these terms. For example, a first element may be termed a second element, and similarly, a second element may be termed a first element.

어떤 구성요소가 다른 구성요소에 "연결되어"있다고 언급된 때에는, 그 다른 구성요소에 직접적으로 연결될 수도 있지만, 중간에 다른 구성요소가 존재할 수도 있다고 이해되어야 할 것이다. 반면에, 어떤 구성요소가 다른 구성요소에 "직접 연결되어"있다고 언급된 때에는 중간에 다른 구성요소가 존재하지 않는 것으로 이해되어야 할 것이다. 한편, 구성요소들 간의 관계를 설명하는 다른 표현들, 즉 "~사이에"와 "바로 ~사이에" 또는 "~에 이웃하는"과 "~에 직접 이웃하는" 등도 마찬가지로 해석되어야 한다.It should be understood that when an element is referred to as being “connected” to another element, it may be directly connected to the other element, but other elements may exist in the middle. On the other hand, when an element is referred to as being "directly connected" to another element, it should be understood that no intervening elements exist. Meanwhile, other expressions describing the relationship between components, such as “between” and “immediately between” or “adjacent to” and “directly adjacent to” should be interpreted similarly.

단수의 표현은 문맥상 명백하게 다르게 뜻하지 않는 한 복수의 표현을 포함하는 것으로 이해되어야 하고, "포함하다"또는 "가지다" 등의 용어는 실시된 특징, 숫자, 단계, 동작, 구성요소, 부분품 또는 이들을 조합한 것이 존재함을 지정하려는 것이며, 하나 또는 그 이상의 다른 특징이나 숫자, 단계, 동작, 구성요소, 부분품 또는 이들을 조합한 것들의 존재 또는 부가 가능성을 미리 배제하지 않는 것으로 이해되어야 한다.Expressions in the singular number should be understood to include plural expressions unless the context clearly dictates otherwise, and terms such as “comprise” or “having” refer to an embodied feature, number, step, operation, component, part, or these. It should be understood that it is intended to indicate that a combination exists, and does not preclude the possibility of the presence or addition of one or more other features, numbers, steps, operations, components, parts, or combinations thereof.

각 단계들에 있어 식별부호(예를 들어, a, b, c 등)는 설명의 편의를 위하여 사용되는 것으로 식별부호는 각 단계들의 순서를 설명하는 것이 아니며, 각 단계들은 문맥상 명백하게 특정 순서를 기재하지 않는 이상 명기된 순서와 다르게 일어날 수 있다. 즉, 각 단계들은 명기된 순서와 동일하게 일어날 수도 있고 실질적으로 동시에 수행될 수도 있으며 반대의 순서대로 수행될 수도 있다.In each step, the identification code (eg, a, b, c, etc.) is used for convenience of explanation, and the identification code does not describe the order of each step, and each step clearly follows a specific order in context. Unless otherwise specified, it may occur in a different order than specified. That is, each step may occur in the same order as specified, may be performed substantially simultaneously, or may be performed in the reverse order.

본 발명은 컴퓨터가 읽을 수 있는 기록매체에 컴퓨터가 읽을 수 있는 코드로서 구현될 수 있고, 컴퓨터가 읽을 수 있는 기록 매체는 컴퓨터 시스템에 의하여 읽혀질 수 있는 데이터가 저장되는 모든 종류의 기록 장치를 포함한다. 컴퓨터가 읽을 수 있는 기록 매체의 예로는 ROM, RAM, CD-ROM, 자기 테이프, 플로피 디스크, 광 데이터 저장 장치 등이 있다. 또한, 컴퓨터가 읽을 수 있는 기록 매체는 네트워크로 연결된 컴퓨터 시스템에 분산되어, 분산 방식으로 컴퓨터가 읽을 수 있는 코드가 저장되고 실행될 수 있다.The present invention can be implemented as computer readable code on a computer readable recording medium, and the computer readable recording medium includes all types of recording devices storing data that can be read by a computer system. . Examples of computer-readable recording media include ROM, RAM, CD-ROM, magnetic tape, floppy disk, and optical data storage devices. In addition, the computer-readable recording medium may be distributed to computer systems connected through a network, so that computer-readable codes may be stored and executed in a distributed manner.

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

자동 텍스트 요약은 내용의 주요 정보와 전반적인 의미를 보존하면서 간결하고 자연스러운 요약문을 생성하는 과제이며, 요약을 생성하는 방식에 따라 크게 추출 요약 접근과 추상 요약 접근으로 구분될 수 있다. 추출 요약(Extractive Summarization)은 원문과 가장 관련 있는 문장들을 선택 또는 발췌하고 이를 조합하여 요약문을 생성하는 방법에 해당할 수 있다. 추출 요약은 원문을 이루고 있는 문장들 중 요약문에 포함될 주요 문장을 발췌하는 것이 핵심일 수 있다.Automatic text summarization is a task to create concise and natural summaries while preserving the main information and overall meaning of the content. Extractive summarization may correspond to a method of generating a summary by selecting or extracting sentences most related to the original text and combining them. Extraction summary may be the key to extracting the main sentences to be included in the summary among the sentences constituting the original text.

한편, 추상 요약(Abstractive Summarization)은 언어학적 정보를 이용하여 원문을 해석하고 이를 토대로 정보를 간결하게 압축하여 요약문을 생성하는 방법으로, 전통적인 추상 요약은 트리 기반(Tree-based) 방법론, 규칙 기반(Rule-based) 방법론 등과 같은 구조화된 언어학적 정보를 이용하여 요약문을 생성할 수 있다. 이러한 특징으로 인해 추상 요약으로 생성된 요약문은 새로운 어휘를 포함하거나 새로운 시퀀스를 생성할 수 있어, 풍부한 표현의 요약문을 생성할 수 있다는 장점이 있다.On the other hand, abstract summary is a method of generating a summary by interpreting the original text using linguistic information and concisely compressing the information based on it. The traditional abstract summary is a tree-based methodology, rule-based ( A summary can be created using structured linguistic information such as rule-based) methodology. Due to these characteristics, the summary generated by the abstract summary can include new vocabulary or create a new sequence, which has the advantage of generating a richly expressive summary.

하지만, 전통적인 추상 요약은 모든 언어학적 관계를 명확히 구조화하기 어려워, 전통적인 방법론으로 생성한 요약문은 문법적 오류를 포함하거나 요약문의 표현이 부자연스럽다는 한계를 가질 수 있다.However, it is difficult for the traditional abstract summary to clearly structure all linguistic relationships, so the summary generated by the traditional methodology may contain grammatical errors or have a limitation that the expression of the summary is unnatural.

이러한 추상 요약의 한계는 신경망 기반의 방법론을 적용하면서 크게 개선되었는데, 특히 기계 번역(Machine Translation) 과제에서 큰 성과를 이룬 Seq2Seq 모델과 어텐션 메커니즘 모델의 구조를 추상 요약에 적용하여 양질의 요약문을 생성할 수 있다.The limitations of this abstract summary have been greatly improved by applying the neural network-based methodology. In particular, the structure of the Seq2Seq model and the attention mechanism model, which have achieved great results in the machine translation task, can be applied to the abstract summary to generate a high-quality summary. can

순환 신경망은 주어진 텍스트 사이의 관계를 시퀀스 정보를 활용하여 효과적으로 파악할 수 있다는 점에서 다양한 자연어 처리(Natural Language Processing; NLP) 과제에 활용되고 있다. 하지만, 순환 신경망은 텍스트 시퀀스가 길어짐에 따라 텍스트 사이의 문맥 정보를 제대로 학습하지 못하는 장기 의존성 문제를 가질 수 있다. 또한, 순환 신경망 기반의 인코더-디코더 구조는 인코더에서 입력 시퀀스를 하나의 벡터 표현으로 압축하는 과정에서 정보 손실이 발생한다는 구조적인 한계를 가지므로 장기 의존성 문제는 여전히 근본적으로 해결되지 못했다.Recurrent neural networks are used in various natural language processing (NLP) tasks in that they can effectively grasp the relationship between given texts using sequence information. However, the recurrent neural network may have a long-term dependency problem in that it does not properly learn contextual information between texts as the text sequence becomes long. In addition, since the encoder-decoder structure based on the recurrent neural network has a structural limitation that information loss occurs in the process of compressing an input sequence into a single vector representation in the encoder, the long-term dependency problem has not been fundamentally solved.

트랜스포머 모델이 기계 번역 및 추상 요약과 같은 자연어 생성(Natural Language Generation) 과제에서 우수한 성능을 보임에 따라, 관련 분야의 연구자들은 트랜스포머의 자연어 이해(Understanding) 능력에 집중하게 되었다. 트랜스포머 구조를 활용하여 많은 양의 텍스트 데이터로부터 언어학적 문맥 정보를 학습한 BERT, GPT, GPT-2는 자연어 처리 분야에 존재하는 여러 벤치마크 데이터셋에 대하여 높은 수준의 성능을 달성하면서, 트랜스포머를 기반으로 한 사전학습 언어 모델의 우수성을 보였다.As Transformer models perform well on natural language generation tasks such as machine translation and abstract summarization, researchers in related fields have focused on Transformer's natural language understanding capabilities. BERT, GPT, and GPT-2, which learned linguistic context information from a large amount of text data using a transformer structure, achieve high levels of performance on various benchmark datasets that exist in the field of natural language processing, showed the superiority of the pre-learning language model.

특히, BERT는 트랜스포머의 인코더를 활용하여 텍스트 데이터로부터 효과적으로 문맥 정보를 학습하도록 고안된 MLM(Masked Language Model)과 NSP(Next Sentence Prediction)를 학습함으로써, 입력된 텍스트 시퀀스 사이의 복잡한 문맥 정보를 잘 이해된 표현(Representation)으로 생성할 수 있다.In particular, BERT learns MLM (Masked Language Model) and NSP (Next Sentence Prediction), which are designed to effectively learn contextual information from text data by utilizing Transformer's encoder. It can be created with Representation.

추상 요약 과제에 대한 전통적인 트랜스포머와 트랜스포머 기반의 사전학습 언어 모델의 적용에도 불구하고, 트랜스포머 기반의 요약 모델은 매우 많은 수의 매개변수 갱신을 위해 상당히 많은 양의 데이터와 학습 시간 및 자원을 필요로 한다는 한계를 가질 수 있다. 이러한 한계는 요약문 학습에 활용할 수 있는 데이터가 상대적으로 적은 양의 한국어 문서에 대해, 추상 요약 과제에 트랜스포머 모델을 적용할 때 더욱 큰 부작용으로 나타날 수 있다.Despite the application of traditional transformers and transformer-based pretrained language models to the abstract summarization task, the Transformer-based summarization model requires a significant amount of data and training time and resources for a very large number of parameter updates. may have limitations. This limitation can appear as a larger side effect when the transformer model is applied to the abstract summary task for Korean documents with a relatively small amount of data that can be used for learning summaries.

도 1은 본 발명에 따른 텍스트 요약 시스템을 설명하는 도면이다.1 is a diagram illustrating a text summary system according to the present invention.

도 1을 참조하면, 텍스트 요약 시스템(100)은 사용자 단말(110), 텍스트 요약 장치(130) 및 데이터베이스(150)를 포함할 수 있다.Referring to FIG. 1 , a text summary system 100 may include a user terminal 110 , a text summary device 130 and a database 150 .

사용자 단말(110)은 텍스트 요약 장치(130)와 연결되어 요약문 생성에 필요한 텍스트를 직접 입력하거나 요약 모델에 의해 생성된 요약문을 수신하여 확인할 수 있는 컴퓨팅 장치에 해당할 수 있다. 사용자 단말(110)은 스마트폰, 노트북 또는 컴퓨터로 구현될 수 있으며, 반드시 이에 한정되지 않고, 태블릿 PC 등 다양한 디바이스로도 구현될 수 있다. 사용자 단말(110)은 텍스트 요약 장치(130)와 네트워크를 통해 연결될 수 있고, 복수의 사용자 단말(110)들이 텍스트 요약 장치(130)와 동시에 연결될 수도 있다.The user terminal 110 may correspond to a computing device that is connected to the text summary device 130 and can directly input text required for generating a summary sentence or receive and confirm a summary sentence generated by a summary model. The user terminal 110 may be implemented as a smart phone, a laptop computer, or a computer, but is not necessarily limited thereto, and may also be implemented as various devices such as a tablet PC. The user terminal 110 may be connected to the text summary device 130 through a network, and a plurality of user terminals 110 may be simultaneously connected to the text summary device 130 .

텍스트 요약 장치(130)는 본 발명에 따른 사전학습 언어모델을 활용한 트랜스포머 기반 텍스트 요약 방법을 수행하는 컴퓨터 또는 프로그램에 해당하는 서버로 구현될 수 있다. 텍스트 요약 장치(130)는 사용자 단말(110)과 유선 또는 무선 네트워크를 통해 연결될 수 있고 상호 간에 데이터를 주고받을 수 있다.The text summarization device 130 may be implemented as a server corresponding to a computer or program that performs a transformer-based text summarization method using a pretrained language model according to the present invention. The text summary device 130 may be connected to the user terminal 110 through a wired or wireless network and may exchange data with each other.

일 실시예에서, 텍스트 요약 장치(130)는 본 발명에 따른 사전학습 언어모델을 활용한 트랜스포머 기반 텍스트 요약 방법을 수행하는 과정에서 다양한 외부 시스템(또는 서버)과 연동하여 동작할 수 있다. 이를 통해, 텍스트 요약 장치(130)는 SNS 서비스, 포털 사이트, 블로그 등을 통해 텍스트로 이루어진 다양한 문서들에 접근할 수 있으며, 사전 학습을 위한 학습 데이터의 수집과 학습 모델 구축 등에 필요한 데이터를 수집할 수 있다.In one embodiment, the text summarization device 130 may operate in conjunction with various external systems (or servers) in the process of performing the transformer-based text summarization method using the pretrained language model according to the present invention. Through this, the text summary device 130 can access various documents made of text through SNS services, portal sites, blogs, etc., and can collect data necessary for collecting learning data for prior learning and building a learning model. can

여기에서, 텍스트 요약 장치(130)는 사용자의 요청에 대한 응답으로서 특정 텍스트에 대한 요약문을 생성하여 제공하는 동작을 수행할 수 있으며, 요약의 대상이 되는 텍스트는 복수의 단어, 구문 또는 문장을 포함하여 구성될 수 있다. 예를 들어, 텍스트에는 인터넷 검색을 통해 접근 가능한 웹페이지, 해시 태그를 통해 공유되는 SNS 메시지와 블로그, 키워드 검색의 대상이 되는 게시글, 문서 파일 등을 포함할 수 있다.Here, the text summary device 130 may perform an operation of generating and providing a summary of a specific text as a response to a user's request, and the text to be summarized includes a plurality of words, phrases, or sentences. can be configured. For example, the text may include a web page accessible through Internet search, SNS messages and blogs shared through hashtags, posts subject to keyword search, document files, and the like.

데이터베이스(150)는 텍스트 요약 장치(130)의 동작 과정에서 필요한 다양한 정보들을 저장하는 저장장치에 해당할 수 있다. 예를 들어, 데이터베이스(150)는 학습 및 평가를 위한 학습 데이터셋에 관한 정보를 저장할 수 있고, 텍스트 요약 모델 구축을 위한 학습 알고리즘 및 모델 정보를 저장할 수 있으며, 반드시 이에 한정되지 않고, 텍스트 요약 장치(130)가 본 발명에 따른 사전학습 언어모델을 활용한 트랜스포머 기반 텍스트 요약 방법을 수행하는 과정에서 다양한 형태로 수집 또는 가공된 정보들을 저장할 수 있다.The database 150 may correspond to a storage device that stores various pieces of information necessary for the operation of the text summarizing device 130 . For example, the database 150 may store information about a learning dataset for learning and evaluation, and may store learning algorithm and model information for constructing a text summary model, but is not necessarily limited thereto, and a text summary device. In the process of performing the transformer-based text summarization method using the pre-learning language model according to the present invention (130), collected or processed information in various forms can be stored.

도 2는 도 1의 텍스트 요약 장치의 기능적 구성을 설명하는 도면이다.FIG. 2 is a diagram explaining the functional configuration of the text summary device of FIG. 1 .

도 2를 참조하면, 텍스트 요약 장치(130)는 임베딩 행렬 추출부(210), 추상 요약 모델 구축부(230), 텍스트 요약문 생성부(250), 요약문 품질 평가부(270) 및 제어부(290)를 포함할 수 있다.Referring to FIG. 2 , the text summarization apparatus 130 includes an embedding matrix extraction unit 210, an abstract summary model construction unit 230, a text summary generation unit 250, a summary quality evaluation unit 270, and a control unit 290. can include

다만, 본 발명의 실시예에 따른 텍스트 요약 장치(130)가 상기의 기능적 구성들을 동시에 모두 포함해야 하는 것은 아니며, 각각의 실시예에 따라 상기의 구성들 중 일부를 생략하거나, 상기의 구성들 중 일부 또는 전부를 선택적으로 포함하여 구현될 수도 있다. 또한, 텍스트 요약 장치(130)는 필요에 따라 상기의 구성들 중 일부를 선택적으로 포함하는 독립된 장치들로 구현될 수 있으며, 각 장치들 간의 연동을 통해 본 발명에 따른 텍스트 요약 방법을 수행할 수 있다. 이하, 각 구성들의 동작을 구체적으로 설명한다.However, the text summary device 130 according to an embodiment of the present invention does not have to include all of the above functional components at the same time, and some of the above components may be omitted or selected from among the above components according to each embodiment. It may be implemented by selectively including some or all of them. In addition, the text summary device 130 may be implemented as independent devices that selectively include some of the above configurations as needed, and may perform the text summary method according to the present invention through interworking between the devices. there is. Hereinafter, the operation of each component will be described in detail.

임베딩 행렬 추출부(210)는 텍스트의 문맥 정보를 사전학습하여 구축된 언어모델로부터 임베딩 행렬(embedding matrix)을 추출할 수 있다. 즉, 임베딩 행렬 추출부(210)는 학습 데이터가 충분하지 않은 조건에서 이미 구축된 사전학습 정보를 활용하기 위하여 사전학습된 언어모델의 임베딩 행렬을 선택적으로 수집할 수 있다. 여기에서, 임베딩 행렬은 임베딩 벡터(embedding vector)들의 집합에 해당할 수 있으며, 언어모델의 임베딩 계층에서 구축되고 적용될 수 있다.The embedding matrix extractor 210 may extract an embedding matrix from a language model built by prior learning of text context information. That is, the embedding matrix extractor 210 may selectively collect the embedding matrix of the pre-trained language model in order to utilize pre-training information already built under conditions where training data is insufficient. Here, the embedding matrix may correspond to a set of embedding vectors, and may be constructed and applied in the embedding layer of the language model.

일 실시예에서, 임베딩 행렬 추출부(210)는 사전학습된 코버트(KoBERT) 모델의 입력 계층(layer)에서 토큰 임베딩 행렬(token embedding matrix)을 임베딩 행렬로서 추출할 수 있다. 코버트 모델은 입력 계층과 인코더 계층을 포함할 수 있으며, 임베딩 행렬 추출부(210)는 입력 계층의 임베딩 계층들 각각에서 독립적으로 생성되는 임베딩 행렬들 중에서 각 단어의 벡터를 출력하는 토큰 임베딩 행렬을 선택적으로 추출할 수 있다. 한편, 사전학습된 코버트 모델에 관한 정보와 데이터는 쉽게 접근 및 이용 가능한 점에서 코버트 모델에 대한 사전학습의 구체적인 과정은 생략한다.In one embodiment, the embedding matrix extractor 210 may extract a token embedding matrix as an embedding matrix from an input layer of a pretrained KoBERT model. The covert model may include an input layer and an encoder layer, and the embedding matrix extractor 210 generates a token embedding matrix for outputting a vector of each word among embedding matrices independently generated in each of the embedding layers of the input layer. can be selectively extracted. On the other hand, since information and data on the pre-trained Covert model are easily accessible and usable, the specific process of pre-learning the Covert model is omitted.

일 실시예에서, 임베딩 행렬 추출부(210)는 입력 계층의 임베딩 계층들에서 적어도 토큰 임베딩 행렬을 포함하는 임베딩 조합을 통해 임베딩 행렬을 생성할 수 있다. 임베딩 행렬 추출부(210)는 기본적으로 코버트 모델에서 토큰 임베딩 행렬을 추출할 수 있으며, 필요에 따라 토큰 임베딩 행렬과 함께 나머지 임베딩 행렬을 추출할 수 있다. 예를 들어, 임베딩 행렬 추출부(210)는 토큰 임베딩(token embedding) 행렬과 세그먼트 임베딩(segment embedding) 행렬을 추출하거나 또는 토큰 임베딩 행렬과 포지션 임베딩(position embedding) 행렬을 추출할 수도 있다.In an embodiment, the embedding matrix extractor 210 may generate an embedding matrix through an embedding combination including at least a token embedding matrix in the embedding layers of the input layer. The embedding matrix extractor 210 may basically extract a token embedding matrix from the Covert model, and may extract the remaining embedding matrices together with the token embedding matrix as needed. For example, the embedding matrix extractor 210 may extract a token embedding matrix and a segment embedding matrix, or may extract a token embedding matrix and a position embedding matrix.

추상 요약 모델 구축부(230)는 임베딩 행렬이 적용된 추상 요약 모델을 정의하고 학습 데이터셋을 기초로 텍스트 요약문 생성을 위한 요약 학습을 수행하여 추상 요약 모델을 구축할 수 있다. 여기에서, 추상 요약 모델은 텍스트의 요약문을 생성하는 학습 모델로서 추상 요약을 통해 원문에 존재하지 않는 새로운 텍스트 시퀀스를 요약문으로 생성하도록 학습된 모델에 해당할 수 있다. 또한, 요약 학습은 본 발명에 따른 추상 요약 모델을 구축하기 위한 학습 과정에 해당할 수 있으며, 사전에 수집되어 생성된 학습 데이터셋의 학습 데이터들을 이용하여 수행될 수 있으며, 텍스트 요약 장치(130)는 학습 데이터의 수집과 학습 데이터셋의 구축을 수행하는 독립적인 모듈을 포함하여 구현될 수 있다. 추상 요약 모델 구축부(230)는 사전학습된 언어모델에서 추출된 임베딩 행렬을 추상 요약 모델에 적용한 후 요약 학습을 통해 추상 요약 모델을 구축할 수 있다.The abstract summary model building unit 230 may build the abstract summary model by defining an abstract summary model to which an embedding matrix is applied and performing summary learning for text summary generation based on a training dataset. Here, the abstract summary model is a learning model that generates a text summary, and may correspond to a model learned to generate a new text sequence that does not exist in the original text as a summary through the abstract summary. In addition, summary learning may correspond to a learning process for building an abstract summary model according to the present invention, and may be performed using training data of a training dataset that has been collected and created in advance, and the text summary device 130 may be implemented by including an independent module that collects learning data and builds a learning dataset. The abstract summary model builder 230 may apply the embedding matrix extracted from the pretrained language model to the abstract summary model and then build the abstract summary model through summary learning.

일 실시예에서, 추상 요약 모델 구축부(230)는 트랜스포머(transformer) 모델을 추상 요약 모델로서 정의하고 트랜스포머 모델의 임베딩 계층에 임베딩 행렬을 적용할 수 있다. 즉, 추상 요약 모델 구축부(230)는 많은 양의 학습 데이터를 필요로 하는 트랜스포머 모델에 대해 사전학습을 통해 도출된 임베딩 행렬을 적용하여 매개변수를 효과적으로 갱신할 수 있다.In an embodiment, the abstract summary model builder 230 may define a transformer model as an abstract summary model and apply an embedding matrix to an embedding layer of the transformer model. That is, the abstract summary model builder 230 may effectively update parameters by applying an embedding matrix derived through pre-training to a transformer model requiring a large amount of training data.

일 실시예에서, 추상 요약 모델 구축부(230)는 트랜스포머 모델의 인코더 임베딩 행렬과 디코더(decoder) 임베딩 행렬을 각각 임베딩 행렬로 대체할 수 있다. 추상 요약 모델 구축부(230)는 사전학습된 정보가 트랜스포머의 문서를 이해하는 인코더와 요약문을 생성하는 디코더 양 쪽에 모두 전달될 수 있도록 인코더 임베딩 행렬과 디코더(decoder) 임베딩 행렬을 모두 임베딩 행렬로 대체하여 적용할 수 있다.In an embodiment, the abstract summary model builder 230 may replace the encoder embedding matrix and the decoder embedding matrix of the transformer model with embedding matrices, respectively. The abstract summary model builder 230 replaces both the encoder embedding matrix and the decoder embedding matrix with an embedding matrix so that the pretrained information can be delivered to both the encoder that understands the transformer's document and the decoder that generates the summary. and can be applied.

일 실시예에서, 추상 요약 모델 구축부(230)는 복수의 단계들로 구성된 학습 과정을 반복적으로 수행하여 추상 요약 모델을 생성할 수 있다. 보다 구체적으로, 추상 요약 모델 구축부(230)는 학습 데이터셋의 원문 텍스트를 트랜스포머 모델의 인코더(encoder)에 입력하고, 인코더의 임베딩 계층을 통해 원문 텍스트에 대한 단어 벡터를 생성하며, 단어 벡터를 인코더의 인코더 계층에 통과시켜 디코더에 전달하고, 디코더를 통해 원문 텍스트에 대응되는 요약 텍스트를 생성하며, 원문 텍스트의 정답 텍스트와 요약 텍스트 간의 차이를 비교하여 인코더 및 디코더를 갱신할 수 있다. 임베딩 행렬이 적용된 트랜스포머의 요약 학습 과정에 대해서는 도 8을 통해 보다 자세히 설명한다.In an embodiment, the abstract summary model builder 230 may generate an abstract summary model by repeatedly performing a learning process consisting of a plurality of steps. More specifically, the abstract summary model builder 230 inputs the original text of the training dataset to the encoder of the transformer model, generates word vectors for the original text through the encoder's embedding layer, and converts the word vectors to the original text. After passing through the encoder layer of the encoder, it is passed to the decoder, the summary text corresponding to the original text is generated through the decoder, and the encoder and decoder can be updated by comparing the difference between the correct text and the summary text of the original text. The summary learning process of the transformer to which the embedding matrix is applied will be described in more detail with reference to FIG. 8 .

텍스트 요약문 생성부(250)는 추상 요약 모델을 이용하여 입력 텍스트에 대한 요약문을 생성할 수 있다. 즉, 텍스트 요약문 생성부(250)는 사용자로부터 입력되거나 또는 선택된 특정 입력 텍스트를 추상 요약 모델에 입력하여 자동으로 요약문을 생성할 수 있다. 텍스트 요약문 생성부(250)는 사용자 단말(110)로부터 입력 텍스트를 수신하거나 또는 데이터베이스(150)에 저장된 텍스트들 중 어느 하나를 입력 텍스트로 결정할 수 있다.The text summary sentence generation unit 250 may generate a summary sentence for the input text using an abstract summary model. That is, the text summary generator 250 may automatically generate a summary by inputting a specific input text input or selected by a user into an abstract summary model. The text summary generator 250 may receive input text from the user terminal 110 or determine one of texts stored in the database 150 as the input text.

또한, 텍스트 요약문 생성부(250)는 입력 텍스트를 그대로 사용할 수도 있으나, 필요에 따라 소정의 전처리 동작을 수행한 다음 추상 요약 모델에 입력할 수도 있다. 예를 들어, 텍스트 요약문 생성부(250)는 입력 텍스트에서 특정 단어, 구문 또는 문장을 삭제할 수 있으며, 특정 길이 또는 단락을 기준으로 분할할 수 있다. 다른 예로서, 텍스트 요약문 생성부(250)는 복수의 입력 텍스트들을 하나로 통합하거나 또는 복수의 입력 텍스트들에서 추출된 문장들을 통합하여 새로운 입력 텍스트를 생성할 수도 있다.Also, the text summary generator 250 may use the input text as it is, or may perform a predetermined preprocessing operation if necessary and then input the text into the abstract summary model. For example, the text summary generator 250 may delete specific words, phrases, or sentences from the input text, and divide the input text based on specific lengths or paragraphs. As another example, the text summary generator 250 may generate new input text by integrating a plurality of input texts into one or by integrating sentences extracted from a plurality of input texts.

요약문 품질 평가부(270)는 텍스트 요약문 생성부(250)에 의해 생성된 요약문의 품질을 평가하는 동작을 수행할 수 있다. 즉, 요약문 품질 평가부(270)는 추상 요약 모델이 생성한 요약문이 실제 입력 텍스트를 잘 요약하고 있는지에 대한 정량적인 평가 결과를 생성할 수 있다. 일 실시예에서, 요약문 품질 평가부(270)는 요약문과 사용자에 의해 입력된 정답문 사이의 단어 일치 정도에 따라 적어도 하나의 평가 지표를 산출할 수 있다. 요약문 품질 평가부(270)는 요약문에 관한 품질 평가의 결과로서 기 정의된 평가 지표들을 산출할 수 있다. 예를 들어, 요약문 품질 평가부(270)는 요약문의 요약 품질을 다양하게 평가하기 위해 ROUGE-1, ROUGE-2 및 ROUGE-L 등의 평가 지표들을 생성할 수 있다.The summary sentence quality evaluation unit 270 may perform an operation of evaluating the quality of the summary generated by the text summary sentence generation unit 250 . That is, the summary sentence quality evaluation unit 270 may generate a quantitative evaluation result of whether the summary sentence generated by the abstract summary model summarizes the actual input text well. In an embodiment, the summary sentence quality evaluation unit 270 may calculate at least one evaluation index according to the word matching degree between the summary sentence and the correct answer input by the user. The summary sentence quality evaluation unit 270 may calculate predefined evaluation indicators as a result of quality evaluation on the summary sentence. For example, the summary sentence quality evaluation unit 270 may generate evaluation indicators such as ROUGE-1, ROUGE-2, and ROUGE-L to variously evaluate the summary quality of the summary sentence.

제어부(290)는 텍스트 요약 장치(130)의 전체적인 동작을 제어하고, 임베딩 행렬 추출부(210), 추상 요약 모델 구축부(230), 텍스트 요약문 생성부(250) 및 요약문 품질 평가부(270) 간의 제어 흐름 또는 데이터 흐름을 관리할 수 있다.The control unit 290 controls the overall operation of the text summary device 130, and includes an embedding matrix extractor 210, an abstract summary model builder 230, a text summary generator 250, and a summary quality evaluation unit 270. It can manage control flow or data flow between

도 3은 본 발명에 사전학습 언어모델을 활용한 트랜스포머 기반 텍스트 요약 방법을 설명하는 순서도이다.3 is a flowchart illustrating a transformer-based text summarization method using a pre-learning language model in the present invention.

도 3을 참조하면, 텍스트 요약 장치(130)는 임베딩 행렬 추출부(210)를 통해 텍스트의 문맥 정보를 사전학습하여 구축된 언어모델로부터 임베딩 행렬(embedding matrix)를 추출할 수 있다(단계 S410). 여기에서, 사전학습된 언어모델로 KoBERT가 사용될 수 있으나, 반드시 이에 한정되지 않음은 물론이다.Referring to FIG. 3 , the text summarization apparatus 130 may extract an embedding matrix from a language model built by prior learning of text context information through the embedding matrix extractor 210 (step S410). . Here, KoBERT can be used as a pretrained language model, but is not necessarily limited thereto.

텍스트 요약 장치(130)는 추상 요약 모델 구축부(230)를 통해 임베딩 행렬이 적용된 추상 요약 모델을 정의하고 학습 데이터셋을 기초로 텍스트 요약문 생성을 위한 요약 학습을 수행하여 추상 요약 모델을 구축할 수 있다(단계 S430). 여기에서, 추상 요약 모델은 트랜스포머를 기반으로 정의될 수 있으나, 반드시 이에 한정되지 않음은 물론이다.The text summarization device 130 may build an abstract summary model by defining an abstract summary model to which an embedding matrix is applied through the abstract summary model building unit 230 and performing summary learning for text summary generation based on a training dataset. Yes (step S430). Here, the abstract summary model may be defined based on the transformer, but is not necessarily limited thereto.

텍스트 요약 장치(130)는 텍스트 요약문 생성부(250)를 통해 추상 요약 모델을 이용하여 입력 텍스트에 대한 요약문을 생성할 수 있다(단계 S450). 일 실시예에서, 텍스트 요약 장치(130)는 텍스트 요약문 생성부(250)를 통해 입력 텍스트를 복수의 부분 텍스트들로 분할하고, 복수의 부분 텍스트들 각각을 추상 요약 모델에 입력하여 복수의 부분 요약문들을 생성하며, 복수의 부분 요약문들을 통합하여 요약문을 생성할 수 있다. 즉, 텍스트 요약 장치(130)는 필요에 따라 복수의 추상 요약 모델들을 포함하고, 복수의 부분 텍스트들에 대해 복수의 부분 요약문들을 병렬적으로 생성할 수 있다.The text summary device 130 may generate a summary of the input text using the abstract summary model through the text summary generator 250 (step S450). In an embodiment, the text summary device 130 divides the input text into a plurality of partial texts through the text summary generator 250 and inputs each of the plurality of partial texts into an abstract summary model to form a plurality of partial summaries. and a summary statement can be created by integrating a plurality of partial summaries. That is, the text summarization apparatus 130 may include a plurality of abstract summary models as needed and generate a plurality of partial summaries for a plurality of partial texts in parallel.

또한, 텍스트 요약 장치(130)는 요약문 품질 평가부(270)를 통해 요약문의 품질을 평가할 수 있다. 이때, 텍스트 요약 장치(130)는 요약문에 대한 정량적인 평가 결과를 생성하기 위해 다양한 평가 지표들을 활용할 수 있다.Also, the text summary device 130 may evaluate the quality of the summary sentence through the summary sentence quality evaluation unit 270 . In this case, the text summary device 130 may utilize various evaluation indicators to generate quantitative evaluation results for the summary sentence.

도 4는 본 발명에 따른 텍스트 요약 과정을 설명하는 도면이다.4 is a diagram illustrating a text summarization process according to the present invention.

도 4를 참조하면, 텍스트 요약 장치(130)는 본 발명의 일 실시예에 따른 텍스트 요약 방법을 실행할 수 있다. 즉, 텍스트 요약 방법은 트랜스포머 기반 요약 모델이 소량의 데이터가 주어진 환경에서도 양질의 요약문을 생성할 수 있도록 한국어 사전학습 언어 모델인 KoBERT의 일부 요소를 트랜스포머에 적용할 수 있다.Referring to FIG. 4 , the text summary device 130 may execute a text summary method according to an embodiment of the present invention. In other words, the text summarization method can apply some elements of KoBERT, a Korean pre-learning language model, to the transformer so that the transformer-based summary model can generate a high-quality summary even in an environment given a small amount of data.

도 4의 좌측 흐름은 대규모의 한국어 텍스트 문서로부터 MLM과 NSP를 수행하여 한국어의 복잡한 문맥 정보를 학습한 KoBERT의 임베딩 행렬(Embedding Matrix)를 선택적으로 추출하는 과정에 해당할 수 있다. 요약 학습을 수행할 트랜스포머의 임베딩 행렬은 추출된 임베딩 행렬로 대체될 수 있으며, Dacon 데이터의 훈련 데이터와 검증 데이터를 기초로 요약 학습이 수행될 수 있다. 이를 통해 구축된 트랜스포머 모델은 KoBERT의 언어학적 지식에 힘입어 적은 양의 데이터에 대해서도 효과적으로 요약문을 생성할 수 있게 된다. 학습이 완료된 요약 모델은 우측 흐름과 같이 시험 데이터에 대한 추론을 통해 요약문을 생성할 수 있다.The flow on the left side of FIG. 4 may correspond to a process of selectively extracting an embedding matrix of KoBERT, which has learned complex Korean context information by performing MLM and NSP from a large-scale Korean text document. The embedding matrix of the transformer to be subjected to summary learning may be replaced with the extracted embedding matrix, and summary learning may be performed based on training data and verification data of Dacon data. The transformer model built through this can effectively generate a summary sentence even for a small amount of data thanks to KoBERT's linguistic knowledge. A summary model that has been trained can generate a summary statement through reasoning on test data, as shown in the flow on the right.

도 5는 KoBERT의 내부 구조를 설명하는 도면이다.5 is a diagram explaining the internal structure of KoBERT.

도 5를 참조하면, 텍스트 요약 장치(130)는 사전학습된 KoBERT로부터 선택적으로 임베딩 행렬을 추출할 수 있다. KoBERT는 트랜스포머의 인코더 구조를 활용하여 한국어 위키피디아와 뉴스 등으로부터 수집한 약 500만 개의 문장에 대해 한국어 문맥 정보를 학습한 결과로서 구축될 수 있다. KoBERT는 학습한 문맥 정보를 효과적으로 보존하기 위해 전통적인 트랜스포머 모델과 비교하여 더 큰 은닉층(hidden layer) 크기와 더 많은 어텐션 헤드(attention head) 및 인코더 계층(encoder layer)을 가질 수 있다. 또한, KoBERT는 도 5와 같이 기존의 트랜스포머와는 상이한 형태의 입력 계층을 가질 수 있다.Referring to FIG. 5 , the text summarization apparatus 130 may selectively extract an embedding matrix from the pretrained KoBERT. KoBERT can be constructed as a result of learning Korean contextual information for about 5 million sentences collected from Korean Wikipedia and news by utilizing the transformer's encoder structure. KoBERT can have a larger hidden layer size and more attention heads and encoder layers compared to traditional transformer models to effectively preserve learned contextual information. Also, KoBERT may have an input layer of a different type from that of the existing transformer, as shown in FIG. 5 .

도 5에서, KoBERT는 총 13개의 계층, 즉 12개의 인코더 계층과 1개의 입력 계층으로 구성될 수 있다. 특히, 입력 계층은 3개의 임베딩 계층으로 이루어질 수 있으며, 각각 단어의 벡터를 출력하는 토큰 임베딩(Token Embedding), 문서 내에서 문장의 위치 벡터를 출력하는 세그먼트 임베딩(Segment Embedding) 그리고 문서 내에서 단어의 위치 벡터를 출력하는 포지션 임베딩(Position Embedding)으로 구성될 수 있다. 이때, 3개의 임베딩 계층은 각 목적에 따라 입력된 문장 또는 문서에 대하여 같이 동일한 차원을 갖는 벡터를 생성할 수 있다.In FIG. 5, KoBERT can be composed of a total of 13 layers, that is, 12 encoder layers and 1 input layer. In particular, the input layer may consist of three embedding layers, each of which is a token embedding that outputs a vector of a word, a segment embedding that outputs a position vector of a sentence in a document, and a sequence of words in a document. It may consist of position embedding that outputs a position vector. In this case, the three embedding layers may generate vectors having the same dimensions for the input sentence or document according to each purpose.

도 6은 KoBERT 입력 계층의 벡터 표현을 설명하는 도면이고, 도 7은 사전학습에 의한 토큰 임베딩 값의 변화를 설명하는 도면이다.FIG. 6 is a diagram illustrating a vector representation of a KoBERT input layer, and FIG. 7 is a diagram illustrating a change in a token embedding value by prior learning.

도 6 및 7을 참조하면, KoBERT는 입력 계층을 통해 입력된 문장에 대한 벡터를 생성할 수 있다. 각 단어는 고유의 단어 표현뿐 아니라, 문서 내의 위치와 해당 단어가 속한 문장의 위치를 함께 고려하여 표현될 수 있다. 즉, KoBERT의 입력 계층은 동일한 단어 '_비'에 대해서도 해당 단어가 출현한 위치에 따라 상이한 벡터값을 출력할 수 있다.Referring to FIGS. 6 and 7, KoBERT can generate vectors for sentences input through the input layer. Each word may be expressed considering not only a unique word expression but also a position in a document and a position of a sentence to which the corresponding word belongs. That is, KoBERT's input layer can output different vector values for the same word '_bi' according to the location where the corresponding word appears.

KoBERT는 입력 계층에서 표현된 언어학적 정보를 12개의 인코더 계층에 전달하며, 인코더 계층은 주어진 언어학적 정보를 토대로 복잡한 문맥 관계를 학습할 수 있다. 해당 과정에서 KoBERT는 인코더 계층으로부터 학습한 문맥 관계를 다시 입력 계층에 역전파(Backpropagation)하여, 입력 계층이 언어학적 정보를 이전보다 더욱 잘 나타낼 수 있도록 할 수 있다.KoBERT delivers linguistic information expressed in the input layer to 12 encoder layers, and the encoder layer can learn complex contextual relationships based on the given linguistic information. In this process, KoBERT backpropagates the context relationship learned from the encoder layer back to the input layer, so that the input layer can better represent linguistic information than before.

즉, 해당 학습 과정이 반복적으로 수행됨에 따라 입력 계층에서 단어의 고유 표현을 나타내는 토큰 벡터의 값도 도 7과 같이 갱신될 수 있다. 이는 사전학습 과정에서 인코더 계층으로부터 전달받은 문맥 정보를 활용하여, 토큰 벡터의 값을 생성하기 위한 임베딩 행렬 자체를 갱신함을 의미할 수 있다. 본 발명에 따른 텍스트 요약 방법은 이렇게 갱신된 KoBERT의 토큰 임베딩 행렬을 추출하여, 요약 학습을 수행하는 트랜스포머의 임베딩 행렬을 대체함으로써 KoBERT의 지식을 습득하는 방안을 제공할 수 있다.That is, as the learning process is repeatedly performed, the value of the token vector representing the unique expression of the word in the input layer may be updated as shown in FIG. 7 . This may mean that the embedding matrix itself for generating the value of the token vector is updated by using the context information delivered from the encoder layer in the pre-learning process. The text summarization method according to the present invention extracts the updated token embedding matrix of KoBERT and replaces the embedding matrix of the transformer performing summary learning, thereby providing a way to acquire KoBERT knowledge.

도 8은 본 발명에 따른 트랜스포머 기반 요약 모델의 학습 과정을 설명하는 도면이다.8 is a diagram illustrating a learning process of a transformer-based summary model according to the present invention.

도 8을 참조하면, 전통적인 트랜스포머는 자연어에 대한 사전 지식 없이 원문에 의존하여 요약 학습을 수행하므로, 방대한 양의 매개변수를 적절히 갱신하기 위해 많은 양의 데이터를 필요로 할 수 있다. 본 발명에 따른 텍스트 요약 방법은 트랜스포머의 토큰 임베딩 행렬을 KoBERT의 토큰 임베딩 행렬로 대체하여, 트랜스포머가 적은 양의 데이터만으로도 매개변수를 효과적으로 갱신할 수 있는 방안을 제공할 수 있다. 구체적으로, KoBERT를 통해 학습한 단어 수준의 지식이 트랜스포머의 문서를 이해하는 인코더와 요약문을 생성하는 디코더 양 쪽에 모두 전달될 수 있도록 하기 위해, KoBERT의 토큰 임베딩 행렬을 트랜스포머의 인코더 임베딩과 디코더 임베딩 행렬에 모두 적용할 수 있다.Referring to FIG. 8 , since a traditional transformer performs summary learning depending on the original text without prior knowledge of natural language, it may require a large amount of data to properly update a large amount of parameters. The text summarization method according to the present invention replaces the token embedding matrix of the transformer with the token embedding matrix of KoBERT, thereby providing a way for the transformer to effectively update parameters with only a small amount of data. Specifically, in order to ensure that the word-level knowledge learned through KoBERT can be transferred to both the encoder that understands Transformer's documents and the decoder that generates summaries, KoBERT's token embedding matrix is transformed into Transformer's encoder embedding and decoder embedding matrices. can be applied to all

도 8의 경우, 임베딩 행렬(810)이 적용된 트랜스포머가 요약 학습을 수행하는 과정을 나타낼 수 있다. 먼저, KoBERT의 임베딩 행렬(810)이 입력된 원문에 대하여 단어 벡터를 생성하고, 생성된 단어 벡터에 시퀀스 정보를 추가하여 트랜스포머의 인코더 계층(830)에 전달할 수 있다. 인코더 계층(830)은 입력받은 벡터 표현으로부터 문맥 정보를 파악하고 이를 다시 구조화하여 트랜스포머의 디코더 계층(850)에 전달할 수 있다. 디코더 계층(850)은 인코더(830)로부터 전달받은 정보를 통해 요약문을 생성하고, 생성한 요약문과 요약 정답의 차이를 비교하는 학습을 수행하여 요약문 생성 모델을 생성할 수 있다.In the case of FIG. 8 , a process in which the transformer to which the embedding matrix 810 is applied may perform summary learning. First, a word vector may be generated for the original text input by the KoBERT embedding matrix 810, and sequence information may be added to the generated word vector and transmitted to the encoder layer 830 of the transformer. The encoder layer 830 may identify context information from the input vector representation, restructure it, and deliver it to the decoder layer 850 of the transformer. The decoder layer 850 may generate a summary sentence based on the information transmitted from the encoder 830 and perform learning to compare the difference between the generated summary sentence and the summary correct answer to generate a summary sentence generation model.

본 발명에 따른 텍스트 요약 장치(130)는 위의 과정을 통해 생성한 트랜스포머 기반 요약 모델을 사용하여 자동으로 요약문을 생성할 수 있고, 생성된 요약문에 대한 품질 평가 과정을 수행할 수 있다.The text summarization apparatus 130 according to the present invention may automatically generate a summary using the transformer-based summary model generated through the above process, and may perform a quality evaluation process on the generated summary.

도 9는 본 발명에 따른 요약문 생성 및 품질 평가 과정을 설명하는 도면이다.9 is a diagram illustrating a process of generating a summary statement and evaluating quality according to the present invention.

도 9를 참조하면, 학습이 완료된 트랜스포머(930)는 요약 정답 없이 원문(910)만을 입력으로 받아 요약문(950)을 자동으로 생성할 수 있다. 즉, 텍스트 요약 장치(130)는 입력된 문서를 벡터로 구조화하고, 이미 학습한 문맥 정보를 이용하여 구조화된 문서 벡터에 대응하는 요약을 생성할 수 있다. 또한, 생성된 요약의 품질은 사람이 작성한 요약 정답과의 정량적 비교를 통해 측정 가능하며, 다양한 평가 지표 중 ROUGE가 사용될 수 있다.Referring to FIG. 9 , the transformer 930 on which learning has been completed receives only the original text 910 as an input without a summary answer and can automatically generate a summary text 950. That is, the text summary device 130 may structure an input document into a vector and generate a summary corresponding to the structured document vector by using previously learned contextual information. In addition, the quality of the generated summary can be measured through quantitative comparison with human-written summary answers, and among various evaluation indicators, ROUGE can be used.

일 실시예에서, 텍스트 요약 장치(130)는 요약 품질을 다양하게 평가하기 위해 ROUGE-1, ROUGE-2, 그리고 ROUGE-L의 세 가지 지표를 사용할 수 있으며, 각 지표의 정의는 이하 실험 내용에서 설명한다.In one embodiment, the text summarization device 130 may use three indicators of ROUGE-1, ROUGE-2, and ROUGE-L to variously evaluate the quality of the summary, and the definitions of each indicator are described in the following experiment. Explain.

도 10 내지 13는 본 발명에 따른 텍스트 요약 방법에 관한 실험 내용을 설명하는 도면이다.10 to 13 are diagrams explaining experimental contents related to the text summarization method according to the present invention.

여기에서는 본 발명에 따른 텍스트 요약 방법에 관한 실험 내용을 설명한다. 실험은 Dacon에서 제공한 한국어 문서 생성요약 데이터셋을 활용하여 수행될 수 있으며, 기존의 요약 데이터셋인 CNN-Daily Mail, BBC XSum의 데이터 구분 비율을 참조하여 다음의 표 1와 같이 데이터의 역할을 구분할 수 있다.Here, experimental contents related to the text summarization method according to the present invention are described. The experiment can be performed using the Korean document generation summary dataset provided by Dacon, and the role of the data is analyzed as shown in Table 1 below by referring to the data classification ratio of CNN-Daily Mail and BBC XSum, which are existing summary datasets. can be distinguished.

Dacon DatasetDacon Dataset TrainTrain ValidationValidation TestTest 100%100% 50%50% 20%20% 38,52238,522 19,26119,261 7,7047,704 2,1402,140 2,1412,141

구체적으로, 총 42,803건의 데이터는 우선 학습용 데이터 38,522건, 검증용 데이터 2,140건, 그리고 테스트 데이터 2,141건으로 각각 90:5:5의 비율로 구분될 수 있다. 또한, 소량의 학습 데이터가 주어진 상황에서 나타나는 요약 품질의 하락 수준을 평가하기 위해, 학습용 데이터 38,522건(100%)을 모두 학습에 사용한 실험, 학습용 데이터 중 19,261건(50%)만 학습에 사용한 실험, 그리고 7,704건(20%)만 학습에 사용한 실험이 수행될 수 있고, 그 결과가 비교될 수 있다.Specifically, a total of 42,803 data can be divided into 38,522 training data, 2,140 verification data, and 2,141 test data at a ratio of 90:5:5, respectively. In addition, in order to evaluate the level of decline in summary quality given a small amount of training data, an experiment using all 38,522 training data (100%) for training and an experiment using only 19,261 training data (50%) for training , and experiments using only 7,704 cases (20%) for learning can be performed, and the results can be compared.

실험 환경은 다음의 표 2와 같이 Python 3.7과 딥러닝 프레임워크인 Tensorflow, Pytorch를 통해 구축될 수 있으며, CPU 8 Core와 Tesla P40 GPU 등의 하드웨어 자원이 사용될 수 있다.As shown in Table 2 below, the experiment environment can be built using Python 3.7 and deep learning frameworks Tensorflow and Pytorch, and hardware resources such as CPU 8 Core and Tesla P40 GPU can be used.

실험 환경Experiment environment 하드웨어hardware CPUCPU 8 core8 core GPUGPU Tesla P30 * 2eaTesla P30 * 2ea MemoryMemory 60GB60GB 언어language PythonPython 3.73.7 딥러닝
프레임워크
deep learning
framework
TensorflowTensorflow 2.3.02.3.0
PytorchPytorch 1.9.01.9.0

실험 모형은 도 10과 같이 구성될 수 있으며, 본 발명에 따른 방법의 우수성을 평가하기 위하여 두 가지 기준 모델과의 요약 품질 비교 실험이 수행될 수 있다. 첫 번째 비교 모델(Emb. Random)은 전통적인 트랜스포머 기반 요약 모델로, 임베딩 행렬의 초기값은 임의의 값으로 설정될 수 있다. 즉, Emb. Random 모델은 자연어에 대한 어떠한 사전 지식도 없이 주어진 원문에만 의존하여 요약 학습을 수행함을 의미할 수 있다. 두 번째 비교 모델(Emb. Word2Vec)은 주변 단어의 문맥 정보를 학습하여 어휘의 벡터값을 산출하는 알고리즘인 Word2Vec을 사용하여 트랜스포머 임베딩 행렬의 초기값을 설정한 모델이다. 즉, Emb. Word2Vec 모델은 Word2Vec을 통해 자연어에 대한 지식을 습득한 상황에서 요약 학습을 수행할 수 있다. 마지막 Emb. KoBERT는 본 발명에 따른 요약 모델로, KoBERT의 토큰 임베딩을 통해 자연어에 대한 지식이 전달될 수 있다.The experimental model may be configured as shown in FIG. 10, and a summary quality comparison experiment with two reference models may be performed to evaluate the superiority of the method according to the present invention. The first comparison model (Emb. Random) is a traditional transformer-based summary model, and the initial value of the embedding matrix can be set to a random value. That is, Emb. The random model may mean that summary learning is performed depending only on the given original text without any prior knowledge of natural language. The second comparison model (Emb. Word2Vec) is a model in which the initial value of the transformer embedding matrix is set using Word2Vec, an algorithm that calculates the vector value of vocabulary by learning the context information of surrounding words. That is, Emb. The Word2Vec model can perform summary learning in a situation where knowledge of natural language is acquired through Word2Vec. Last Emb. KoBERT is a summary model according to the present invention, and knowledge of natural language can be transferred through token embedding of KoBERT.

해당 실험에서는 도 10에 따라 각 모델을 통해 요약문을 생성한 뒤, 각 모델이 생성한 요약문의 품질을 대표적인 요약 평가 지표인 ROUGE를 사용하여 평가할 수 있다. ROUGE는 비교 대상에 따라 더욱 세분화될 수 있으며, 대표적으로 ROUGE-N과 ROUGE-L이 사용될 수 있다. 해당 실험에서는 ROUGE-N 기반의 ROUGE-1, ROUGE-2 그리고 ROUGE-L를 활용하여 요약문의 품질이 평가될 수 있으며, 평가에 사용된 ROUGE 지표의 산출 방식은 도 11과 같다.In the experiment, after generating summaries through each model according to FIG. 10 , the quality of summaries generated by each model can be evaluated using ROUGE, a representative summary evaluation index. ROUGE can be further subdivided according to the comparison target, and ROUGE-N and ROUGE-L can be used as representative examples. In this experiment, the quality of summary statements can be evaluated using ROUGE-1, ROUGE-2, and ROUGE-L based on ROUGE-N, and the method of calculating the ROUGE index used for evaluation is shown in FIG. 11.

도 11에서, ROUGE 지표는 사람이 작성한 요약 정답과 요약 모델이 생성한 요약문 사이에 단어가 일치하는 정도에 따라 요약 품질이 결정될 수 있다. 먼저, ROUGE-N은 일치하는 단어의 단위(N-Gram)에 따라 다양한 수준으로 구현될 수 있으며, 대표적으로 단어의 개별 단위(Uni-Gram)로 일치 정도를 평가하는 ROUGE-1과 연속된 두 개의 단어 단위(Bi-Gram)로 일치 정도를 평가하는 ROUGE-2가 사용될 수 있다. ROUGE-N의 산출에는 정밀도(Precision)와 재현율(Recall)이 사용될 수 있으며, 정밀도는 생성된 요약문 관점에서의 일치 정도를, 재현율은 요약 정답 관점에서의 일치 정도를 측정할 수 있다.In FIG. 11 , in the ROUGE index, summary quality may be determined according to the degree of matching of words between a summary answer written by a human and a summary generated by a summary model. First, ROUGE-N can be implemented at various levels according to the unit of matched words (N-Gram). Representatively, ROUGE-1, which evaluates the degree of matching in individual units of words (Uni-Gram), and two consecutive ROUGE-2, which evaluates the degree of matching in units of two words (Bi-Gram), may be used. Precision and recall can be used to calculate ROUGE-N, and precision can measure the degree of agreement in terms of the generated summary, and recall can measure the degree of agreement in terms of summary correct answers.

한편, ROUGE-L은 두 문장이 공통으로 갖는 서브시퀀스(Subsequence)의 길이로 요약문의 품질이 평가될 수 있다. 예를 들어, 도 11에서 요약 정답의 길이는 17, 모델이 생성한 요약문의 길이는 8이며, 두 문장이 공통으로 갖는 서브시퀀스 “_전국 / 적으로 / _비가 / _내 / 릴”의 길이는 5이다. 따라서, ROUGE-L(Recall)은 5/17이며, ROUGE-L(Precision)은 5/8가 될 수 있다.On the other hand, in ROUGE-L, the quality of a summary sentence can be evaluated by the length of a subsequence that two sentences have in common. For example, in FIG. 11, the length of the summary answer is 17, the length of the summary sentence generated by the model is 8, and the length of the subsequence “_Nationwide / Red / _ Rain / _ My / Reel” that the two sentences have in common is is 5. Therefore, ROUGE-L (Recall) is 5/17, and ROUGE-L (Precision) can be 5/8.

해당 실험에서는 ROUGE-1, ROUGE-2 그리고 ROUGE-L의 지표 각각에 대해 정밀도, 재현율, 그리고 F1-Score가 모두 측정되어 각 모델이 생성한 요약문의 품질이 평가될 수 있다. 구체적으로, 학습용 데이터로 모델이 학습되고 검증용 데이터로부터 손실(Loss) 값이 가장 낮은 에폭(Epoch)이 선정될 수 있으며, 이때의 모델이 테스트 데이터에 적용되어 생성된 요약문에 대해 ROUGE 지표가 산출될 수 있다.In this experiment, precision, recall, and F1-Score are all measured for each of the indicators of ROUGE-1, ROUGE-2, and ROUGE-L, so that the quality of the summary generated by each model can be evaluated. Specifically, the model is trained with the training data, and the epoch with the lowest loss value can be selected from the verification data, and the model at this time is applied to the test data, and the ROUGE index is calculated for the generated summary It can be.

도 12는 학습 데이터의 크기에 따른 각 모델들의 ROUGE-1(F1-Score) 값의 변화를 도식화한 그래프이다. 도 12는 트랜스포머만 사용한 전통적인 요약 모델(Emb.Random), Word2Vec을 사용하여 트랜스포머 임베딩 행렬의 초기값을 설정한 모델(Emb.Word2Vec), 그리고 본 발명에 따른 모델인 KoBERT를 사용하여 트랜스포머 임베딩 행렬의 초기값을 설정한 모델(Emb.KoBERT)의 ROUGE-1(F1-Score) 측면에서의 요약 품질을 나타낼 수 있다. 세 가지 모델 모두에서 학습 데이터의 크기가 작을수록 요약 성능이 저하되는 모습이 나타날 수 있다. 이러한 양상은 ROUGE-2, 그리고 ROUGE-L의 지표를 활용한 분석에서도 공통적으로 나타날 수 있으며, 해당 결과는 도 13을 통해 도시될 수 있다.12 is a graph illustrating changes in ROUGE-1 (F1-Score) values of each model according to the size of training data. 12 shows a traditional summary model using only transformers (Emb.Random), a model using Word2Vec to set the initial value of the transformer embedding matrix (Emb.Word2Vec), and a transformer embedding matrix using KoBERT, a model according to the present invention. It can represent the summary quality in terms of ROUGE-1 (F1-Score) of the model (Emb.KoBERT) for which the initial value was set. In all three models, the smaller the size of the training data, the lower the summary performance. This aspect can also appear in common in analyzes using indicators of ROUGE-2 and ROUGE-L, and the corresponding results can be shown in FIG. 13 .

도 12 및 13에서, Emb.Word2Vec 모델은 학습 데이터 사용 비율과 무관하게 가장 낮은 성능을 나타낼 수 있으며, Emb.Random과 Emb.KoBERT는 학습 데이터 사용 비율에 따라 성능 순위가 역전되는 모습을 나타낼 수 있다. 구체적으로, 학습 데이터의 양이 충분한 경우에는 자연어에 대한 사전 지식 없이 원문에만 의존하여 요약 학습을 수행한 Emb. Random 모델의 성능이 가장 우수하게 나타날 수 있으나, 학습 데이터의 양이 줄어들수록 Emb. Random 모델의 성능이 급격하게 하락할 수 있다. 이와 달리, 본 발명에 따른 모델인 Emb. KoBERT 모델은 학습 데이터 양의 감소에 따른 성능 저하 현상이 매우 완만하게 나타날 수 있으며, 이로 인해 적은 양의 학습 데이터가 사용된 50%, 20% 실험에서는 Emb. KoBERT의 요약 성능이 가장 우수하게 나타날 수 있다.12 and 13, the Emb.Word2Vec model can show the lowest performance regardless of the training data usage ratio, and the performance rankings of Emb.Random and Emb.KoBERT can be reversed according to the training data usage ratio. . Specifically, when the amount of learning data is sufficient, Emb. The performance of the random model may be the best, but as the amount of training data decreases, the Emb. The performance of random models can degrade rapidly. In contrast, the model according to the present invention, Emb. The performance degradation of the KoBERT model due to the decrease in the amount of training data can be very mild, and due to this, in 50% and 20% experiments using small amounts of training data, Emb. The summary performance of KoBERT can be shown to be the best.

결과적으로, 실험을 통해 본 발명에 따른 모델이 소량의 학습 데이터가 주어진 상황에서 기존의 요약 모델에 비해 양질의 요약문을 생성할 수 있음이 확인될 수 있다. 해당 결과는 방대한 양의 텍스트 데이터로부터 문맥 정보를 학습한 KoBERT의 임베딩 행렬이 요약 학습을 수행할 트랜스포머에게 자연어 정보를 효과적으로 전달한 것에 기인한 것으로 해석될 수 있다.As a result, it can be confirmed through experiments that the model according to the present invention can generate a high-quality summary compared to the existing summary model in a situation where a small amount of training data is given. This result can be interpreted as being due to the fact that KoBERT's embedding matrix, which learned contextual information from a vast amount of text data, effectively delivered natural language information to the transformer to perform summary learning.

본 발명에 따른 텍스트 요약 방법 및 장치는 충분한 양의 학습 데이터가 확보되지 않으면 양질의 요약문을 생성하기 어렵다는 한계를 극복하기 위하여 한국어 사전학습 언어 모델인 KoBERT의 일부 요소를 추출하여 전통적인 트랜스포머 모델에 적용할 수 있다.The text summary method and apparatus according to the present invention extracts some elements of KoBERT, a Korean pre-learning language model, and applies them to the traditional transformer model in order to overcome the limitation that it is difficult to generate a high-quality summary unless a sufficient amount of training data is secured. can

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

100: 텍스트 요약 시스템
110: 사용자 단말 130: 텍스트 요약 장치
150: 데이터베이스
210: 임베딩 행렬 추출부 230: 추상 요약 모델 구축부
250: 텍스트 요약문 생성부 270: 요약문 품질 평가부
290: 제어부
100: text summary system
110: user terminal 130: text summary device
150: database
210: embedding matrix extraction unit 230: abstract summary model building unit
250: text summary generation unit 270: summary quality evaluation unit
290: control unit

Claims (13)

텍스트의 문맥 정보를 사전학습하여 구축된 언어모델로부터 임베딩 행렬(embedding matrix)를 추출하는 임베딩 행렬 추출단계;
상기 임베딩 행렬이 적용된 추상 요약 모델을 정의하고 학습 데이터셋을 기초로 텍스트 요약문 생성을 위한 요약 학습을 수행하여 상기 추상 요약 모델을 구축하는 추상 요약 모델 구축단계; 및
상기 추상 요약 모델을 이용하여 입력 텍스트에 대한 요약문을 생성하는 텍스트 요약문 생성단계;를 포함하는 사전학습 언어모델을 활용한 트랜스포머 기반 텍스트 요약 방법.
an embedding matrix extraction step of extracting an embedding matrix from a language model built by prior learning of text context information;
an abstract summary model building step of defining an abstract summary model to which the embedding matrix is applied and constructing the abstract summary model by performing summary learning for text summary generation based on a training dataset; and
A text summary generation step of generating a summary of the input text using the abstract summary model; a transformer-based text summary method using a pre-learning language model comprising:
제1항에 있어서, 상기 임베딩 행렬 추출단계는
사전학습된 코버트(KoBERT) 모델의 입력 계층(layer)에서 토큰 임베딩 행렬을 상기 임베딩 행렬로서 추출하는 단계를 포함하는 것을 특징으로 하는 사전학습 언어모델을 활용한 트랜스포머 기반 텍스트 요약 방법.
The method of claim 1, wherein the step of extracting the embedding matrix
A transformer-based text summarization method using a pre-trained language model, comprising the step of extracting a token embedding matrix as the embedding matrix from an input layer of a pre-trained KoBERT model.
제2항에 있어서, 상기 임베딩 행렬 추출단계는
상기 입력 계층의 임베딩 계층들에서 적어도 토큰 임베딩 행렬을 포함하는 임베딩 조합을 통해 상기 임베딩 행렬을 생성하는 단계를 포함하는 것을 특징으로 하는 사전학습 언어모델을 활용한 트랜스포머 기반 텍스트 요약 방법.
The method of claim 2, wherein the step of extracting the embedding matrix
Transformer-based text summarization method using a pre-learning language model, characterized in that it comprises generating the embedding matrix through an embedding combination including at least a token embedding matrix in the embedding layers of the input layer.
제1항에 있어서, 상기 추상 요약 모델 구축단계는
트랜스포머(transformer) 모델을 상기 추상 요약 모델로서 정의하고 상기 트랜스포머 모델의 임베딩 계층에 상기 임베딩 행렬을 적용하는 단계를 포함하는 것을 특징으로 하는 사전학습 언어모델을 활용한 트랜스포머 기반 텍스트 요약 방법.
The method of claim 1, wherein the abstract summary model building step
A transformer-based text summary method using a pre-learning language model, comprising defining a transformer model as the abstract summary model and applying the embedding matrix to an embedding layer of the transformer model.
제4항에 있어서, 상기 추상 요약 모델 구축단계는
상기 트랜스포머 모델의 인코더 임베딩 행렬과 디코더(decoder) 임베딩 행렬을 각각 상기 임베딩 행렬로 대체하는 단계를 포함하는 것을 특징으로 하는 사전학습 언어모델을 활용한 트랜스포머 기반 텍스트 요약 방법.
The method of claim 4, wherein the abstract summary model building step
A transformer-based text summarization method using a pretrained language model, comprising the step of replacing an encoder embedding matrix and a decoder embedding matrix of the transformer model with the embedding matrix, respectively.
제4항에 있어서, 상기 추상 요약 모델 구축단계는
상기 학습 데이터셋의 원문 텍스트를 상기 트랜스포머 모델의 인코더(encoder)에 입력하는 단계;
상기 인코더의 임베딩 계층을 통해 상기 원문 텍스트에 대한 단어 벡터를 생성하는 단계;
상기 단어 벡터를 상기 인코더의 인코더 계층에 통과시켜 상기 디코더에 전달하는 단계;
상기 디코더를 통해 상기 원문 텍스트에 대응되는 요약 텍스트를 생성하는 단계; 및
상기 원문 텍스트의 정답 텍스트와 상기 요약 텍스트 간의 차이를 비교하여 상기 인코더 및 상기 디코더를 갱신하는 단계를 포함하는 것을 특징으로 하는 사전학습 언어모델을 활용한 트랜스포머 기반 텍스트 요약 방법.
The method of claim 4, wherein the abstract summary model building step
inputting the original text of the training dataset to an encoder of the transformer model;
generating word vectors for the original text through an embedding layer of the encoder;
passing the word vector through an encoder layer of the encoder to the decoder;
generating summary text corresponding to the original text through the decoder; and
A transformer-based text summary method using a pre-learning language model comprising the step of comparing the difference between the correct text of the original text and the summary text and updating the encoder and the decoder.
제1항에 있어서, 상기 텍스트 요약문 생성단계는
상기 입력 텍스트를 복수의 부분 텍스트들로 분할하는 단계;
상기 복수의 부분 텍스트들 각각을 상기 추상 요약 모델에 입력하여 복수의 부분 요약문들을 생성하는 단계; 및
상기 복수의 부분 요약문들을 통합하여 상기 요약문을 생성하는 단계를 포함하는 것을 특징으로 하는 사전학습 언어모델을 활용한 트랜스포머 기반 텍스트 요약 방법.
The method of claim 1, wherein the text summary generating step
dividing the input text into a plurality of partial texts;
generating a plurality of partial summaries by inputting each of the plurality of partial texts into the abstract summary model; and
A transformer-based text summary method using a pre-learning language model, comprising generating the summary by integrating the plurality of partial summaries.
제1항에 있어서,
상기 요약문의 품질을 평가하는 요약문 품질 평가단계;를 더 포함하는 것을 특징으로 하는 사전학습 언어모델을 활용한 트랜스포머 기반 텍스트 요약 방법.
According to claim 1,
A transformer-based text summary method using a pre-learning language model, further comprising a summary sentence quality evaluation step of evaluating the quality of the summary sentence.
제8항에 있어서, 상기 요약문 품질 평가단계는
상기 요약문과 사용자에 의해 입력된 정답문 사이의 단어 일치 정도에 따라 적어도 하나의 평가 지표를 산출하는 단계를 포함하는 것을 특징으로 하는 사전학습 언어모델을 활용한 트랜스포머 기반 텍스트 요약 방법.
The method of claim 8, wherein the summary quality evaluation step
A transformer-based text summary method using a pre-learning language model, comprising calculating at least one evaluation index according to the degree of word matching between the summary sentence and the correct answer input by the user.
텍스트의 문맥 정보를 사전학습하여 구축된 언어모델로부터 임베딩 행렬(embedding matrix)를 추출하는 임베딩 행렬 추출부;
상기 임베딩 행렬이 적용된 추상 요약 모델을 정의하고 학습 데이터셋을 기초로 텍스트 요약문 생성을 위한 요약 학습을 수행하여 상기 추상 요약 모델을 구축하는 추상 요약 모델 구축부; 및
상기 추상 요약 모델을 이용하여 입력 텍스트에 대한 요약문을 생성하는 텍스트 요약문 생성부;를 포함하는 사전학습 언어모델을 활용한 트랜스포머 기반 텍스트 요약 장치.
an embedding matrix extractor extracting an embedding matrix from a language model built by prior learning of text context information;
an abstract summary model builder defining an abstract summary model to which the embedding matrix is applied and constructing the abstract summary model by performing summary learning for text summary generation based on a training dataset; and
A text summary generator using the abstract summary model to generate a summary of the input text; a transformer-based text summary device using a pre-learning language model comprising:
제10항에 있어서, 상기 임베딩 행렬 추출부는
사전학습된 코버트(KoBERT) 모델의 입력 계층(layer)에서 토큰 임베딩 행렬을 상기 임베딩 행렬로서 추출하는 것을 특징으로 하는 사전학습 언어모델을 활용한 트랜스포머 기반 텍스트 요약 장치.
11. The method of claim 10, wherein the embedding matrix extraction unit
A transformer-based text summarization device using a pretrained language model, characterized in that a token embedding matrix is extracted as the embedding matrix from an input layer of a pretrained KoBERT model.
제10항에 있어서, 상기 추상 요약 모델 구축부는
트랜스포머(transformer) 모델을 상기 추상 요약 모델로서 정의하고 상기 트랜스포머 모델의 임베딩 계층에 상기 임베딩 행렬을 적용하는 것을 특징으로 하는 사전학습 언어모델을 활용한 트랜스포머 기반 텍스트 요약 장치.
The method of claim 10, wherein the abstract summary model building unit
A transformer-based text summary device using a pretrained language model, characterized in that a transformer model is defined as the abstract summary model and the embedding matrix is applied to an embedding layer of the transformer model.
제12항에 있어서, 상기 추상 요약 모델 구축부는
상기 트랜스포머 모델의 인코더 임베딩 행렬과 디코더(decoder) 임베딩 행렬을 각각 상기 임베딩 행렬로 대체하는 것을 특징으로 하는 사전학습 언어모델을 활용한 트랜스포머 기반 텍스트 요약 장치.
The method of claim 12, wherein the abstract summary model building unit
A transformer-based text summarization device using a pretrained language model, characterized in that the encoder embedding matrix and the decoder embedding matrix of the transformer model are replaced with the embedding matrix, respectively.
KR1020220009998A 2021-12-30 2022-01-24 Transformer-based text summarization method and device using pre-trained language model KR20230103782A (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
KR1020210192752 2021-12-30
KR20210192752 2021-12-30

Publications (1)

Publication Number Publication Date
KR20230103782A true KR20230103782A (en) 2023-07-07

Family

ID=87154421

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020220009998A KR20230103782A (en) 2021-12-30 2022-01-24 Transformer-based text summarization method and device using pre-trained language model

Country Status (1)

Country Link
KR (1) KR20230103782A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117875268A (en) * 2024-03-13 2024-04-12 山东科技大学 Extraction type text abstract generation method based on clause coding
CN117951291A (en) * 2024-03-26 2024-04-30 西南石油大学 Two-stage local generation type abstract method based on guiding mechanism

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100669534B1 (en) 2004-12-09 2007-01-16 학교법인 울산공업학원 Text Summarization Method and System with Sentence Abstraction and Abductive Rules, and Method for Text semantic analysis and expression

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100669534B1 (en) 2004-12-09 2007-01-16 학교법인 울산공업학원 Text Summarization Method and System with Sentence Abstraction and Abductive Rules, and Method for Text semantic analysis and expression

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117875268A (en) * 2024-03-13 2024-04-12 山东科技大学 Extraction type text abstract generation method based on clause coding
CN117875268B (en) * 2024-03-13 2024-05-31 山东科技大学 Extraction type text abstract generation method based on clause coding
CN117951291A (en) * 2024-03-26 2024-04-30 西南石油大学 Two-stage local generation type abstract method based on guiding mechanism
CN117951291B (en) * 2024-03-26 2024-05-31 西南石油大学 Two-stage local generation type abstract method based on guiding mechanism

Similar Documents

Publication Publication Date Title
Zanzotto et al. KERMIT: Complementing transformer architectures with encoders of explicit syntactic interpretations
Guo et al. A novel fake news detection model for context of mixed languages through multiscale transformer
Terechshenko et al. A comparison of methods in political science text classification: Transfer learning language models for politics
CN113254610B (en) Multi-round conversation generation method for patent consultation
Yan et al. A semantic and emotion‐based dual latent variable generation model for a dialogue system
KR20230103782A (en) Transformer-based text summarization method and device using pre-trained language model
Plepi et al. Context transformer with stacked pointer networks for conversational question answering over knowledge graphs
CN110633359A (en) Sentence equivalence judgment method and device
Zheng et al. A Hierarchical Neural‐Network‐Based Document Representation Approach for Text Classification
Qiu et al. Chinese Microblog Sentiment Detection Based on CNN‐BiGRU and Multihead Attention Mechanism
Ameur et al. A new method for sentiment analysis using contextual auto-encoders
Ye et al. Automated conversion of engineering rules: Towards flexible manufacturing collaboration
Jong et al. Improving Performance of Automated Essay Scoring by Using Back‐Translation Essays and Adjusted Scores
Abolghasemi et al. HTS-DL: hybrid text summarization system using deep learning
Schützler Although‐constructions in varieties of English
Manias et al. An evaluation of neural machine translation and pre-trained word embeddings in multilingual neural sentiment analysis
CN113033153A (en) Neural machine translation model fusing key information based on Transformer model
Choi et al. Neural attention model with keyword memory for abstractive document summarization
He et al. Entire information attentive GRU for text representation
CN115203206A (en) Data content searching method and device, computer equipment and readable storage medium
KR102330190B1 (en) Apparatus and method for embedding multi-vector document using semantic decomposition of complex documents
Duan et al. Enhancing Text Generation via Parse Tree Embedding
Wang [Retracted] Design of English Translation Model Based on Recurrent Neural Network
Shen et al. Mitigating Intrinsic Named Entity-Related Hallucinations of Abstractive Text Summarization
Gouws Deep unsupervised feature learning for natural language processing