Giter Site home page Giter Site logo

nlu_similarity_koelectra's Introduction

[NLU] 문장 유사도 분석

🚀 library: pandas, pytorch, transformers

1. 프로젝트 개요

- 배경 : 원티드 프리온보딩 AI/ML 과정의 팀 프로젝트(5인)로 진행
- 목적 : 한국어 문장의 문장 유사도 분석 모델 훈련 및 서비스화
- 과정 : 모델 조사 및 논문 리서치 - 모델 선정 및 학습 - 하이퍼파라미터 튜닝 - 모델 구현(FAST API) 
- 평가지표 : f1 score, pearson correlation
- KLUE-STS(Airbnb-리뷰/policy-뉴스/parakQC-스마트홈 쿼리)
- 데이터 전처리/분리 : 결측치 확인 , 중복 제거 후 train: validation = 9:1 로 나누어 학습 

3. 모델 학습

- 목표: pre-trained model을 사용하여 모델 훈련 후 하이퍼파라미터 튜닝을 통해 성능 향상
  • ELECTRA model

    • Masked Language Model을 개선시킨 RTD(Replaced Token Detection)방식으로 학습하는 모델
    • RTD : masking된 단어를 generator를 통해 다른 단어로 대체한 후 discriminator로 원본과 대조하여 학습하는 방식
  • 학습모델(base model) : KoELECTRA

    model batch_size train_steps learning_rate max_seq_len
    base-v3 256 1.5M 2e-4 512

4. 하이퍼파라미터 튜닝

  • epochs, warmup_proportion 튜닝
hyperparameters  base   best  reason
learning_rate 5e-5 5e-5 learning rate을 증가시키면 train loss가 줄어들지 않음
epochs 10 20 epoch 2배 조정시 성능이 크게 향상되었으나 그 이상은 투입 자원 대비 성능향상이 미미함
warmup_proportion 0.0 0.2 0.1씩 증가시킨 결과 0.2에서 가장 높은 성능향상
weight_decay 0.0 0.0 epoch 증가에 따라 weight decay를 함께 늘리면 성능이 향상되었으나 best는 아님
batch_size 32 32 batch size 증가시 out of memory 에러가 발생함
max_seq_len 120 120 학습데이터의 문장 평균 값을 고려하여 80으로 조정하였으나 성능이 하락함

5. 학습 결과

  • 하이퍼파라미터 튜닝 후 f1 score 약 0.014 향상
- base model best hyperparameter tuned model
    f1 score         0.8641035996     0.87802585193
pearson correlation    0.93091781336

[참고]


6. FAST API 구현

7. 과제 담당 역할

- 모델 조사 및 논문 리서치(SBERT)
- 하이퍼파라미터 튜닝 

8. 한계점 및 보완점

- 하이퍼파라미터 튜닝의 자동화 필요
- 추후 토큰화 방식의 다양화(형태소 임베딩 등)를 통한 모델의 성능 비교 
- (개인) 오픈소스를 활용한 논문의 코드 구현 및 모듈화를 위한 역량 개발 필요

nlu_similarity_koelectra's People

Contributors

pitapatat avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.