뉴스 도메인 질의응답 시스템 (21-1학기 졸업 프로젝트)

Overview

뉴스 도메인 질의응답 시스템

본 프로젝트는 뉴스기사에 대한 질의응답 서비스 를 제공하기 위해서 진행한 프로젝트입니다. 약 3개월간 ( 21. 03 ~ 21. 05 ) 진행하였으며 Transformer 아키텍쳐 기반의 Encoder를 사용하여 한국어 질의응답 데이터셋으로 fine-tuning을 수행한 모델을 기반으로 최신 뉴스 기사를 기반으로 하여 질의응답 서비스를 제공합니다.


시스템 구성 요소

총 3가지 모듈로 구성되어 있으며 웹 클라이언트에서 질의를 입력받은 후 질문과 유사한 최신 뉴스 기사를 수집하고 이를 기반으로 기계독해를 수행하여 사용자에게 적절한 정답을 제시합니다.



웹 데모 페이지

General한 한국어 데이터셋을 기반으로 학습한 한국어 기계독해 모델에 뉴스 도메인에 적합한 추가적으로 학습한 모델을 서빙하여 실시간 질의응답 서비스를 제공한다

메인 검색 페이지

image

  • K 지정: 관련도 최상위 K개의 문서를 리턴
  • 질의 입력: 질문을 입력받음
  • 검색: 검색버튼을 누르면 로딩바 재생, 검색 -> 기계독해 수행

질의 결과

image

  • 기계독해 결과 출력: 정답이 있다고 판단한 문서에 대해서 결과출력
  • 확률값을 기준으로 소팅: 확률값이 가장 높은 결과를 맨 위에 보여줌

문서 상세 보기

image

  • 문맥 보기: 정답주변의 문맥을 볼 수 있음
  • 정답 하이라이팅: 정답을 보기 쉽게 하이라이팅함
  • 원본 뉴스기사 하이퍼링크: 기사 원문을 바로 찾아갈 수 있도록 제공

Requirements

For model serving

bentoml==0.12.1
torch==1.7.1
attrdict==2.0.1
fastprogress==1.0.0
numpy==1.19.2
transformers==4.1.1
scipy==1.5.4
scikit-learn==0.24.0
seqeval==1.2.2
sentencepiece==0.1.95
six==1.15.0

For web hosting

conda==4.9.2
Flask==1.1.2
html5lib @ file:///tmp/build/80754af9/html5lib_1593446221756/work
lxml @ file:///tmp/build/80754af9/lxml_1603216285000/work
MarkupSafe==1.1.1
requests @ file:///tmp/build/80754af9/requests_1592841827918/work
urllib3 @ file:///tmp/build/80754af9/urllib3_1603305693037/work

Model Serving with BentoML

두가지 MRC모델을 손쉽게 생성가능

  • make_single_mrc_model.py : Threshold-based MRC Model
  • make_dual_mrc_model.py : Retrospective Reader(IntensiveReadingModule, SketchReadingModule)

모델 생성

python make_dual_mrc_model.py

모델 배포

bentoml serve DualMRCModel:latest

데이터셋

  • Korquad2.0, AIHUB 기계독해 데이터셋(뉴스도메인 QAset) 사용
  • Korquad2.0은 HTML태그를 제거하고 문단단위로 전처리하여 Squad2.0형식으로 변환
  • Negative example을 포함하여 변환된 Korquad2.0 데이터 셋120만개와 AIHUB 기계독해 데이터셋 28만개를 학습시 사용
  • 약 7만개의 AIHUB 기계독해 데이터셋을 평가시 사용

모델 학습

  • 코쿼드 데이터를 3번, AIHUB 데이터를 7번 반복학습
  • 파라미터는 KoELECTRA-small-v3 모델의 configuration을 그대로 사용

모델 평가

General

  • 변환한 코쿼드의 데브셋 약 13만개를 평가 데이터로 사용
  • Soft/Hard 필터링 모델에 대한 평가 수행

Soft 필터링

  • Retrospective Reader 구조를 한국어 기계독해에 적용
  • SketchReading, IntensiveReading의 정보를 합산하여 정답을 검증
  • 가중치 변수는 추론 정보의 조합 비율을 말함
  • 아래와 같이 두 가지 모듈의 정보를 적절히 반영했을때 NoAnswer 분류 성능이 더 좋음을 알 수 있었음


Hard 필터링

  • 문단별 선별적으로 독해하는 상황을 가정함
  • SketchReading에서 정답이 없다고 판별한 경우 과감히 Skip
  • 추론 효율 향상과 정답이 없는 문단을 독해하여 발생할 수 있는 Negative bias를 줄이고자 함.
  • 하지만 필터링 비율에 따라서 성능저하 발생
  • 따라서, Positive example의 추론여부가 중요한 기계독해에선 Soft필터링 방식이 적절함을 보임 <<<<<<< HEAD

=======
![image](https://user-images.githubusercontent.com/48018483/120331699-03d07280-c329-11eb-9133-7f536130b688.png)

2317d0e137e1d25027ee78b55df4e5682a391295

Domain-Specific

  • AIHUB 기계독해 데이터셋 35만개의 일부를(20%) 평가 데이터로 사용
  • 단일 모델에 대한 평가만 수행
  • NoAnswer 분류시 사용하는 임계값을 변경하며 실험
Total
(EM)
Total
(F1)
정답이 있는 경우
(F1)
정답이 없는 경우
(acc)
KoreanNewsQAModel X X 81.84 X
KoreanNewsQAModel(th=10) 67.87 82.56 81.64 84.85
KoreanNewsQAModel(th=0) 70.58 84.92 80.53 95.89

전체적인 성능치를 고려하여 임계값을 0으로 설정하여 모델을 서빙하기로 결정

Citation

@misc{park2020koelectra,
  author = {Park, Jangwon},
  title = {KoELECTRA: Pretrained ELECTRA Model for Korean},
  year = {2020},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/monologg/KoELECTRA}}
}

Reference

Owner
TaegyeongEo
TaegyeongEo
A single model that parses Universal Dependencies across 75 languages.

A single model that parses Universal Dependencies across 75 languages. Given a sentence, jointly predicts part-of-speech tags, morphology tags, lemmas, and dependency trees.

Dan Kondratyuk 189 Nov 29, 2022
Source code of the "Graph-Bert: Only Attention is Needed for Learning Graph Representations" paper

Graph-Bert Source code of "Graph-Bert: Only Attention is Needed for Learning Graph Representations". Please check the script.py as the entry point. We

14 Mar 25, 2022
MHtyper is an end-to-end pipeline for recognized the Forensic microhaplotypes in Nanopore sequencing data.

MHtyper is an end-to-end pipeline for recognized the Forensic microhaplotypes in Nanopore sequencing data. It is implemented using Python.

willow 6 Jun 27, 2022
Write Python in Urdu - اردو میں کوڈ لکھیں

UrduPython Write simple Python in Urdu. How to Use Write Urdu code in سامپل۔پے The mappings are as following: "۔": ".", "،":

Saad A. Bazaz 26 Nov 27, 2022
Image2pcl - Enter the metaverse with 2D image to 3D projections

Image2PCL Enter the metaverse with 2D image to 3D projections! This is an implem

Benjamin Ho 0 Feb 05, 2022
NL-Augmenter 🦎 → 🐍 A Collaborative Repository of Natural Language Transformations

NL-Augmenter 🦎 → 🐍 The NL-Augmenter is a collaborative effort intended to add transformations of datasets dealing with natural language. Transformat

684 Jan 09, 2023
Twitter-Sentiment-Analysis - Analysis of twitter posts' positive and negative score.

Twitter-Sentiment-Analysis The hands-on project is in Python 3 Programming class offered by University of Michigan via Coursera. The task is to build

Eszter Pai 1 Jan 03, 2022
Accurately generate all possible forms of an English word e.g "election" --> "elect", "electoral", "electorate" etc.

Accurately generate all possible forms of an English word Word forms can accurately generate all possible forms of an English word. It can conjugate v

Dibya Chakravorty 570 Dec 31, 2022
ChainKnowledgeGraph, 产业链知识图谱包括A股上市公司、行业和产品共3类实体

ChainKnowledgeGraph, 产业链知识图谱包括A股上市公司、行业和产品共3类实体,包括上市公司所属行业关系、行业上级关系、产品上游原材料关系、产品下游产品关系、公司主营产品、产品小类共6大类。 上市公司4,654家,行业511个,产品95,559条、上游材料56,824条,上级行业480条,下游产品390条,产品小类52,937条,所属行业3,946条。

liuhuanyong 415 Jan 06, 2023
Sample data associated with the Aurora-BP study

The Aurora-BP Study and Dataset This repository contains sample code, sample data, and explanatory information for working with the Aurora-BP dataset

Microsoft 16 Dec 12, 2022
Search msDS-AllowedToActOnBehalfOfOtherIdentity

前言 现在进行RBCD的攻击手段主要是搜索mS-DS-CreatorSID,如果机器的创建者是我们可控的话,那就可以修改对应机器的msDS-AllowedToActOnBehalfOfOtherIdentity,利用工具SharpAllowedToAct-Modify 那我们索性也试试搜索所有计算机

Jumbo 26 Dec 05, 2022
TFIDF-based QA system for AIO2 competition

AIO2 TF-IDF Baseline This is a very simple question answering system, which is developed as a lightweight baseline for AIO2 competition. In the traini

Masatoshi Suzuki 4 Feb 19, 2022
Jarvis is a simple Chatbot with a GUI capable of chatting and retrieving information and daily news from the internet for it's user.

J.A.R.V.I.S Kindly consider starring this repository if you like the program :-) What/Who is J.A.R.V.I.S? J.A.R.V.I.S is an chatbot written that is bu

Epicalable 50 Dec 31, 2022
Weaviate demo with the text2vec-openai module

Weaviate demo with the text2vec-openai module This repository contains an example of how to use the Weaviate text2vec-openai module. When using this d

SeMI Technologies 11 Nov 11, 2022
Generating Korean Slogans with phonetic and structural repetition

LexPOS_ko Generating Korean Slogans with phonetic and structural repetition Generating Slogans with Linguistic Features LexPOS is a sequence-to-sequen

Yeoun Yi 3 May 23, 2022
CodeBERT: A Pre-Trained Model for Programming and Natural Languages.

CodeBERT This repo provides the code for reproducing the experiments in CodeBERT: A Pre-Trained Model for Programming and Natural Languages. CodeBERT

Microsoft 1k Jan 03, 2023
Ongoing research training transformer language models at scale, including: BERT & GPT-2

What is this fork of Megatron-LM and Megatron-DeepSpeed This is a detached fork of https://github.com/microsoft/Megatron-DeepSpeed, which in itself is

BigScience Workshop 316 Jan 03, 2023
Extracting Summary Knowledge Graphs from Long Documents

GraphSum This repo contains the data and code for the G2G model in the paper: Extracting Summary Knowledge Graphs from Long Documents. The other basel

Zeqiu (Ellen) Wu 10 Oct 21, 2022
Coreference resolution for English, French, German and Polish, optimised for limited training data and easily extensible for further languages

Coreferee Author: Richard Paul Hudson, Explosion AI 1. Introduction 1.1 The basic idea 1.2 Getting started 1.2.1 English 1.2.2 French 1.2.3 German 1.2

Explosion 70 Dec 12, 2022
CoSENT 比Sentence-BERT更有效的句向量方案

CoSENT 比Sentence-BERT更有效的句向量方案

苏剑林(Jianlin Su) 201 Dec 12, 2022