본문 바로가기

everyday paper📃

sentence embedding

저번주에 알아본 내용 💭

요즘 embedding space 관련해서 생각을 정리해보고 싶어서 관련된 paper들을 찾아보고 정리중이다. sentence embedding과 관련된 페이퍼들을 list-up하고 먼저 related work만 찾아서 쭉읽고 정리해봤다. 

related work를 먼저 본 이유는 각 논문에서 sentence embedding을 어떻게 보고 있는지, 어떤식으로 정리하고 있는지를 알면 전체적인 흐름 파악하기가 더 쉬울  것 같았다. 나에게는 확실히 도움되는 방식이었다.

 

노션에 적어둔 내용을 그대로 복붙한 것이기 때문에 노션 링크를 걸어두었다. 앞으로도 계속 업데이트 될 예정이다. 

https://saeran.notion.site/sentence-embedding-46f870a96d6b4e558adb723e1791e449

 

sentence embedding

papers

saeran.notion.site

Related Work : Sentence Embedding


  • sentence-BERT(2019)
    • Skip-Thought(2015) : encoder-decoder구조
    • InferSent(2017) : a siamese BiLSTM network with max-pooling over the output + SNLI dataset + multigenre NLI dataset
    • Universal Sentence Encoder(2018) : transformer network + SNLI를 unsupervised learning을 통해 augmentation
    • Learning Distributed Representations of Sentences from Unlabelled Data(2016) : sentence 임베딩이 잘 훈련된 태스크는 임베딩 퀄리티에 영향을 준다는 것을 증명
    • SNLI dataset이 문장임베딩 훈련에 적합한 데이터셋인 이유를 증명하는 페이퍼 : Supervised Learning of Universal Sentence Representations from Natural Language Inference Data
    • **Learning Semantic Textual Similarity from Conversations : siamese DAN과 siamese transformer을 reddit에서 대화데이터셋으로 학습시킴.
  • https://aclanthology.org/D17-1070.pdf (2017)
    • sentence representation learning은 대부분 unsupervised로 학습됨.
    • embedding the semantics of a whole sentence를 가장 잘하는 방법론은 아직 없는듯.
    • supervised learning을 하다보면 해당 태스크에 대한 bias들을 잘 학습해서 전반적인 정보나 의미를 쉽게 잊음. unsupervised learning의 문제는 모델을 specializing하기가 어렵다는 거지..ㅠ
    • 좀 복잡한 모델들이 최근에 소개 되었어
      • SkipThought : skip-gram model을 word-level → sentence-level로 적용시켰어. 문장 주변의 것들을 예측하는거로 sentence를 인코딩하고 linear model에 feature들을 사용해보니 꽤 좋은 성능을 내더라고
        • 특정 문장의 주변 문장들을 reconstruction하면서 만들어진 hidden vector를 representation vector로 사용함.
  • simCSE
    • word representation의 확장판
    • data augmentation :
      • contrastive objectives(simCSE)
    • NLI dataset + pretrained models
    • wieting 저자 : bilingual and back-translation corpora는 learning semantic similarity에 유용하다.
    • representation degeneration
      • solution : regularizing embedding

Learning Distributed Representations of Sentences from Unlabelled Data 😕


  • distributed phase, sentence representation를 학습하는 데에 어떤 것이 최적의 방법인지 알려져있지 않으니 우리가 분석해줄게!
  • 깊고 복잡한 모델은 supervised system에 잘 작동하고, 얕고 log-bilinear 모델은 representation space를 잘 만듦.
  • 훈련시간, 도메인 portability, performance 사이의 trade-off를 최적화하는 unsupervised representation-learning objectives 제안
  • ‘어떤 representation이 좋은건가’에 대한 논문 : https://aclanthology.org/J15-4004.pdf
  • word와 sentence embedding을 구분. word embedding을 이어서 사용하는 것이 아니라 해당 sentence를 embedding하려는 것

< 종류별로 모델 들고와서 supervised task와 unsupervised learning을 해서 평가해봄.>

  • evaluating sentence representation
    • supervised 평가 : 분류 태스크에서 representation을 추가해서 효과를 측정하는 것. general knowledge를 supervised model에 넣어서 평가한다고 생각하면됨.
      • 6개의 문장 분류 태스크
    • unsupervised 평가 : 사람 관련도 평가와 비교하기. sentence representation space가 직접적 비교로 사용됨.
      • 의미적으로 문장이 비슷한가에 대해 인간의 직관을 반영하여 잘 표현하고 있는지 측정해야함.
      • cosine distance
      • dataset : SICK, STS
  • The log-bilinear models
    • SkipGram, CBOW, ParagraphVec and FastSent
  • SDAE : denoising autoencoder
    • MSRP and SICK sentence relatedness respectively에서 좋은 성능을 보임. denosing을 복원하면서 학습하기 때문에 variants에 강하다고 생각.
  • 결과 : unsupervised evaluationsFastSent
  • 얘네가 dictionary definition을 word embedding에 매핑하는 모델링을 한게 있는데(DictRep : BOW + RNN) domain에 상관없이 robust한 결과를 낼 수 있다고 봄. 약간 사전적 정의를 사용해서 domain에 치우친 embedding이 아니라 보편적인 임베딩 값을 사용하는 느낌?
  • 다른 목적 함수를 쓴것은 다른 representation 결과를 가져옴.
    • SkiptThought가 가장 좋은 성능을 낸 분류 태스크 : TREC question type classification : label이 text로 되어있음. word단위로
    • paraphrase detection은 sentence에서 전체적인 문맥을 신경쓰는 모델이 더 나음.
  • Discussion
    • Different objectives yield different representations
      • AE-style models와 Skipthought/FastSent 차이
        • skipthought은TREC 태스크에서 잘됨. (질문을 카테고리 분류한건데, 라벨이 text로 되어있음)
        • SDAE는 paraphrase question에서 잘 됨.
        • CBOW, SDAE, DictRep, ParagraphVec : 단어 중복에 초점
        • SkipThought/FastSent : 문맥을 파악
    • Differences between supervised and unsupervised performance
      • log-bilinear model이 unsupervised에서 성능이 좋음
      • supervised 평가에서 좋은 모델들은 unsupervised에서 좋지 않음.
    • Knowledge transfer shows some promise
    • Differences in resource requirements
    • The role of word order is unclear
    • The evaluations have limitations
      • internal consistency : 크론바흐의 알파
      • MR, SUBJ and TREC (unsupervised dataset) : annotator가 한두명정도였음. relatedness는 굉장히 주관적인데, 해당 데이터셋에는 문제가 많음.
  • 결론
    • FastSent, SDAE 제안함. unsupervised evaluation(relatedness평가하는 데이터셋으로)에서 좋은 성능을 보임.
    • DictRep이 전반적으로 괜찮았는데 ‘general knowledge’덕분인 거 같음. supervised task에 general knowledge를 주입하는 방법을 연구해보면 좋을 것.

sentence-BERT

읽을 예정


  • bert, roberta는 STS task에서 SOTA이지만, 연산량이 너무 많음.
    • 10000개의 문장 중에서 가장 비슷한 문장 두개를 찾기 위해서는 5천만번의 추론을 해야하고 최대 65시간정도 걸림.
    • unsupervised task에는 적절하지 않은 구조를 가지고 있음.
  • 아이디어 : siamese and triplet network structures
  • 결과 : 65시간에서 5초로 줄임.

Universal Sentence Encoder

읽을 예정


SimCSE


  • contrastive learning을 사용해서 positive pair끼리 가까워지도록 학습시키면 semantically 비슷한 문장들끼리 비슷하게 묶이니까 sentence embedding이 잘되지 않을까?
    • contrastive learning is expected to alleviate the representation degeneration problem and improve uniformity of sentence embeddings
  • evaluation : representation embedding이 잘 되었는지 확인하는 방법으로 alignment(positive pair의 거리가 점점 작아질 수 있도록), uniformity(랜덤으로 한두개의 embedding을 뽑았을 때 해당 거리가 점점 멀어지도록 Uniformity하게 분포할 수 있도록 하는 Loss)
    • alignment
    • uniformity : 이 평가지표가 왜 필요한가? embedding space가 hypersphere에서 넓고, 고르게 분포하여 각 단어가 고유한 의미를 보존하는 것이 중요함.
  • contrastive learning : positive pair는 가까워지도록 negative pair는 멀어지도록 학습
    • unsupervised : input 문장에서 random mask dropout을 통해 minimal augmentation을 하고 encoder를 통과한 후 hidden state representation을 positive pair로 사용함. 그러면 원래 문장과는 다르지만 동일한 입력문장으로 만들어진 representation이기 때문에 positive pair로 사용하였음.
    • supervised : NLI dataset 사용
      • entailment label을 가진 문장을 positive pair로 사용
  • language representation의 문제점 : anisotropy(고깔모양. 전체임베딩공간이 구라고 한다면, 구에서 일부분에 집중되어 임베딩 공간이 구성되는 것을 말함 )
    • 학습된 임베딩이 벡터공간에서 좁은 고깔을 차지하고, 이는 표현을 심각하게 제한함.
    • embedding space를 isotropy하게 바꾸는 방법론들이 제안되고 있음. isotropy한 것을 우리는 uniform하다고 봄.