ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • Learning Dense Representations of Phrases at Scale
    NAVER AI TECH 2023. 7. 4. 23:27

    Overview

    Phrase Retrieval

    • $E_s$는 phrase encoder이고 $E_q$는 question encoder이다.
    • MIPS(Maximum Inner Product Search)를 통해 question에 맞는 phrase를 추출해내고자 한다.

     

    Base Architecture

    • pre-trained language model을 이용하여 모든 passage tokens(word tokens)의 representation을 얻는다. 각 passage의 representation은 start token과 end token을 결합한 형태가 된다. 모든 phrases가 아닌 모든 words만 indexing, storing 하면 된다는 장점이 있다.

     

    • 또다른 pre-trained language model인 $M_{q,start}$와 $M_{q,end}$를 이용하여 $q^{start}$ token과 $q^{end}$ token을 각각 encoding 한다. 이후 두 토큰을 결합한다.

     

    Learning Phrase Representations

    Single-passage Training

    • 모든 passage tokens와 $q^{start}$ token의 inner product 및 $q^{end}$ token의 inner product를 계산한다. 정답($s^*$)과의 log likelihood를 계산한다.

    • 최종 Loss는 $L_{start}$와 $L_{end}$의 평균값이 된다. Loss를 최소화하도록 훈련한다. 해당 훈련을 통해서 phrase와 question token 사이의 cross attention을 계산하지 않고도 reading comprehension을 배울 수 있다.

     

    Data Augmentation

    • contexutalized word representation은 query-agnostic한 방식으로 인코딩 되었기 때문에 cross-attention models를 사용하여 query-dependent한 방식으로 인코딩된 representation에 비해 열등하다.
    • 이 performance gap은 어디에서 왔을까? 저자는 각 passage에 할당된 질문-정답 쌍이 적어 동일 passage 내 유사한 phrases를 구별하는 능력을 키우기 어려웠다고 주장한다.
    • 따라서 저자는 T5 모델을 활용하여 데이터 증강을 실시하였다. 먼저 passage와 gold answer를 모델에게 제공한 후, question words의 log-likelihood를 최대화하도록 훈련시켰다. 이후, 모델에게 passage와 candidate answers를 제공하여, 모델이 questions를 만들게 했다. cross-attention reading comprehension model이 주어진 passage와 만들어진 question으로 주어진 candidate answer를 맞출 경우에만 해당 데이터를 사용하였다.

     

    Distillation

    • 'distillation'은 증류라는 의미이며 특정 대상의 가장 중요한 부분을 추출한다는 의미를 지니고 있다. 
    • standard SpanBERT-base QA model의 encoder 분포와 본 모델의 encoder 분포 사이의 Kullback–Leibler divergence을 최소화하였다. 

     

    In-batch Negatives

    • 하나의 batch에 들어온 B개의 데이터 중 1개의 gold phrase는 positive로, 나머지 B-1개의 phrase는 negative로 활용한다. 

     

    Pre-batch Negatives

    • batch size는 GPU memory에 의해 제한받기 때문에 무한정 늘릴 수 없다. 따라서 pre-batch negatives라는 방법을 고안해냈다.
    • 먼저 in-batch negatives 방법을 사용하여 모델을 warm up 한다.
    • 선행하는 C개의 mini-batches를 캐싱하여 negatives로 활용한다. gradients는 캐싱된 데이터에 역전파되지는 않는다.
    • 결과적으로 (B - 1) + (B x C)개의 negatives를 매 batch마다 활용할 수 있게 된다.

     

    Training Objective

    • 지금까지 세 가지 방법의 학습법이 있었다. single-passage training, distillation, in-batch + pre-batch negatives.
    • 세 가지 Loss를 한 번에 사용하여 학습한다. λ= 1, λ2 = 2, λ3 = 4일 때 최고의 성능을 보여주었다. 

     

    Indexing and Search

    Indexing

    • phrase encoder를 훈련시킨 뒤 English Wikipedia의 모든 phrases를 indexing 한다.
    • To reduce the size of phrase dump, we follow and modify several techniques introduced in Seo et al. (2019).

     

    Search

    • 다음 수식을 이용해 question에 맞는 phrase를 탐색한다.

     

    Query-side Fine-tuning

    • phrase dump $H$가 주어졌을 때 question $q$를 통해 answer $a$를 추출할 수 있도록 question encoder $E_q$를 훈련한다. 수식은 다음과 같다.

    • training과 inference 사이의 간격을 메꿔준다. negative sampling이 효과적이더라도 여전히 전체 passages의 일부분만을 탐색하는 경향을 제거한다.
    • 전이 학습(transfer learning)을 용이하게 한다. 즉, 새로운 QA tasks에 더 빠르게 적응한다.

     

    Performance

     

     

    Reference

    Lee, J., Sung, M., Kang, J., & Chen, D. (2020). Learning dense representations of phrases at scale. arXiv preprint arXiv:2012.12624.

    'NAVER AI TECH' 카테고리의 다른 글

    Phrase Retrieval Learns Passage Retrieval, Too  (0) 2023.07.05
    BERT  (0) 2023.06.29
    Attention Is All You Need(2)  (0) 2023.06.09
    NextRise 2023, Seoul 회고록  (0) 2023.06.04
    CleanLab  (0) 2023.06.04

    댓글

Designed by Tistory.