Giter Site home page Giter Site logo

ml-paper-reading's People

Contributors

pocca2048 avatar

Watchers

 avatar

ml-paper-reading's Issues

Exploring Simple Siamese Representation Learning

Conference :
Link : https://arxiv.org/pdf/2011.10566.pdf
Authors' Affiliation : Facebook AI Research, Kaiming He
TL;DR : 사실 negative pair, large batch, momentum encoder 중 어느 것도 없이도 충분히 의미있는 representation을 학습할 수 있다. Stop-gradient operation이 collapsing을 방지하는데 핵심적인 역할을 한다.

Summary :

1. Introduction

Siamese network = weights sharing NN applied on 2+ inputs

하나의 이미지에 대한 2개의 augmentation을 인풋으로 하고 similarity를 최대화.

그러나 샴네트워크는 하나의 constant로 모든 output이 collapse해버릴수 있다.

그동안 collapsing을 막는 여러 방법들이 제안되었다: contrastive learning에서는 pos는 끌어당기고 neg는 밀어서 negative pair를 통해 constant solution을 배제한다. clustering을 사용하는 방법도 있다( SwAV). BYOL에서는 positive pair에만 의존하지만 momentum encoder를 사용해서 collapse를 방지한다.

이 논문에서는 위의 어떤 방법도 사용하지 않고 간단한 샴 네트워크만으로 collapsing을 방지할 수 있음을 보인다.

We empirically show that collapsing solutions do exist, but a stop-gradient operation (Figure 1) is critical to pre- vent such solutions.

stop-gradient가 중요하다는 것은 기저에 사실 다른 optimization problem이 풀어지고 있다는걸 암시한다.

가설: 2개의 변수 집합이 implicit하게 있고, SimSiam은 각 집합을 번갈아가며 optimize 하는것처럼 행동한다.

이 가설을 검증하기 위해 PoC 실험을 한다.

샴 네트워크는 자연스럽게 invariance를 모델링 하기위한 inductive bias를 제시한다.

convolution이 자연스러운 translation-invariance를 도입하는 것처럼 샴네트워크는 더 복잡한 transformation에 대한 invaraicne를 제공한다.

2. Related Work

3. Method

# f: backbone + projection mlp
# h: prediction mlp
for x in loader: # load a minibatch x with n samples
   x1, x2 = aug(x), aug(x) # random augmentation
   z1, z2 = f(x1), f(x2) # projections, n-by-d
   p1, p2 = h(z1), h(z2) # predictions, n-by-d
   L = D(p1, z2)/2 + D(p2, z1)/2 # loss
   L.backward() # back-propagate
   update(f, h) # SGD update
def D(p, z): # negative cosine similarity
   z = z.detach() # stop gradient
   p = normalize(p, dim=1) # l2-normalize
   z = normalize(z, dim=1) # l2-normalize
   return -(p*z).sum(dim=1).mean()

backbone + projection + prediction

Prediction MLP head의 역할은 한 view의 output을 다른 view에게 맞도록 transform해주는 것.

negative cosine similarity를 minimize하는 것은 l2-normalized vector의 MSE를 minimize 하는 것과 같다 (up to a scale of 2?)

4. Empirical Study

4.1 Stop-gradient

없으면 무조건 collapse함. variance가 0이되고 있으면 unit sphere에 랜덤하게 분포.

4.2 Predictor

h를 없애면 작동안함. 즉, h는 identity mapping 임(?????). 사실 이런 관측은 symmetric loss가 사용될때 예상된거임 (?)

h를 제거한 loss를 사용하면 collapsing 이 관측됨.

asymmetric loss를 사용해도 h를 없애면 fail한다고 함. 왜지????

h만 lr decay를 안쓰는게 더 효과적. h는 항상 latest representation에 adapt해야 하므로 lr 을 줄여서 수렴하도록 강요하는게 필요치 않다.

4.3 Batch Size

대부분의 bsz에서 잘 작동. 64, 128 이어도 비교적 잘 작동하고 이보다 크면 비슷.

근데 신기하게도 SGD optimizer는 supervised 에서도 그렇고 batch가 너무 크면 잘 작동 안함. 성능이 4096일때 급격히 떨어짐.

4.4 Batch Normalization

bn 아예 안쓰면 acc이 절반으로. projection에 까지 쓰면 최대. prediction에도 쓰면 unstable. 그냥 다른 supervised때와 똑같음.

BN이 collapsing을 막아준다는 증거는 전혀 없음.

4.5 Similarity Function

cosine similarity 대신에 $D(p_1, z_2) = -softmax(z_2) \log softmax(p_1)$ 으로 두면 acc 5%정도 떨어짐.

collapsing은 cosine similarity 자체의 문제가 아님.

4.6 Symmetrization

asymmetric 버전 쓰면 4%정도 떨어짐. 하지만 collapsing 이슈랑은 관계없음.

symmetrization은 각 이미지에 대해 하나 많은 prediction을 하므로 이걸 각 이미지마다 sampling을 2pair 만큼 해서 보충하면 acc gap이 줄어든다.

4.7 Summary

stop gradient가 collapsing을 멈추는 가장 중요한 요소이다.

5 Hypothesis

SimSiam에 의해 최적화되는게 무엇인가에 대한 가설을 세우고 PoC 실험을 한다.

5.1 Formulation

가설은 simsiam이 EM 같은 알고리즘의 implementation이라는 것이다. EM은 2개의 변수 집합을 가지고 2개의 기저하는 subproblem을 푼다.

stop-gradient의 존재는 extra set of variable을 introduce하는 것의 결과다.

Barlow Twins: Self-Supervised Learning via Redundancy Reduction

Conference : ICML 2021
Link : https://arxiv.org/pdf/2103.03230.pdf
Authors' Affiliation : FAIR, Yann LeCun
TL;DR : Barlow twin이라는 방법을 고안했는데 이 방법이 SimSiam, SimCLR, BYOL 등의 방법보다 좋다.

Summary :
image
image
cross-correlation matrix를 identity matrix와 최대한 비슷하게 만드는 방법.
이 loss 함수는 그 자체로 collapse를 하지 않기 때문에 stop gradient, momentum 등의 방법이 필요없다.
SimCLR처럼 large batch도 필요 없고 신기하게도 dimension을 키울수록 성능이 좋아진다.

SimCSE: Simple Contrastive Learning of Sentence Embeddings

Conference :
Link : https://arxiv.org/pdf/2104.08821.pdf
Authors' Affiliation : princeton, tsinghua
TL;DR : sentence embedding. 즉, cross encoder가 아니라 bi/dual encoder에서 새로운 sota를 기록한 논문.

Summary :

2 Background

Alignment and uniformity

Given a distribution of positive pairs p_pos, alignment calculates expected distance between embeddings of the paired instances

uniformity measures how well the embeddings are uniformly distributed

3 Unsupervised SimCSE

그냥 forward 한번하고 다시 한번하면 dropout이 달라지니까 그것 만으로 충분하다는 것. 다른 어떤 data augmentation도 하지 않고.

" a minimal form of data augmentation"

4 Supervised SimCSE

NLI에서 entailment를 positive로 가져오고 Contradiction을 negative로 가져와서 학습.

5 Connection to Anisotropy

anisotropy problem

the learned embeddings occupy a narrow cone in the vector space, which largely limits their expressiveness

s. Gao et al. (2019) term it as a representation degeneration problem and demonstrate that language models trained with tied input/output embeddings lead to anisotropic word embeddings

Wang et al. (2020) show that the singular values of the word embedding matrix decay drastically. In other words, except for a few dominating singular values, all others are close to zero.

we show that the contrastive objective can inherently “flatten” the singular value distribution of the sentence-embedding matrix.

when minimizing the second term in Eq. 6, we are reducing the top eigenvalue of WW> and inherently “flattening” the singular spectrum of the embedding space. Hence contrastive learning can potentially tackle the representation degeneration problem and improve the uniformity.

-> 오히려 반대 아닌가? 논리적 비약이 심한것 같은데.

6 Experiments

왜 transfer task에는 MLM을 추가 했는데 STS에선 추가 안했지? 아무튼 SimCSE + MLM이 제일 성능이 좋음.

7 Analysis

SimCSE가 uniformity나 alignment 측면에서 좋다.

Bootstrap Your Own Latent

Conference : NIPS 2020
Link : https://arxiv.org/abs/2006.07733
Authors' Affiliation : DeepMind
TL;DR : Better than SimCLR w/o negative pairs.

Summary :

1. Introduction

기존 방법들은 negative pair들을 매우 잘 다뤄야만 한다.

  • by either relying on large batch sizes [8, 12]
  • memory banks
  • customized mining strategies

또한 성능이 image augmentations 성능에 크게 좌우된다.

제안하는 BYOL은 negative pair 없이한다.

BYOL contrastive methods보다 choice of image augmentations에 robust하다. (+ bsz의 변화에도 resilient)

negative 페어에 의존하지 않는 것이 향상된 robustness의 가장 큰 이유일 것으로 추측한다.

이전에 bootstrapping 기반 방법은 pseudo-labels [16], cluster indices [17] or a handful of labels [18, 19, 20] 등의 방법을 사용했지만 여기서는 직접적으로 representations을 bootstrap 하는 것을 제안한다

(bootstrap이 뭘까... 통계에서의 bootstrap은 아니라고 한다)

BYOL에서는 2개의 네트워크 : target & online 을 사용해서 서로에게 배우며 상호작용한다.

image와 augmented view가 있으면 하나는 target 에 넣어서 이 representation을 다른 view를 인풋으로 받은 online이 예측하도록 학습한다.

이 objective가 모든 image를 하나로 output하는 collapsed solution을 허용하지만 경험적으로 그러지는 않음을 보인다.

이 이유는 1) addition of a predictor to the online network 2) use of a slow-moving average of the online parameters 라고 추측한다.

2. Related Works

representation learning을 위한 unsupervised method는 generative method와 discriminative method로 나뉨

generative 방법은 데이터와 latent embedding 에 대한 분포를 만들고 학습된 임베딩을 이미지의 representation으로 쓴다. auto-encoding, GAN, data와 representation 같이 모델링 같은 방법들을 사용한다. generative 방법들은 보통 pixel space에서 직접적으로 작동하는데, computationally expensive하고 image generation에 필요한 높은 레벨의 detail은 representation learning에 사실 필요하지 않을지도 모른다.

discriminative 방법에서는 self-supervised 방법 중 contrastive method가 sota를 찍고 있다. 근데 많은 경우 다른 sample들과 비교해야 하는데 과연 negative pair를 이용하는게 필요한가라는 의문을 제기한다.

DeepCluster 에선 부분적으로 의문에 대한 답을 한다. 여기서는 다음 representation에 대한 target을 만들기 위해 representation의 이전버전에 bootstrapping을 사용한다: 이전 representation을 사용해서 clustering 한 다음에 cluster index를 classification target으로 사용한다. negative pair를 안쓰긴 하지만 갑비싼 clustering phase가 필요하다는 단점이 있고, trivial solution으로 collapse하는걸 막기위해 특별한 주의가 필요하다.

어떤 self-supervised 방법들은 contrastive 하진 않지만 부가적인 태스크를 해서 학습한다. 퍼즐, colorizing 등등. 근데 이 방법들은 contrastive 방법에 비해 성능이 떨어짐.

RL에서 사용되는 PBL(Predictions of Bootstrapped Latents)와 우리 방법은 비슷한 면이 있다. agent의 history representation과 future observation의 encoding을 jointly 학습한다.

3. Method

하나의 이미지의 다른 view를 representation space에서 직접 예측하는 것은 collapsed representation을 야기할 수 있다.

contrastive 방법은 이것을 prediction 문제에서 discrimination 문제로 reformulate함으로써 우회한다. 이렇게 하면 collapse 문제는 해결할 수 있지만 discrimination task를 충분히 어렵게 해주기 위해 보통 많은 negative example과 비교를 해줘야 한다.

이 연구는 그래서 과연 이 negative example이 필수 불가결한 것인지를 묻는 연구이다.

collapse를 방지 하기 위해 단순한 방법은 고정된 random init 네트워크를 사용해서 target을 생산하는 것이다. 이 방법은 collapse를 안하긴하지만 별로 좋은 representation을 생산하지 않는다. 그래도 이 방법으로 학습된 representation이 처음의 고정된 representation보다는 좋다는 것은 흥미롭다. 학습 전에는 1.4% -> 학습 후에는 18.8% 정확도가 나온다. 이것이 BYOL의 핵심 모티베이션이다.

given representation, target이 주어졌을때 개선된 representation, online을 target을 예측함으로써 새로 학습한다.

근데 이 과정을 반복하면 더 좋은 representation을 생산할 수 있지 않을까? subsequent online network를 새로운 target network로 사용하는 것이다. 실제로 적용할때는 BYOL에서는 이것을 slowly moving exponential average of the online network를 target network로 사용함으로써 적용한다.

3.1 Description of BYOL

BYOL의 goal = downstream task에 사용할 수 있는 representation $y_\theta$ 를 학습한다.

online에다가만 prediction 을 apply (linear 한번더)함으로써 asymmetric 아키텍처를 만든다.

그리고 online과 target의 Mean Squared Error 를 적용.

3.2 Intuitions on BYOL's behavior

loss가 $\theta$ 와 e? 를 jointly minimize하는것처럼 보일수도 있다. 하지만 실제로는 아니다. GAN에서처럼 jointly minimized 되는 것은 없다. 따라서 전체의 minimum으로 수렴할 선험적인 이유는 없다.

BYOL의 dynamics가 바람직하지 않은 평형점을 허용하기는 하지만 실제 실험에서 그런 경우는 관측하지 못했다. 또한 그런 바람직하지 않은 평형점은 unstable하다고 가설을 세운다.

3.3 Implementation details

Recent Advances in LM Fine-tuning

Conference : blog
Link : https://ruder.io/recent-advances-lm-fine-tuning/
Authors' Affiliation : ruder, DeepMind?
TL;DR :

Summary :

Recent Advances in LM Fine-tuning

ruder 블로그 글 읽기 (https://ruder.io/recent-advances-lm-fine-tuning/)

  • Adaptive finetuning
    • = PLM을 가져와서 domain-specific data에 fine-tuning (unlabelled)
    • 심지어는 task data에 대해서 multi-task learning으로도 가능
    • adapting to data of the target domain and target task are complementary
    • adapting to the task’s unlabeled data (task-adaptive pretraining) improves performance even after domain-adaptive pretraining
    • Single-domain의 여러 task에 대해 적용해야 할때 유용하다고 함
    • general PLM -> domain-adaptive pretraining -> task-adaptive pretraining -> task train
  • Behavioural finetuning
    • = intermediate task에 대해서 finetuning 하는 것 (labelled data)
    • MLM may provide useful information for learning P(Y|X)P(Y|X) but likely does not contain every signal important for the task. models pre-trained with MLM struggle with modelling negations, numbers, or named entities
  • Parameter-efficient fine-tuning
    • = 모든 task에 대해 finetune한 모델을 다 들고 있으면 너무 비싸니까 대부분의 모델 parameter를 fix하고 task마다 조금의 param만 finetune하자.
    • adapter = PLM의 레이어 사이사이에 들어가는 작은 bottleneck layer. (PLM은 고정하고)
    • 직접 PLM의 parameter를 바꾸는 대신 $\theta_{finetune} = \theta_{pretrained} + \theta_{task}$ 로 나타내고 theta_task를 좀더 효율적으로 (ex.sparse vector로) 나타내자.
    • PLM의 parameter의 subset만 바꾸자: vision에서 하던것처럼 마지막 layer만 finetune하는건 nlp에선 효과가 좀 떨어진다.
      • 모델의 bias param만 finetune하는게 잘 작동한다는 보고도 잇음.
    • finetuning 하는 동안 PLM의 param을 pruning. PLM의 마지막 few layer는 특히 제한적인 기능밖에 없고 아예 제거하거나 re-init해도 된다고 함.
  • Text-to-text fine-tuning
    • gpt-3 같은 learning without update. prompt engineering
    • robust to fine-tuning on small datasets, they suffer from instabilities in the few-shot setting and are sensitive to the prompt and few-shot examples
  • Mitigating finetuning instabilities
    • 특히 작은 데이터셋에서 finetuning할때는 돌릴때마다 다르게 나오는 현상이 잇음
      • output layer의 weight init과 training data 순서에 따라 영향을 받는다 함.
    • 초반에 잘 안나오면 그냥 stop
    • bert finetuning 할때는 small learning rate & epoch 수 증가하기를 추천
    • 요즘은 adversarial 이나 trust-region based 방법이 제안
    • 이전 섹션에서 살펴본것처럼 adaptive/behavioral finetuning 해보는것도 추천.

Autoregressive Entity Retrieval

Conference :
Link : ICLR 2021
Authors' Affiliation : FAIR
TL;DR : vector - vector dot product 대신 그냥 직접 unique entity name을 autoregressive하게 generate하자.

Summary :

1. Introduction

기존 entity retrieval 방식은 각 entity들이 하나의 label이 되어 multi-class classification으로 푸는 방식이었다. input과 label 간의 match는 bi encoder에서 나온 벡터 곱에서 나온 similarity로 계산하고 max-inner-product-search로 검색한다.

근데 이 방식은 여러 단점을 갖는다

  1. re-ranking 할때 cross-encoder를 쓰지 않는 이상 fine-grained interaction을 놓친다.
  2. dense vector를 저장해야 하므로 메모리 사용량이 크다.
  3. 정확한 softmax를 모든 entity에 대해 계산하는건 불가능하므로 negative data를 sampling해야 한다.
  4. cold-start 문제

여기서 제안하는 방식은 때때로 우리에게는 unambiguous, highly structured and compositional entity names이 있다는 사실로부터 모티베이션을 얻었다.

(위키피디아의 문서 제목과 같은)

inputs could be translated into unique entity names, word by word, instead of being classified among a huge set of options

GENRE = Generative ENtity REtrieval

context에 condition해서 entity name을 autoregressive하게 generate하는 방식이다. 근데 생성된 이름이 항상 valid한 이름은 아닐 수도 있다. 이를 방지하기 위해 constrained decoding 방식을 사용해서 생성되는 이름이 미리 정의된 후보 set에 있도록 강제한다.

이 방식으로 하면 entity count가 아니라 vocab size에 scale되므로 메모리 요구량이 크지 않다. negative 샘플링도 필요 없다.

candidate set은 trie로 저장하게 되면 메모리를 많이 아낄 수 있다.

4. Experiments

Entity Disambiguation, end-to-end Entity Linking (EL), page-level Document Retrieval 에서 SOTA 혹은 competitive 결과를 얻었다.
거기다 memory는 dramatic하게 줄어든다.
image

ReAct: Out-of-distribution Detection With Rectified Activations

Conference : Neurips 2021
Link : https://arxiv.org/pdf/2111.12797.pdf
Authors' Affiliation : University of Wisconsin-Madison, FAIR
TL;DR :

Summary :
image

observation : OOD data can trigger unit activation patterns that are significantly different from ID data

Propose : Rectified Activations for improving OOD detection performance

Method :

  1. get penultimate layer activation (feature h(x))
  2. rectify activations : ReAct(x; c) = min(x, c) where c is threshold
  3. pass through last layer -> f(x')

나머지는 일반적인 OOD 도메인에서 하는 process와 일치한다.
나온 결과를 OOD 기존 방법들인 softmax score, ODIN score, Energy based score, Mahalanobis distance 등을 거쳐서 score를 뽑는다.
일반적으로 score 는 높을수록 ID일 확률이 높다는 것이고 낮을 수록 OOD일 확률이 높다는 의미이다.
마지막으로 threshold lambda를 정해서 그것보다 score가 높으면 ID로, 낮으면 OOD로 분류하면 된다.

Everything Is All It Takes: A Multipronged Strategy for Zero-Shot Cross-Lingual Information Extraction

Conference : EMNLP 2021
Link : https://arxiv.org/pdf/2109.06798.pdf
Authors' Affiliation : Johns Hopkins University
TL;DR : Data projection + self-training을 시험해봤다. 어느 한 가지 방법이 모든 것에서 잘하기 않기 때문에 zero-shot training에서 잘하려면 다 해봐야 한다.

Summary :
참고) POS tagging vs Dependency parsing vs Constituency parsing

method

  • augmenting the source language training data with data in the target language—either via projection of the source data to the target language (so-called “silver” data)

  • via self-training with translated text

  • Data projection = src 언어에 있는 word-level annotations을 tgt 언어로 word-to-word alignments를 통해 transfer하는 것.

    • 먼저 src -> tgt 으로 MT를 사용해서 번역
    • word alignment tool을 사용해서 alignment를 얻음 (fast-align, Awesome-align)
    • alignment를 사용해서 annotation을 project

레이블이 word-level인 것들은 sub-words에서 첫 번째를 제외하고 마스크 시킴.

6 Cross-lingual Transfer Results

One might optimistically consider that the latest multilingual encoder (in this case XLM-R) in the zero-shot setting would achieve the best possible performance. However, in our extensive experiments in Table 4 and Table 5, we find that the zero shot approach can usually be improved with data projection.

8 Conclusions

  • adding projected silver training data overall yields improvements over zero-shot learning
  • the best setup is usually task dependent.
  • In multilingual experiments, we find that silver data tends to help languages with the weakest zero�shot performance, and that it is best used separately for each desired language pair instead of in joint multilingual training.
  • self-training helps.

Representing Numbers in NLP: a survey and a vision

Conference : NAACL 2021
Link : https://arxiv.org/abs/2103.13136
Authors' Affiliation : University of Southern California
TL;DR :
아직 합의된 holistic한 방법은 없다. string-based에서 그나마 좋다고 밝혀진 것은

  • scientific notation > decimal notation
  • character level > subword level

Summary :

1. Introduction

"11시에 일어났다"와 "11불을 벌었다"에서 11은 큰 차이가 있다. 11을 10으로 바꾸는건 되지만 25로 바꾸는건 안되는 일이다.

quantity와 갯수에 대해서 이해하는 것은 세계를 이해함에 있어서 중요하다.

우리 조상은 numeracy를 언어의 발전과 독립적으로 발전시켜왔다.

하지만 NLP에서는 전처리때 아예 지워버리거나 word와 같은 취급을 하거나, UNK로 붕괴시켜 버린다.

wordpiece같은 데서는 없애진 않지만 임의의 토큰들로 분리시킨다.

최근 논문들에서는 이들이 suboptimal number representation 이란 것을 밝혔다.

BERT는 정답이 숫자이면 span of text일때보다 5배 못한다.

단순히 subword에서 char-level tokenization으로 바꾸는 것이나 decimal 을 scientific notation으로 바꾸는 것만으로 성능이 향상된다.

이 논문에서는 numeracy task에 대한 taxonomy와 (section2) number representation (section3)를 제공한다.

2. Tasks

granularity와 unit라는 2가지 차원에 기반해서 분류한다.

  1. granularity = number의 encoding이 정확한가 아니면 approximate한가 (새는 2개의 다리를 갖는다 vs 존은 대략 180cm이다.)
  2. UInits = number가 abstract (2+3 = 5)한가 아니면 grounded인가 (2 apples + 3 apples = 5 apples). 대충 단위가 있는지인듯.
  • Simple Arithmetic = 1+1=2 같은거. synthetic dataset을 만들기 편함.
  • Numeration (or Decoding) = string form을 numeric value로 만드는것. 19 -> $19.0$ . NLP에서는 string의 representation에 대해 linear regressor를 돌리는 것으로 한다.
  • Magnitude Comparison = 2개나 그 이상의 숫자 중에 어떤게 큰지. 23 과 32가 주어지면 label 1을 골라야함.
  • Arithmetic Word Problems (AWP) = 2개의 쿠키가 있어서 하나를 줬다. 몇개가 남았는가?
  • Exact Facts = commonsense knowledge. 주사위는 6개의 면이 있다.
  • Measurement Estimation = 심리학쪽에서 사용하는 태스크로 대충 수박에 씨가 몇개 있겠는가 하는 질문 같은거.
  • Numerical Language Modeling = task가 아니라 setup이긴 하지만, 2+3=[mask] 같은 느낌. 사자의 몸무게는 [mask]kg이다. 일반적인 word LM에서와 다르게 accuracy나 perplexity가 아니라 regression loss를 사용해서 평가함.

3. Methods

string-based vs real-based

real-based에서는 computation을 해서 한다.

string-based에서는 number를 surface form으로 본다. 임의의 token id를 assign해서 임베딩을 look up해야한다.

3.1 Taxonomy

3.1.1 String based

LM에서는 디폴트로 number를 string으로 다룬다 (word와 똑같이).

  • Notation: 근데 숫자 80은 아라비아 숫자로 쓸수도 있고, 로마어로 쓸수도 있고 scientific notation으로 쓸수도 있고, english word eighty나 20진수 french나 다양하게 쓸수있다.
  • Tokenization : word-level tokenization은 효과적이지 못하다. 대부분이 UNK가 되므로. 다른 방법으로는 subword tokenization이나 character level이다.
  • Pooling : 하나의 숫자가 여러개의 토큰이 되면 pooling을 할 수 있다. 다른 데서는 풀링 대신 RNN이나 CNN을 사용하는 것을 주장했다.

3.1.2 Real based

number encoder를 $f: R \rightarrow R^d$ 로 나타낼 수 있다. 디코더 g는 반대.

  • Direction : encoder-only, decoder-only 방법들도 존재.
  • Scale : linear하지 않고 인지과학에서 영감을 받아 log scale로 인코드 하는 방법도 있다. 기타 방법들로 stabilized log scale, learned scale/flow 도 있음.
  • Discretization : 연속이나 이산이냐. 큰 범위의 숫자에 대해서 연속 함수를 학습하는건 practically infeasible하다. 그래서 먼저 binning을 한다. bin은 linear scale일수도 있고 log scale일수도 있다. 그 다음에는 lookup embedding을 일반의 cross entropy나 dense cross entropy로 학습한다.

3.2 survey of existing methods

3.2.1 string-based

  • GenBERT
  • NumBERT
  • DigitRNN, DigitCNN
  • DigitRNN-sci & Exponent (Embedding)

3.2.2 Real-based

  • DICE = scalar i와 j의 임베딩의 cosine similarity가 둘의 euclidean distance가 커질수록 작아지도록
  • Value Embedding = ??
  • Log Value
  • Log Laplace
  • Flow Laplace
  • Multi-Class Classification
  • Discrete Latent Exponent (DExp)
  • GMM
  • GMM-prototype
  • SOM-prototype

4 Results

  • Abstrct Probes
    • word embedding > random embedding baseline
    • DICE, Value, Log Value embeddings가 잘함.
    • DigitCNN이 제일 잘하고 character-tokenized model이 subword 모델보다 잘함.
  • Arithmetic
    • gpt-3가 zeroshot으로 잘함. (digit이 낮을경우)
    • 제한된 extrapolation은 tokenization scheme이 문제일지도? digit/character level로 토크나이즈 하면 더 잘해짐.
  • MLM
    • number가 scientific notation으로 나타나진 데이터셋에서 pretrain 되면 BERT가 mlm으로 학습할떄와 같은 loss 값으로 수렴한다?
    • causal LM에서는 GMM이 best
    • mlm에서는 mantissa까지 모델링하는건 overkill일지도?
  • Measurement Estimation
    *

5 Recommendations

  • Rule of thumb for string-based methods
    • scientific notation > decimal notation
    • 이래야 exponent 부분에 mantissa 보다 집중할수 있음.
    • character level > subword level
  • Rule of thumb for real-based methods
    • log scale > linear scale
    • binning > continuous value prediction (== dense xent > MAE loss) where gt distributions are available
    • large range에서 continuous prediction을 모델링하는건 너무나도 어려움. 하지만 그런 distribution을 binning 하는 방법도 있음( precision level을 정해서)
  • Encoding vs Decoding numbers?
  • Can we mix-and-match multiple methods?
    • 아직은 그닥
  • which methods for which tasks?
    • method마다 다른듯

6 Vision for Unified Numeracy in NLP

Towards End-to-End In-Image Neural Machine Translation

Conference : EMNLP 2020
Link : https://arxiv.org/abs/2010.10648
Authors' Affiliation :
TL;DR : end-to-end pixel 레벨에서 in-image NMT를 해보자. 물론 구글 프로덕트에 있지만 어떻게 하는지는 모르니까.

Summary :

pixel로 직접 하면 vocab 문제를 우회할 수 있음.

headless-chrome 이란 걸로 synthetic dataset을 생성.

3 Model

3.1 Convolutional Baseline

grayscale에서 0.5를 기준으로 흑과 백으로만 해서 pixel wise binary cross entropy loss로 학습.

3.2 Full Model

image

4 Results

image
은근 잘 된다고 함.
image
실패하는 경우를 자세히 보면 however와 nevertheless 사이에서 모델이 불확실해하는 것을 알 수 있음.

Understanding self-supervised Learning Dynamics without Contrastive Pairs

Conference :
Link : http://arxiv.org/abs/2102.06810
Authors' Affiliation : Facebook AI Research
TL;DR : SimSiam 논문의 원인을 탐구하는 논문. "How can SSL with only positive pairs avoid representational collapse?"

Summary :

1. Introduction

Minimizing differences between positive pairs encourages modeling invariances, while contrasting negative pairs is thought to be required to prevent representational collapse

그러나 요즘 나온 BYOL, SimSiam 과 같은 논문들에서는 negative없이 성공했다.

근데 이 논문들이 왜 representation collapse를 겪지 않는건지는 아직 밝혀지지 않았다.

analyze the behavior of non-contrastive SSL training and the empirical effects of multiple hyperparameters, including (1) Exponential Moving Average (EMA) or momentum encoder, (2) Higher relative learning rate (αp) of the predictor, and (3) Weight decay η

We explain all these empirical finding with an exceedingly simple theory based on analyzing the nonlinear learning dynamics of simple linear networks.

  • Essential part of non-contrastive SSL
  • EMA
  • Predictor Optimality and Relative learning rate
  • Weight Decay
  • DirectPred

2. Two-layer linear model

Theorem 1 (Weight decay promotes balancing of the predictor and online networks

Theorem 2 (The stop-gradient signal is essential for success.)

3. How multiple factors affect learning dynamics

4. Optimization-free Predictor $W_p$

노잼이라 그만...

Word Alignment by Fine-tuning Embeddings on Parallel Corpora

Conference : EACL 2021
Link : https://arxiv.org/pdf/2101.08231.pdf
Github: https://github.com/neulab/awesome-align
Authors' Affiliation : CMU
TL;DR : propose 1) PLM + finetune on parallel text (objective to improve alignment quality), and 2) methods to effectively extract alignments from these fine-tuned models.

Summary :
Importantly, we show that it is possible to train multilingual word aligners that can obtain robust performance even in zero-shot settings, making them a valuable tool that can be used out-of�the-box with good performance over a wide variety of language pairs.

2 Methods

  • Task: given X = (x1, ..., xn), Y = (y1, ..., ym), find A = {(xi, yj)}

2.1 Extracting Alignments from Embeddings

  1. X와 Y를 mBERT에 넣어서 contextualized embedding을 뽑음. h_x, h_y. (i-th layer를 뽑는데, i는 hyper-parameter)
    1. probability simplexes and 2) optimal transport에 기반한 unidirectional alignment scores를 계산
  2. 이 alignment scores를 alignment matrices로 변환. reconcile alignments in the forward and backward directions

Probability Simplex

similarity matrix S = hx dot hy^T -> Normalise (softmax, \alpha-entmax) -> := source-to-target alignment matrix

Optimal Transport

  • goal of optimal transport = to find a mapping that moves probability from one distribution to another, which can be used to find an optimal matching of similar words between two sequences.

$$ \sum_{i,j} C(x_i, y_j) S_{xyij} $$ where $S_{xy}1_m = p_x$ and $S_{xy}1_n = p_y$.

Extracting Bidirectional Alignments

$A = (S_{xy} > c) ∗ (S^T_{yx} > c)$

Handling Subwords

To convert them to word alignments, we follow previous work (Sabet et al., 2020; Zenkel et al., 2020) and consider two words to be aligned if any of their subwords are aligned.

2.2 Fine-tuning Contextualized Embeddings for Word Alignment

  • MLM
  • TLM (Translation LM)
  • Self-training Objective (SO) = $\sum_{i, j} A_{ij} \frac{1}{2} (\frac{S_{xyij}}{n} + \frac{S_{yxij}^T}{m} $
    • encourages words aligned in the first pass of alignment to have further closer contextualized representations.
    • align src->tgt & tgt -> src to be symmetric
    • 좀 이상. A를 계산하는 데에 이미 S가 들어가는데 이걸 몇 번이나 반복해서 사용하면 별로 좋지 않을 듯.
    • Sxy랑 Syx랑 transpose만 시킨 같은 게 아닌 것인가??
  • Parallel Sentence Identification (PSI) = [CLS] ->
    • output a prediction score. encourages the overall alignments of embeddings on both word and sentence level to be closer together.
  • Consistency Optimization (CO) = $ \frac { tr (S_{xy}^T S_{yx} ) } {\min(m, n)} $
    • explicitly encourage the consistency between the two alignment matrices.
    • S를 여기서 한 번 더 사용..

Final objective L = LMLM + LTLM + LSO + LP SI + βLCO

loss가 너무 많아서 제대로 밸런싱이 안 되어 있을 듯.

3 Experiments

기존 method에 비해 성능이 뚜렷하게 좋다고 보기는 어려움. 내부에서도 좋은 거랑 안 좋은 거랑 차이가 큼.

Dense Passage Retrieval for Open-Domain Question Answering

Conference : EMNLP 2020
Link : https://arxiv.org/pdf/2004.04906.pdf
Authors' Affiliation : Facebook & UW
TL;DR : 제대로 학습하기만 하면 (pretrain 없이) 단순히 passage question pair로 파인튜닝만 해도 bm25를 이길수 있음

Summary :

open domain QA에서는 2스테이지로 진행됨. 1) context retriever가 몇개의 passage를 가져오고 2) machine reader가 거기서 정답을 고름.

여기서 context retriever 로 쓰이는게 보통 tf-idf나 bm25. 이것들은 일종의 sparse vector라고 볼수 있음. 이것과 반대되는게 dense vector.

완전히 다른 키워드로 쓰여있어도 의미를 인지하고 가깝게 매핑할 수 있다는 장점.

A term-based system would have difficulty retrieving such a context, while a dense retrieval system would be able to better match “bad guy” with “villain” and fetch the correct context. Dense encodings are also learnable by adjusting the embedding functions, which provides additional flexibility to have a task-specific representation. With special in-memory data structures and indexing schemes, retrieval can be done efficiently using maximum inner product search (MIPS) algorithms

그러나 이런 dense embedding을 학습하는건 일반적으로 많은 labeled 데이터들이 필요하다고 믿어지고있음. 그래서 ORQA에서 나온 Inverse cloze task 이전에는 bm25를 이긴적이 없음. 여기서는 bm25를 이겼지만 단점 2가지가 있음:

  1. computationally intensive & 일반적인 문장이 목적함수에서 좋은 surrogate 이라는 보장이 없음.
  2. context encoder는 finetune되지 않기 때문에 suboptimal함.

추가적인 pretraining없이 question / passage(or answers) pair만 가지고 dense embedding 모델을 잘 학습할 수 있을까? 이 논문에선 비교적 적은 q/p pair만 가지고 올바르게 학습하는 scheme에 집중한다.

Solution = the embedding is optimized for maximizing inner products of the question and relevant passage vectors, with an objective comparing all pairs of questions and passages in a batch.

컨트리뷰션: 1) 제대로 학습하기만 하면 단순히 passage question pair로 파인튜닝만 해도 bm25를 이길수 있음을 보임. 2) open domain qa에서 높은 retrieval precision은 높은 qa accuracy로 직결됨을 보임.

2 Background

3 Dense Passage Retriever (DPR)

이 논문의 초점은 open domain QA에서 retrieval을 개선하는 것임.

DPR = 그냥 SimCLR

BM25+DPR, using a linear combination of their scores as the new ranking function. Specifically, we obtain two initial sets of top-2000 passages based on BM25 and DPR, respectively, and rerank the union of them using BM25(q,p) + λ · sim(q, p) as the ranking function. We used λ = 1.1 based on the retrieval accuracy in the development set.

there is a high lexical overlap between passages and questions, which gives BM25 a clear advantage.

5 Experiments

5.2 Ablation Study on Model Training

Inbatch negative training (=simclr)가 1-of-N training 보다 성능이 조금이지만 좋음. 왜지?? 전혀 차이가 있을 이유가 없어보이는데. 정확히 1 of n이란게 뭘까?

batch size가 커질수록 성능이 좋아지는건 당연한 것으로 보이고.

마지막으로 제안되는게 흥미로운데, 일반적인 SimCLR에서 batch의 나머지 요소들을 negative로 간주하는것에 추가해서 hard negative를 추가하는 방식이다. 이 hard negative는 bm25로 뽑은 건데 이걸 넣어주고 안 넣어주고가 성능에 매우 큰 영향을 끼친다. 여기서도 배치사이즈가 커지면 성능은 좋아지고.

이 bm25로 추가된 negative들은 batch에 있는 다른 모든 문제에 대해서도 negative가 되는 것이다. bm25 negative를 하나만 추가한 것과 2개를 추가한 것에는 큰 차이를 보이지 않는다.

이걸 우리 데이터셋에 적용하려면 약간의 전처리가 필요할듯 하다 (ocr search request 별로 묶어줘야 함.)

dot product >= L2 >> cosine. triplet loss쓰나 NLL loss 쓰나 별 차이 없음.

cross-dataset generalization

다른 데이터셋에서도 generalize를 잘 하는가? 잘한다. bm25 보다 훨씬 높다.

5.3 Qualitative Analysis

bm25는 lexical overlap이 있냐 없냐에 따라 크게 갈림. 또한 부분적으로 lexical overlap이 있으면서 다른 의미인 문장들을 걸러내지 못함. 반면 DPR은 lexical overlap이 없어도 잘하는 반면, lexical overlap이 중요한 경우 capture하지 못하는 경우가 있다. 즉, 각각이 장단점을 가진다. 둘다 적당히 결합해서 쓰면 좋을 것 같다.

5.4 Run-time Efficiency

With the help of FAISS in-memory index for real-valued vectors , DPR can be made incredibly efficient, processing 995.0 questions per second, returning top 100 passages per question.

In contrast, BM25/Lucene (implemented in Java, using file index) processes 23.7 questions per second per CPU thread.

반면 dense vector의 인덱스를 생성하는게 훨씬 오래걸린다. 21M 벡터에 대해서 FAISS에서 인덱스를 생성하는건 8.5시간이 걸리는 반면, 루씬에선 30분이면 된다.

A Replication Study of Dense Passage Retriever

후속 논문

https://arxiv.org/pdf/2104.05740.pdf

원래 논문에서 bm25 가 잘못 평가되어있었음. bm25의 성능은 그것보다 훨씬 높음. 그래도 DPR이 bm25보다 성능이 높은건 사실.

bm25 + DPR hybrid 방식이 저평가되어있었음. bm25에 weight를 주는 방식으로 바꾸고 normalization까지 하면 성능이 확 오름. hybrid는 항상 DPR 단독이나 bm25 단독 보다 좋음.

retriever에서 나온 evidence를 scoring phase에 사용하면 end to end에서 성능이 더 오름.

by incorporating evidence from the retriever and an improved answer span scoring technique, we are able to improve end-to-end question answering effectiveness using exactly the same models as in the original work.

Pre-Training Tasks for Embedding-Based Large-Scale Retrieval

Conference : 2020 ICLR
Link : https://arxiv.org/pdf/2002.03932.pdf
Authors' Affiliation : cmu, google
TL;DR : 적절히 디자인된 paragraph-level 사전학습 태스크로 학습하면, transformer 모델은 bm25보다 훨씬 잘 할 수 있다.

Summary :

With adequately designed paragraph-level pre-training tasks, the Transformer models can remarkably improve over the widely-used BM-25 as well as embedding models without Transformers.

  • Inverse Cloze Task (ICT)
  • Body First Selection (BFS)
  • Wiki Link Prediction (WLP)

1 Introduction

retrieval phase + scoring phase

retrieval은 중요하다. 높은 recall을 가져야 한다. 그러면서 매우 efficient 하지 않으면 쓰지도 못한다.

token-based matching 알고리즘 방식과 embedding based 방식이 있음.

embedding based 방식을 two-tower retrieval model, Siamese network, dual-encoder model 로도 부름.

The token-level masked-LM (MLM) pretraining task is crucial to the success of BERT-style cross-attention models. Nevertheless, what pre-training tasks are useful for improving two-tower Transformer models in large-scale retrieval, remains a crucial yet unsolved research problem. In this paper, we aim to answer this question by studying different pre-training tasks for the two-tower Transformer models.

Contribution:

  • Paragraph-level pre-training tasks such as Inverse Cloze Task (ICT), Body First Selection (BFS), and Wiki Link Prediction (WLP) hugely improve the retrieval quality, whereas the most widely used pre-training task (the token-level masked-LM) gives only marginal gains.
  • 적절한 pretraining하면 bi encoder가 bm25를 크게 이김.
  • BoW MLP보다 transformer가 paragraph-level pre-training으로부터 더 큰 이득을 얻음.

3 Pretraining Tasks of Different Semantic Granularities

pre-training data is defined as positive query-document (q, d) pair

A good pre-training task : 1) it should be relevant to the downstream task 2) It should be cost-efficient to collect the pre-training data, ideally not requiring additional human supervision.

제안:

  1. Inverse Cloze Task (ICT),
  2. Body First Selection (BFS)
  3. Wiki Link Prediction (WLP).

BFS and WLP를 새로 제안한것. The training data for all these tasks can be freely obtained based from Wikipedia without an additional manual labeling process.

Inverse Cloze Task (ICT) Given a passage p consisting of n sentences, p = {s1, . . . , sn}, the query q is a sentence randomly drawn from the passage, q = si , i ∼ [1, n], and the document d is the rest of sentences, d = {s1, . . . , si−1, si+1, . . . , sn}. See (q1,d) in Figure 2 as an example. This task captures the semantic context of a sentence and was originally proposed by Lee et al. (2019).

Body First Selection (BFS) We propose BFS to capture semantic relationship outside of the local paragraph. Here, the query q2 is a random sentence in the first section of a Wikipedia page, and the document d is a random passage from the same page (Figure 2). Since the first section of a Wikipedia article is often the description or summary of the whole page, we expect it to contain information central to the topic.

Wiki Link Prediction (WLP) We propose WLP to capture inter-page semantic relation. The query q3 is a random sentence in the first section of a Wikipedia page, and the document d is a passage from another page where there is a hyperlink link to the page of q3 (Figure 2). Intuitively, a hyperlink link indicates relationship between the two Wikipedia pages. Again, we take a sentence from the first section because it is often the description or summary of the topic.

4 Experiments

신기한게 MLM보다 여기서 나온 pretraining process의 성능이 월등히 좋음. 다만, pretraining task별로 성능이 안나온건 매우 사기. 그리고 pretrain한 BoW-MLP의 성능이 너무 좋은데? 데이터가 적을때는 MLM 학습한 transformer보다 좋다.

(Specifically, BoW-MLP looks up uni-grams from the embedding table5 , aggregates the embeddings with average pooling, and passes them through a shallow two-layer MLP network with tanh activation to generate the final 512-dimensional query/document embeddings. For fair comparison, the BoW-MLP encoder has a comparable model size to the Transformer encoder (i.e., 128M v.s. 110M parameters, slightly favorable to BoW-MLP encoder).)

실험결과를 보면 역시나 ICT가 제일 좋고 나머지는 하나마나 거의 의미없음. 그럼 이 논문의 컨트리뷰션은 사실상 그냥 실험만 한것.

5 CONCLUSION

random init , MLM 같은 부적절한 사전학습 < BM25 베이스라인

적절히 디자인된 사전학습이 중요하다.

Using AntiPatterns to avoid MLOps Mistakes

Conference :
Link : https://arxiv.org/pdf/2107.00079.pdf
Authors' Affiliation : The Bank of New York Mellon
TL;DR : we catalog and document numerous antipatterns in financial ML operations (MLOps)

Summary :

image

3 Antipatterns

supervised learning or forecasting context에서 얘기함.

3.1 Data Leakage AntiPattern

  • Peek-a-Boo AntiPattern.
  • Temporal Leakage AntiPattern
  • Oversampling Leakage AntiPattern
  • Metrics-from-Beyond AntiPattern

3.2 ‘Act Now, Reflect Never’ AntiPattern

배포해놓고 한번도 안보는 경우. 계속 모니터링해야 concept drift를 막을수 있음.

3.3 Tuning-under-the-Carpet AntiPattern

hyperparameter의 중요성.
it is imperative that the part of a learning pipeline concerned with hyper-parameter optimization be explicitly and painstakingly documented so as to be reproducible and easily adaptable

3.4 ‘PEST’ AntiPattern

Perceived Empirical SuperioriTy (PEST)
성능이 좋다고 구라치는 논문들에 속지말자. 많은 논문들은 실험 부족, hyperparameter 튜닝 부족으로 베이스라인보다 좋다고 사기치는것.

3.5 Bad Credit Assignment AntiPattern

위에꺼랑 마찬가지. 대부분 performance gain은 제시한 방법 덕분이 아닌데, 그거라고 주장하는 경우가 많음.

3.6 Grade-your-own-Exam AntiPattern

HARKing (Hypothesizing After Results are Known) = test set 가지고서 계속 eval하는 행위.

--> implicit data leakage

3.7 Set & Forget AntiPattern

concept drift

3.8 ‘Communicate with Ambivalence’ AntiPattern

uncertainty. calibration도 중요.

3.9 ‘Data Crisis as a Service’ AntiPattern

data processing 스텝을 확실하게 기록하고 변하는 걸 감지해야 함.

5 RECOMMENDATIONS

  1. Use AntiPatterns presented here to document a model management process to avoid costly but routine mistakes in model development, deployment, and approval.
  2. Use assertions to track data quality across the enterprise. This is crucial since ML models can be so dependent on faulty or noisy data and suitable checks and balances can ensure a safe operating environment for ML algorithms.
  3. Document data lineage along with transformations to support creation of ‘audit trails’ so models can be situated back in time and in specific data slices for re-training or re-tuning.
  4. Use ensembles to maintain a palette of models including remedial and compensatory pipelines in the event of errors. Track model histories through the lifecycle of an application
  5. Ensure human-in-the-loop operational capability at multiple levels. Use our model presented for rethinking ML deployment from Section 4 as a basis to support interventions and communication opportunities.

Calibrating Deep Neural Networks using Focal Loss

Conference : NeurIPS 2020
Link : https://arxiv.org/pdf/2002.09437.pdf
Authors' Affiliation : University of Oxford
TL;DR : focal loss 써서 학습하면 모델이 잘 calibrated됨

Summary :

3 What Causes Miscalibration

even when the classification error is 0, the NLL can be positive, and the optimisation algorithm can still try to reduce it to 0 by further increasing the value of pˆi,yi for each sample

lr decay한 직후부터 average test NLL이 증가하기 시작하는데, 이는 모두 incorrectly classified samples의 평균 NLL이 높아지기 때문이다. 정답인 샘플들의 NLL은 lr decay 이후에도 계속 떨어진다. 또한 lr decay한 이후에는 평균 ECE도 오르는데, 이는 네트워크가 miscalibrated 되기 시작한다는 뜻이다.

miscalibration 과 NLL overfitting은 연결되어 있다.

또한 entropy가 정답과 오답 모두에서 lr decay이후 감소하는데, 틀린 것에서조차 떨어진다는건 자신의 잘못된 예측에 대해서도 더 confident하게 된다는걸 의미한다.

cross entropy 로스가 0이 되는건 logit이 무한대가 되어야 가능하므로 tendency of weight magnification을 근본적으로 야기한다. weight decay가 거의 항상 accuracy를 증가시키는건 이것 때문일지도 모른다.

4 Improving Calibration using Focal Loss

$L = - (1 - \hat{p}{i, y_i})^\gamma \log \hat{p}{i, y_i}$

gamma는 hyperparameter

if pˆi,yi ∈ [0, 0.2), then γ = 5, otherwise γ = 3 (note that g(0.2, 5) ≈ 1 and g(0.25, 3) ≈ 1

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.