CLM, MLM, TLM 그리고 Seq2Seq

2023. 10. 30. 14:44 · LLM 관련 논문 정리

원래 내가 배울 때는 GPT 는 그냥 Language Modeling task 를 진행하는 모델이었고, BERT 는 masked LM 이었다. 그리고 language modeling 은 다음 token 예측 을 의미했다.

하지만 어느 순간 CLM (Causal Language Modeling) 이라는 단어가 생가서 너무 너무 헷갈렸다…

다시 정리해보자면,

Language Model 은 자연어 에 대한 확률 모델이다. 토큰에 확률을 할당하여 token sequence 를 모델링하는 모델이다.

A language model is a probabilistic model of a natural language that can generate probabilities of a series of words, based on text corpora in one or multiple languages it was trained on.

참조 : https://en.wikipedia.org/wiki/Language_model

 

Language model - Wikipedia

From Wikipedia, the free encyclopedia Statistical model of structure of language A language model is a probabilistic model of a natural language[1] that can generate probabilities of a series of words, based on text corpora in one or multiple languages it

en.wikipedia.org

 

Language Model 은 이제 그 의미가 확장되어 LM 안에는 CLM(Causal Language Model), MLM(Masked Language Model), TLM((Translation Language Modeling)) 등이 있다.

그리고 각 Language Model 이 하는 task 들을 Causal Language Modeling 등이라고 한다.

Language Modeling 은 기존의 언어 정보를 이용하여 모르는 토큰을 예측하는 task 이다.

내가 기존에 알고 있던 LM 은 이제는 CLM 이라고 하는 것이 맞다.

 

Causal Language Modeling 이란 인과적으로 이전 토큰들에서 다음 토큰을 예측하는 task 이다.

 

그렇지만 또 헷갈리는 점은

원래 pre-training 등에 사용하는 language modeling task 는 label 이 필요없이

“A bear want the honey jar for breakfast.”

라는 문장을 학습할 때,

A

A bear

A bear want

:

A bear want the honey jar for breakfast.

이렇게 한 토큰씩 예측하는 방식만 알았는데

 

요즘 애들은

한 뭉치의 input 시퀀스를 받아서 한뭉치의 output 을 내야 하는 task 도 많이 있는데,

이런 task 의 예시 중 하나는 summarization 이다.

예를 들면,

"Mars is the fourth planet and the furthest terrestrial planet from the Sun. The reddish color of its surface is due to finely grained iron oxide dust in the soil, giving it the nickname the Red Planet. Mars's radius is second smallest among the planets in the Solar System at 3389.5 km. The Martian dichotomy is visible on the surface on average, the terrain on Mars's northern hemisphere is flatter and lower than its southern hemisphere. Mars has a thin atmosphere made primarily of carbon dioxide and two irregularly shaped natural satellites, Phobos and Deimos."

 

라는 paragraph 가 주어지면

Mars is the fourth plaent from the sun and the furtherest terrestrial planet, known for its reddish color due to iron oxide dust in its soil.

위와 같은 요약문을 출력하는 task 이다.

 

위의 task 둘 다 CLM task 라고 할 수 있다.

 

💡 위의 LM task 에서 만약에 모델이 “A bear want the [apple]” 이라고 잘못 예측했을 때 loss 로 틀린 토큰에 대한 패널티를 준 후에는 어떻게 될까? 그 다음 토큰을 예측할 때는 apple 을 사용할까? 아니면 ‘honey’ 를 사용할까?

다음 jar 를 잘 예측하기 위해서는 원래 gold 인 honey 를 사용한다.

→ 당연할 수도 있지만 이런 자잘한 거 하나하나 조금 헷갈렸다.

 


 

그렇다면 seq2seq (Sequence to Sequence) 는 무엇일까?

 

시퀀스가 입력되면 다른 시퀀스를 출력하는 모델의 종류이다.

 

seq2seq 도 이전 내용을 기반으로 다음 내용을 예측하기 때문에 CLM 에 포함된다고 한다.

 

참조: https://medium.com/@tom_21755/understanding-causal-llms-masked-llm-s-and-seq2seq-a-guide-to-language-model-training-d4457bbd07fa

 

'LLM 관련 논문 정리' 카테고리의 다른 글

SPoT: Better Frozen Model Adaptation through Soft Prompt Transfer  (0) 2023.11.23
NEFTune: Noisy Embeddings Improve Instruction Fine-tuning  (0) 2023.11.15
Few-Shot Parameter-Efficient Fine-Tuning is Better and Cheaper than In-Context Learning (NIPS, 2208)  (0) 2023.09.30
PEFT (parameter-efficient fine tuning) 정리  (0) 2023.09.18
InstructGPT 상세 리뷰  (0) 2023.08.30
'LLM 관련 논문 정리' 카테고리의 다른 글
  • SPoT: Better Frozen Model Adaptation through Soft Prompt Transfer
  • NEFTune: Noisy Embeddings Improve Instruction Fine-tuning
  • Few-Shot Parameter-Efficient Fine-Tuning is Better and Cheaper than In-Context Learning (NIPS, 2208)
  • PEFT (parameter-efficient fine tuning) 정리
섬섬옥수수
섬섬옥수수
컴공 AI 개발자가 되기 위한 노역입니다
섬섬옥수수
아날로그 인간의 컴공 되기
섬섬옥수수
전체
오늘
어제
  • 분류 전체보기 N
    • 백준 단계별 코딩 테스트
    • KB 논문 정리
    • Memory network 논문 정리
    • LLM 관련 논문 정리 N
    • Python 및 Torch 코딩 이모저모
    • Clustering 관련 논문 정리
    • 머신러닝 이모저모
    • 암호학

블로그 메뉴

  • 홈
  • 태그
  • 방명록

공지사항

인기 글

태그

  • 문제풀이
  • 소프트웨어
  • 백준
  • constituency tree
  • CUDA
  • e5-v
  • 인공지능융합기반시스템개론
  • GIT
  • PEFT
  • dependency tree
  • 코딩테스트
  • eeve
  • 이화여대
  • efficient and effective vocabulary expansion towards multilingual large language models
  • ragas
  • 심재형
  • 티스토리챌린지
  • vocabulary expansion
  • 오블완
  • 하드웨어

최근 댓글

최근 글

hELLO · Designed By 정상우.v4.2.0
섬섬옥수수
CLM, MLM, TLM 그리고 Seq2Seq
상단으로

티스토리툴바

개인정보

  • 티스토리 홈
  • 포럼
  • 로그인

단축키

내 블로그

내 블로그 - 관리자 홈 전환
Q
Q
새 글 쓰기
W
W

블로그 게시글

글 수정 (권한 있는 경우)
E
E
댓글 영역으로 이동
C
C

모든 영역

이 페이지의 URL 복사
S
S
맨 위로 이동
T
T
티스토리 홈 이동
H
H
단축키 안내
Shift + /
⇧ + /

* 단축키는 한글/영문 대소문자로 이용 가능하며, 티스토리 기본 도메인에서만 동작합니다.