Gheini et al. / 2021 EMNLP
tranfomer 구조에서의 transfer learning시 cross-attention의 파워를 연구
training from scratch에서의 cross-attention또한 추가적으로 연구
source 또는 target language를 바꾸어 fine-tuning 하는 실험을 진행하여, cross-attention 파라미터만 fine-tuning 하는 것이 모든 파라미터를 fine-tuning하는 것 만큼이나 효과 가 있음을 밝혀냄.
그 이유를 연구하고, cross-attention만 finetuning하는 것이 cross-lingually aligned embedding을 만들어내는 것을 관찰함.
이러한 발견은 catastrophic forgetting의 완화, zero-shot translation의 가능성, 더 적은 parameter storage overhead를 사용한 새로운 언어로의 MT의 가능성을 시사함.
1. Introduction
- Transformer-based 모델의 pre-training - fine-tuning approach가 dominant함.
- 일반적으로 pretrained model을 Fine-tuning하는 것은 parameter의 중요성에 따른 구분 없이 모든 parameter를 업데이트함.
- 최근 연구들에 따르면, MT모델을 training from scratch 할때의 cross-attention layer의 중요성이 self-attention layer보다 크다는 사실. (pruning시 quality가 더 degrade됨)
- 또 다른 연구에 따르면, cross-attention은 performance 손상없이 input-independant 하드코딩으로 대체 불가, (self-attention은 가능)
- 이 논문에서는, MT의 transfer learing에서의 cross-attention의 중요성을 연구
다른 language pair에 pretrained 된 모델에 대해 새로운 language pair를 학습(transfer learning)시킴
- 다른 모듈은 고정시킨 채로 cross-attention은 새로운 language pair에 얼마나 잘 적용되는가?
- cross-attention은 다른 태스크로의 적용에 있어 얼마나 중요한가?
- cross-attention만 업데이트 되었을 때 질적 차이 (qualitative difference가 있는가?)
위 세가지 질문들을 탐구하기 위해 여러가지 실험 진행

- (scratch) from scratch / b. (src+body) fine-tuning all parameter except for the embeddings for the languages in common (regular fine-tuning, paper’s upper bound) / c. (src+xattn) fine-tuning soely cross-attetnions and new embeddings / d. (src) fine-tuning only the new embeddings / e (tgt+xattn) / f (src+randxattn)
(여기서 new embedding은 random하게 initialized된 임베딩임. 점선은 random initialization을 뜻함)
a-d 는 new source language, same target language 가정, e는 target-side transfer
- 나머지 냅두고 cross-attention만 update하는 것이 전부 fine-tuning하는 것과 가까운 성능!
- pretrained된 cross-attention사용하는 것도 중요 (randxatten 사용시 성능 하락 ㅠㅠ)
- 모든 파라미터를 fine-tuning하는 것과 xatten만 할 때 embedding이 학습되는 방식도 다름
- body를 fine-tune 하지 않을 때는 새로운 언어의 newly-learned embedding이 pretrained model의 embedding과 align함.
- 전체를 fine-tune 할 때는 그러한 효과 x
- 이러한 결과는 특히 forgetting을 완화, zero-shot translation 수행 등에 유용함(Ch. 5),
- 실용적 관점에서 cross-attention만을 fine-tuning하는 것은 더 lightweight한 fine-tuning 방식임
- new pair에 대해서 subset of parameter만 저장하면 됨
Contributions
- cross-attetion만 fine-tuning / 전체 fine-tuning 성능 비교
- cross-attention만 fine-tuning시 new embedding이 대응하는 pretrained model의 embedding과 align 하는 것을 보임
- 2의 결과를 catastrophic forgetting의 완화와 zero-shot translation에 적용함
2. Cross-Attention Fine-Tuning for MT
Analysis Setup
- Cross-attention fine-tuning & embedding finetuning
- embedding 만 fine-tuning 하는 것에 추가적으로 cross-attention의 fine-tuning이 얼마나 도움이 되는지 실험
- Cross-attention fine-tuning & full fine-tuning
- cross-attention만으로도 새로운 language pair에 adapt 할 수 있는지 실험
- Pretrained cross-attention layers & random cross-attention layers
- cross-attention에 encode된 정보도 유용한지 실험
- Translation cross-attention & language modelling cross-attention
- cross-attention에 encode된 정보가 다른 pretrainig objective에 따라 어떻게 다른지 실험
3. Experimental Setup
- transfer시 새로운 language의 embedding 여러가지 방법론 (frequency-based assignment, random assignment, joint (shared) vocabularies, no assignment( ranodmly initialized))이 있지만, 이 논문에서는 random initialization을 채택 → pretraining의 잔재와 상관 없이 embedding에 무슨일이 일어나는지 살펴보기 위함.
- 부모모델 :French-English, 자식모델 : 6개의 다른 language pair
- ablation으로 mBART을 parent model로 이용하는 실험도 진행 ( denoising objective pretraining)
Model detail
- Transformer(base)구조 사용
- SentencePiece BPE사용
- Gowda and May (2020)의 조언을 따라 child model의 vocab size를 결정함 i.e., we choose the maximum number of operations to ensure a minimum of 100 tokens per type. …? (논문 읽어보기)
4. Result and Analysis
4.1 Cross-attention’s Power and Importance
Translation Quality
- 한가지 경우를 제외하고, 특히 새로운 target language를 위해 transfer하는 경우에서 {src,tgt}+xattn 이 {src,tgt}에 비해 작지 않은 성능 우위를 보임
- 모든 경우에서 {src,tgt}+body와 비견할 만한 성능을 보임
- cross-attention이 child task에 적응하는데 body의 translation knowledge를 이용할 수 (take advantage) 있음을 시사
- 새로운 target languge 태스크에서의 성능 차이가 더 두드러짐.
- target language가 바뀌면 key,value (3개 행렬중 2개)가 새로운 언어에 노출(exposed)되지만, source가 바뀌면 query만 새로운 언어에 노출되기 때문이라고 expected..? (코드를 체크해봐야할듯)

Storage
- {src,tgt}+xattn stores only 124,430,336 parameters compared to
{src,tgt}+body’s 313,583,616.
- xattn만 업데이트 하는 것이 훨씬 효율적!
Pretrained and Random Values
- random cross-attention은 pretrianed와 비교해서 뿐만 아니라 어쩔때는 scratch보다도 성능 열세
mBART를 parent 모델로 사용하면?

- (mBART는 shared vocabulary를 사용하고 인코더와 디코더의 embedding이 tie됨 → src+tgt == embed라고 Figure2 에서 표기)
- 전에 {src, tgt} fine-tuning이 scratch보다 나았던것과는 대조적으로 mBART에서는 오히려 더 별로
- cross-attention에 translation관련 지식이 부재하므로, fine-tuning이 translation adaption에서 더 중요
4.2 Learned Representations Properties
- cross-attention을 제외하면, {src,tgt}+body세팅과 {src,tgt}+xattn세팅 둘다에서 업데이트 되는 파라미터는 embeddings 밖에 없음
- 두 세팅에서 embedding을 비교
- pretrained와 fine-tuning후의 embedding을 bilingual 사전인 MUSE를 통해서 연구함
- 독일어로 Fine-tuning된 임베딩에서 가장 가까운 French 임베딩을 찾아 MUSE와 일치하면 match!
- {src,tgt}+xattn세팅에서 55% match
- {src,tgt}+body세팅에서는 19.7% match
- 직접 40개 단어 sample해서 번역기로 check 했는데, src+xattn은 80%, src+body는 30%
결론 : {src,tgt}+body에서는 안그러지만 {src,tgt}+xattn에서는 embedding align (parent-child)하는구나!
5. Utilities of Aligned Embeddings
5.1 Mitigating Forgetting

- Child 모델들에 대해 FR-EN 테스트 진행 ( 바뀐 embedding만 되돌려 놓고)
- FR-EN parent모델에서는 35.0 BLEU
5.2 Zero-Shot Translation
- Fr-Es child 모델의 Fr을
- De-En child모델 에서의 De로 replace (둘다 {src,tgt}+xattn으로 fine-tuning)
→ De-Es translation model with no De-Es training or direct De-Fr alignment

De-Es같은 경우 294,216 sample에 train된 건데, 50000, 100000 에서는 각각 7.2, 12.0 BLEU