# Training Tips for the Transformer Model

Transformer 모델을 위한 훈련 팁

Martin Popel, Ondřej Bojar · arXiv · 2018년 4월 1일

- **연구 문제** Transformer의 batch size, learning rate, warmup steps, 최대 문장 길이, 체크포인트 평균화 같은 학습 매개변수가 영어-체코어 번역 품질과 학습 시간에 주는 영향을 실험합니다.
- **연구 방법** Tensor2Tensor 구현 Transformer(BIG/BASE)를 CzEng 기반 영어-체코어 데이터로 학습하고, 실제 BLEU 학습 곡선과 Time Till Score로 설정 효과를 비교합니다.
- **주요 결과** 8 GPU와 BIG 모델에서 최고 실행은 WMT17 평가 기준 자동 지표에서 최고 시스템을 앞섰다고 보고되며, 배치 크기 확대와 다중 GPU는 BLEU 도달 시간을 줄였습니다.

## 연구 문제와 평가 기준

Transformer 모델은 신경망 기계번역의 새로운 기준으로 자리 잡았지만, 학습 매개변수가 번역 품질과 학습 시간에 어떤 영향을 주는지는 충분히 정리되어 있지 않습니다. 이 논문은 Tensor2Tensor에 구현된 Transformer를 영어-체코어 번역에 적용하여 batch size, learning rate, warmup steps, 최대 문장 길이, 체크포인트 평균화 같은 설정을 실험합니다.

평가 지표로는 대소문자를 구분하지 않는 sacréBLEU를 사용합니다. 학습이 과적합 이전에 수렴하지 않는 경우가 많아, 단일 최종 점수 대신 시간에 따른 전체 BLEU 학습 곡선을 보고합니다. 이때 Time Till Score는 특정 BLEU 수준에 도달한 뒤 그 아래로 다시 떨어지지 않는 시점을 측정하는 지표입니다.

## 데이터와 평가 도구

주요 학습 데이터는 CzEng 1.7이며, 일부 실험에서는 더 작은 CzEng 1.0으로 대체합니다. 개발 세트로는 WMT newstest2013을 사용합니다. 저자들은 T2T 기본 실행 과정이 보고하는 approx-bleu가 내부 서브워드에서 계산되어 실제 BLEU보다 1.2–1.8배 높으므로, 실제 BLEU를 계산하도록 t2t-bleu 스크립트를 구현했습니다.

![Table 1: Training data resources](https://refivu.com/papers/f2437599-de07-4bc9-b659-4823dff3be26/figures/figure-6623e5808d26935d13d80df4db31c6e0.png?thumb=512)

**Table 1** : Training data resources

[원문](https://arxiv.org/abs/1804.00247v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Martin Popel, Ondřej Bojar · Training Tips for the Transformer Model · 원문 그림 인용 · 원본 PDF 6쪽에서 그림 영역을 추출했습니다.

이 스크립트는 sacréBLEU와 같은 tokenization intl 설정으로 결과를 계산합니다. 따라서 본문의 BLEU 곡선은 approx-bleu가 아니라 실제 BLEU 기준의 값입니다.

## 계산 속도와 다중 GPU 처리량

단일 GPU에서 batch size가 커질수록 계산 속도는 줄어듭니다. BIG 모델은 batch size 500일 때 23.6k steps/hour이고, BASE 모델은 같은 조건에서 43.4k steps/hour입니다. 학습 처리량은 계산 속도와 유효 배치 크기의 곱으로 정의되므로, 배치가 커지면 처리량은 증가하지만 그 증가는 선형보다 작습니다.

BIG 모델과 batch size 1500에서 GPU를 1개에서 6개, 8개로 늘리면 계산 속도는 떨어지지만 처리량은 증가합니다. 6 GPU의 처리량은 1 GPU의 약 3.2배입니다. 이 값은 해당 설정의 측정 결과이며, 다른 모델이나 하드웨어로 일반화하지 않습니다.

![Table 3: Computation speed and training throughput for various numbers of GPUs, with the BIG model andbatch\_size=1500](https://refivu.com/papers/f2437599-de07-4bc9-b659-4823dff3be26/figures/figure-0c8fad8bf5a95934ccdb948381a38d1f.png?thumb=512)

**Table 3** : Computation speed and training throughput for various numbers of GPUs, with the BIG model andbatch\_size=1500.

[원문](https://arxiv.org/abs/1804.00247v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Martin Popel, Ondřej Bojar · Training Tips for the Transformer Model · 원문 그림 인용 · 원본 PDF 9쪽에서 그림 영역을 추출했습니다.

## 학습 데이터 규모의 효과

CzEng 1.7은 CzEng 1.0보다 약 2.5배 큰 학습 데이터입니다. 8 GPU, BIG 모델, batch size 1500 설정에서 작은 데이터셋은 약 2일 뒤 BLEU 25.5 부근에서 수렴했고, 큰 데이터셋은 2일 이후 더 나은 결과를 보였습니다. 큰 데이터셋의 BLEU는 약 8일 뒤 26.5를 넘었다고 보고됩니다.

이 비교는 학습 시간이 충분할 때의 결과이므로, 초기 몇 시간의 결과만으로 데이터셋의 우열을 판단하기 어렵다는 해석과 함께 읽어야 합니다.

## 배치 크기와 학습률의 상호작용

BASE 모델은 배치 크기를 4500까지 늘릴수록 BLEU 학습 곡선이 개선되었습니다. BIG 모델은 배치 크기 1400과 1450 사이에서 학습이 발산하거나 회복이 느린 현상을 보였습니다. 저자들은 이를 gradient noise scale과 학습률·배치 크기의 관계로 해석하지만, 이는 저자의 가설입니다.

단일 GPU의 BIG 모델에서 기본 학습률 0.20은 0.05–0.25 범위에서 큰 차이가 없었고, 0.30은 발산했습니다. warmup steps를 16k에서 32k로 늘리면 0.30과 0.50에서도 발산이 없었다고 보고됩니다. 이 학습률 범위는 BIG 모델과 단일 GPU, CzEng 1.0 조건에서 확인된 값입니다.

## 다중 GPU에서의 학습률 조정

8 GPU에서 batch size는 GPU별로 해석되므로 유효 배치 크기가 8배가 됩니다. 원문은 linear scaling heuristics와 제곱근 스케일링을 비교하고, T2T의 linear\_warmup\_rsqrt\_decay 스케줄에서는 global\_step이 시간 축으로 쓰이므로 learning\_rate를 고정한 채 GPU 수를 늘리면 실제 학습률이 √k배로 커진다고 설명합니다.

따라서 8 GPU에서 learning\_rate를 √8로 나누면 단일 GPU와 같은 실제 학습률을 학습 예제 수 기준으로 맞출 수 있습니다. 저자들은 이를 이 설정의 해석으로 제시하며, 다른 스케줄이나 데이터에 그대로 적용한다고 주장하지 않습니다.

## GPU 수와 BLEU 도달 시간

BIG 모델과 batch size 1500에서 BLEU 25.6에 도달하는 데 걸린 시간은 1 GPU에서 600시간을 넘었고, 2 GPU에서 203시간, 6 GPU에서 56시간, 8 GPU에서 40시간이었습니다. 1 GPU 실험은 25일 학습 후에도 임계값을 명확히 넘지 못해 종료되었습니다.

![Table 6: Time and training data consumed to reach BLEU of 25.6, i.e. Time Till Score andExamplesTillScore. Notethattheexperimenton1GPUwasendedafter25days of tr…](https://refivu.com/papers/f2437599-de07-4bc9-b659-4823dff3be26/figures/figure-b5b37489363a42fa821af7a8fd509c37.png?thumb=512)

**Table 6** : Time and training data consumed to reach BLEU of 25.6, i.e. Time Till Score andExamplesTillScore. Notethattheexperimenton1GPUwasendedafter25days of training without clearly surpassing the threshold (already outside of Figure 9).

[원문](https://arxiv.org/abs/1804.00247v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Martin Popel, Ondřej Bojar · Training Tips for the Transformer Model · 원문 그림 인용 · 원본 PDF 19쪽에서 그림 영역을 추출했습니다.

이 결과는 GPU 수가 늘수록 BLEU 도달 시간이 줄어든다는 관찰입니다. 다만 학습률과 warmup steps를 다중 GPU 설정에 맞춰 다시 튜닝하지 않았다는 조건이 함께 주어집니다.

## 최대 문장 길이와 메모리

max\_length는 학습 문장의 최대 서브워드 길이를 제한하며, 더 긴 문장은 학습에서 제외됩니다. 이 제한을 낮추면 같은 GPU 메모리에서 더 큰 배치 크기나 모델을 사용할 수 있습니다. 예를 들어 BIG+Adam에서 max\_length가 none일 때 2040, 50일 때 2750으로 최대 배치 크기가 커졌습니다.

![Table 5: Maximumbatchsizewhichﬁtsinto11GBmemoryforvariouscombinations of max\_length (maximum sentence length in subwords), model size (base or big) and optimiz…](https://refivu.com/papers/f2437599-de07-4bc9-b659-4823dff3be26/figures/figure-3f9519ba4b8e43b759d9b3bdbaae338c.png?thumb=512)

**Table5** : Maximumbatchsizewhichﬁtsinto11GBmemoryforvariouscombinations of max\_length (maximum sentence length in subwords), model size (base or big) and optimizer (Adam or Adafactor). The last two columns show the percentage of sentences in the train (CzEng 1.7) and test (wmt13) data that are longer than a given threshold.

[원문](https://arxiv.org/abs/1804.00247v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Martin Popel, Ondřej Bojar · Training Tips for the Transformer Model · 원문 그림 인용 · 원본 PDF 13쪽에서 그림 영역을 추출했습니다.

그러나 max\_length를 낮추면 긴 문장이 제외되어 번역이 짧아질 위험이 있습니다. 원문은 batch size 1500에서 max\_length 70 이하일 때 학습 초기에 BLEU 곡선의 drop이 나타났지만, 원인은 설명하지 못했다고 보고합니다. batch size 2000에서는 max\_length 70 이상이 기본 설정과 비슷했습니다.

## 체크포인트 평균화

체크포인트 평균화는 여러 저장 시점의 모델 가중치를 평균하여 BLEU 곡선의 변동을 줄이는 방법입니다. 원문에서 6 GPU로 학습한 실험은 평균하지 않은 경우, 8개 체크포인트 평균, 16개 체크포인트 평균을 비교합니다. 평균화된 곡선은 대체로 기준선보다 약 0.2 BLEU 높았고, 일부 설정에서는 1 BLEU 이상 개선되었다고 보고됩니다.

초기 학습 단계에서는 평균 개수를 줄이는 편이 낫고, 후기에는 16개 평균이 8개보다 약간 나았다는 관찰이 있습니다. 다만 이 비교는 유의성 검정을 하지 않은 관찰입니다.

## WMT17 시스템과의 비교

최고 Transformer 실행은 BIG 모델을 8 GPU에서 8일 학습하고 8개 체크포인트를 평균한 결과입니다. 이 모델은 WMT17 영어-체코어 평가에서 BLEU, TER, CharacTER, BEER 기준으로 최고 시스템을 앞섰다고 보고됩니다. 다만 저자들은 자동 평가가 완전히 신뢰할 수 있는 것은 아니라고 밝히며, CU-Chimera는 수동 순위가 낮지만 BLEU는 높았다는 예를 듭니다.

![Table 7: WMT17systemsforEnglish-to-CzechandourbestT2Ttrainingrun. Manual scores are from the oﬃcial WMT17 ranking. Automatic metrics were provided by http://ma…](https://refivu.com/papers/f2437599-de07-4bc9-b659-4823dff3be26/figures/figure-fb0afbffa1a683d4532bfa97c6bc6c47.png?thumb=512)

**Table7** : WMT17systemsforEnglish-to-CzechandourbestT2Ttrainingrun. Manual scores are from the oﬃcial WMT17 ranking. Automatic metrics were provided by http://matrix.statmt.org/. For \*TER metrics, lower is better. Best results in bold, second-best in italics.

[원문](https://arxiv.org/abs/1804.00247v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Martin Popel, Ondřej Bojar · Training Tips for the Transformer Model · 원문 그림 인용 · 원본 PDF 25쪽에서 그림 영역을 추출했습니다.

이 비교는 제한된 학습 데이터 설정과 자체 측정된 자동 지표에 근거한 것입니다.

## 논문 정보

- **저자**: Martin Popel, Ondřej Bojar
- **학회·저널**: arXiv · 프리프린트
- **최초 공개일**: 2018년 4월 1일
- **등록일**: 2026년 11월 6일
- **수정일**: 2018년 5월 2일
- **버전**: v2
- **arXiv**: 1804.00247
- **DOI**: 10.2478/pralin-2018-0002
- **분류**: cs.CL
- **원문 이용 조건**: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)
- **제공 범위**: 논문 정보, 해설, 허용된 원문 그림

[논문 원문 ↗](https://arxiv.org/abs/1804.00247v2) · [원문 PDF ↗](https://arxiv.org/pdf/1804.00247v2)

AI 해설은 논문 원문과 별개의 설명이며 오류가 있을 수 있습니다. 원문과 그림은 각 출처의 이용 조건과 따로 표시된 권리를 따릅니다.

## 초록

This article describes our experiments in neural machine translation using the recent Tensor2Tensor framework and the Transformer sequence-to-sequence model (Vaswani et al., 2017). We examine some of the critical parameters that affect the final translation quality, memory usage, training stability and training time, concluding each experiment with a set of recommendations for fellow researchers. In addition to confirming the general mantra "more data and larger models", we address scaling to multiple GPUs and provide practical tips for improved training regarding batch size, learning rate, warmup steps, maximum sentence length and checkpoint averaging. We hope that our observations will allow others to get better results given their particular hardware and data constraints.

## 원문 인용

Martin Popel, Ondřej Bojar (2018). Training Tips for the Transformer Model. arXiv:1804.00247v2. https://doi.org/10.2478/pralin-2018-0002

**BibTeX**

```
@article{popel2018training,
  title = {{Training Tips for the Transformer Model}},
  author = {Martin Popel and Ondřej Bojar},
  year = {2018},
  eprint = {1804.00247},
  archivePrefix = {arXiv},
  doi = {10.2478/pralin-2018-0002},
  url = {https://arxiv.org/abs/1804.00247v2}
}
```

## 이 논문의 용어

- [Adam](https://refivu.com/terms/0e9ad0199e08-adam)
- [트랜스포머](https://refivu.com/terms/515e8433c447-transformer)
- [BLEU](https://refivu.com/terms/42cd9b97719e-bleu)
- [AdaFactor](https://refivu.com/terms/b0f03894f97e-adafactor)
- [checkpoint averaging](https://refivu.com/terms/e9c8195212b1-checkpoint-averaging)
- [Training Throughput](https://refivu.com/terms/8a519cc31805-training-throughput)

## 다른 논문 해설

- [Artificial intelligence contribution to translation industry: looking back and forward](https://refivu.com/papers/bb8c5e97-6b4d-4494-8e95-7693f7754127-artificial-intelligence-contribution-to-translation-industry.md)
- [Kencorpus: A Kenyan Language Corpus of Swahili, Dholuo and Luhya for Natural Language Processing Tasks](https://refivu.com/papers/63ecaace-b12e-4c8f-8421-3ed079f7ba82-kencorpus-a-kenyan-language-corpus-of-swahili-dholuo.md)
- [Assessing Text Classification Methods for Cyberbullying Detection on Social Media Platforms](https://refivu.com/papers/7faefd2d-5919-41ff-8a98-9f4d1c5bfc04-assessing-text-classification-methods-for-cyberbullying.md)
- [Short text classification with machine learning in the social sciences: The case of climate change on Twitter](https://refivu.com/papers/1572ef01-e606-4f6e-a992-4b353feb817a-short-text-classification-with-machine-learning-in-the.md)
- [Domain Adaptation with Pre-trained Transformers for Query Focused Abstractive Text Summarization](https://refivu.com/papers/e09e0a55-c163-4f22-8a52-05215b31a3d1-domain-adaptation-with-pre-trained-transformers-for-query.md)
- [Towards Natural Language-Based Visualization Authoring](https://refivu.com/papers/88bc5e0d-6a88-4600-80f8-23fec880ab8e-towards-natural-language-based-visualization-authoring.md)
- [Self-supervised Learning: Generative or Contrastive](https://refivu.com/papers/f29652bc-588e-4c10-accc-3c3ba6c23453-self-supervised-learning-generative-or-contrastive.md)
- [Deep Reinforcement Learning Based Intelligent Reflecting Surface for Secure Wireless Communications](https://refivu.com/papers/7f104da3-3d98-4ecd-95d9-a25944d61e36-deep-reinforcement-learning-based-intelligent-reflecting.md)
- [Retrieval-Pretrained Transformer: Long-range Language Modeling with Self-retrieval](https://refivu.com/papers/624b0d3d-2626-449c-9b8d-15b795867446-retrieval-pretrained-transformer-long-range-language.md)
- [Writer Identification and Writer Retrieval Based on NetVLAD with Re-ranking](https://refivu.com/papers/5c507cda-3490-4660-8811-36c766c434c8-writer-identification-and-writer-retrieval-based-on-netvlad.md)
- [Reinforced Prompt Personalization for Recommendation with Large Language Models](https://refivu.com/papers/27afc2ea-b641-4b86-8888-206972777f90-reinforced-prompt-personalization-for-recommendation-with.md)
- [Six Fallacies in Substituting Large Language Models for Human Participants](https://refivu.com/papers/bb0ec81c-502c-4c66-a26c-df852f429e31-six-fallacies-in-substituting-large-language-models-for.md)

---

AI 해설에는 오류가 있을 수 있습니다. [Refivu](https://refivu.com/papers/f2437599-de07-4bc9-b659-4823dff3be26-training-tips-for-the-transformer-model)
