본문 바로가기

LG Aimers

Module6. 딥러닝 (2)

Part1.  seq2seq with attention 모델 및 이를 통한 자연어 이해 및 생성

[Recurrent Neural Networks]

  • Various Problem settings of RNN based sequence Modeling
    • one to one - Vanilla Neural Networks
    • one to many - Image Captioning (image-> sequence of words)
    • many to one - Sentiment classification (sequence of words ->  sentiment)
    • many to many - Machine Translation(다 입력 받고 번역), Video classifiacation on Frame level (그때 그때 번역)

 

  • Character-level Language Model
    • auto-regressive model : 한 model의 output이 그 다음 time step의 입력으로 주어지는 모델

 

  • Gradient vanishing or exploding problem of vanilla RNN
    -> LSTM or GPU

gate 구조

 

[Attention]

  • Seq2Seq Model - 별개의 RNN이 각각 인코더, 디코더로 질문을 입력 받고 답변을 생성
    -> 인코더의 마지막 time step의 hidden state vector만을 입력으로 받음 => bottleneck problem (병목 현상)
  •  Attention - 필요로 하는 hidden state vector들을 가져가서 예측에 직접적으로 활용  -> 병목현상 해결

 

  • gradient path가 하나 더 생겨 학습 용이해짐 -> gradient vanishing 문제 해결
  • 기계번역 task에서 우수함 
  • self-attention (serving a general-purpose sequence or set encoder)
    -> Transformer, BERT에서 사용

Part2.  Transformer 모델의 동작 원리 

[Transformer ]

  • seq2seq모델에서 기존의 RNN 대신 attention만을 사용하여 인코더 디코더를 구성한 모델
  • general purpose sequence
  • 트랜스포머를 깊게 쌓아서 훈련시켜 발전하고 있음 -> various NLP tasks
  • 단점 : 메모리 요구량 ↑, 디코더에서는 autoregressive model의 제약 조건 여전히 존재

 

1. Scaled Dot-product Attention

-> key 벡터의 차원으로 scaling

 

2. Multi-head Attention

-> head 별로 각자 다른 기준으로 encoding

 

3. Add & Norm

 

4. Positional Encoding

 

5. Masked Self-attention


Part3.  자기지도학습 및 언어 모델을 통한 대규모 사전 학습 모델

[Self-Supervised Learning]

: label이 없는 데이터의 일부를 가리고 가려진 부분을 잘 복원 혹은 예측하도록 하는 task

 

  • Transfer learning from self-supervised pre-trained Model

 

 

[BERT]

: Pre-training of Deep Bidirectional Transformers for Language Understanding

  • Learn through masked language modeling (MLM), next-sentence prediction(NSP) Pre-training tasks
  • Use large-scale data and large-scale model

 

1. Masked Language Model (MLM)

: 특정 %만큼의 input 데이터 토큰들을 랜덤으로 masking, 그리고 그 토큰을 예측

  • k % of the words to predict
    • 80% - replace with [MASK]
    • 10% - replace with a random word
    • 10% - keep the sentence as same
  • k가 너무 크면 문맥을 제대로 잡아내지 못하고 너무 작으면 비효율적 -> BERT는 15%

 

2. Next Sentence Prediction (NSP)

: 다음에 오는 문장인지 binary classification

 

 

 

[GPT-1/2/3]

: Generateive Pre-Trained Transformer

  • GPT-2 : Language models are unsupervised multi-task learners
    • 엄청난 양의 high-quality dataset 사용
  • GPT-3 : Language models are Few-shot learners
    • scaling up language models

-> 어떻게 프롬프트를 구성해서 원하는 답변의 성능을 얻어내는지 task : Prompt tuning

 

  • Copilot : promgram data로 사전학습된 GPT-3 fine tuning모델 -> 프로그램 자동 완성
  • HyperCLOVA : GPT-3 한국어 버전 of NAVER

 

  • 요약
    • 모델들은 점점 커지고 있음 -> 요구되는 GPU도 커짐에 따라 대기업 중심으로 발전 중
    • self supervised learning 기술 덕분에 언어모델의 능력이 점점 발전 중
    • getting closer to artificial general intelligence

강의 내용 정리 : LG Aimers AI Essential Course - Module

 

 

 

 

 

'LG Aimers' 카테고리의 다른 글

Module 8. B2B 고객데이터 기반 예측 단서 스코어링 모델  (1) 2024.01.23
Module 7. B2B 마케팅  (0) 2024.01.21
Module6. 딥러닝 (1)  (0) 2024.01.20
Module4. 지도학습(분류/회귀)  (0) 2024.01.16
Module2. Mathematics for ML  (1) 2024.01.11