File size: 9,079 Bytes
17c6d62
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<!--Copyright 2020 The HuggingFace Team. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.

⚠️ Note that this file is in Markdown but contain specific syntax for our doc-builder (similar to MDX) that may not be
rendered properly in your Markdown viewer.

-->

# DeBERTa[[deberta]]

## κ°œμš”[[overview]]


DeBERTa λͺ¨λΈμ€ Pengcheng He, Xiaodong Liu, Jianfeng Gao, Weizhu Chen이 μž‘μ„±ν•œ [DeBERTa: λΆ„λ¦¬λœ μ–΄ν…μ…˜μ„ ν™œμš©ν•œ λ””μ½”λ”© κ°•ν™” BERT](https://arxiv.org/abs/2006.03654)μ΄λΌλŠ” λ…Όλ¬Έμ—μ„œ μ œμ•ˆλ˜μ—ˆμŠ΅λ‹ˆλ‹€. 이 λͺ¨λΈμ€ 2018λ…„ Google이 λ°œν‘œν•œ BERT λͺ¨λΈκ³Ό 2019λ…„ Facebook이 λ°œν‘œν•œ RoBERTa λͺ¨λΈμ„ 기반으둜 ν•©λ‹ˆλ‹€.
DeBERTaλŠ” RoBERTaμ—μ„œ μ‚¬μš©λœ λ°μ΄ν„°μ˜ μ ˆλ°˜λ§Œμ„ μ‚¬μš©ν•˜μ—¬ λΆ„λ¦¬λœ(disentangled) μ–΄ν…μ…˜κ³Ό ν–₯μƒλœ 마슀크 디코더 ν•™μŠ΅μ„ 톡해 RoBERTaλ₯Ό κ°œμ„ ν–ˆμŠ΅λ‹ˆλ‹€.

λ…Όλ¬Έμ˜ μ΄ˆλ‘μ€ λ‹€μŒκ³Ό κ°™μŠ΅λ‹ˆλ‹€:

*사전 ν•™μŠ΅λœ 신경망 μ–Έμ–΄ λͺ¨λΈμ˜ 졜근 λ°œμ „μ€ λ§Žμ€ μžμ—°μ–΄ 처리(NLP) μž‘μ—…μ˜ μ„±λŠ₯을 크게 ν–₯μƒμ‹œμΌ°μŠ΅λ‹ˆλ‹€. λ³Έ λ…Όλ¬Έμ—μ„œλŠ” 두 κ°€μ§€ μƒˆλ‘œμš΄ κΈ°μˆ μ„ μ‚¬μš©ν•˜μ—¬ BERT와 RoBERTa λͺ¨λΈμ„ κ°œμ„ ν•œ μƒˆλ‘œμš΄ λͺ¨λΈ ꡬ쑰인 DeBERTaλ₯Ό μ œμ•ˆν•©λ‹ˆλ‹€. 첫 λ²ˆμ§ΈλŠ” λΆ„λ¦¬λœ μ–΄ν…μ…˜ λ©”μ»€λ‹ˆμ¦˜μœΌλ‘œ, 각 단어가 λ‚΄μš©κ³Ό μœ„μΉ˜λ₯Ό 각각 μΈμ½”λ”©ν•˜λŠ” 두 개의 λ²‘ν„°λ‘œ ν‘œν˜„λ˜λ©°, 단어듀 κ°„μ˜ μ–΄ν…μ…˜ κ°€μ€‘μΉ˜λŠ” λ‚΄μš©κ³Ό μƒλŒ€μ  μœ„μΉ˜μ— λŒ€ν•œ λΆ„λ¦¬λœ 행렬을 μ‚¬μš©ν•˜μ—¬ κ³„μ‚°λ©λ‹ˆλ‹€. 두 번째둜, λͺ¨λΈ 사전 ν•™μŠ΅μ„ μœ„ν•΄ λ§ˆμŠ€ν‚Ήλœ 토큰을 μ˜ˆμΈ‘ν•˜λŠ” 좜λ ₯ μ†Œν”„νŠΈλ§₯슀 측을 λŒ€μ²΄ν•˜λŠ” ν–₯μƒλœ 마슀크 디코더가 μ‚¬μš©λ©λ‹ˆλ‹€. μš°λ¦¬λŠ” 이 두 κ°€μ§€ 기술이 λͺ¨λΈ 사전 ν•™μŠ΅μ˜ νš¨μœ¨μ„±κ³Ό λ‹€μš΄μŠ€νŠΈλ¦Ό μž‘μ—…μ˜ μ„±λŠ₯을 크게 ν–₯μƒμ‹œν‚¨λ‹€λŠ” 것을 λ³΄μ—¬μ€λ‹ˆλ‹€. RoBERTa-Large와 λΉ„κ΅ν–ˆμ„ λ•Œ, 절반의 ν•™μŠ΅ λ°μ΄ν„°λ‘œ ν•™μŠ΅λœ DeBERTa λͺ¨λΈμ€ κ΄‘λ²”μœ„ν•œ NLP μž‘μ—…μ—μ„œ μΌκ΄€λ˜κ²Œ 더 λ‚˜μ€ μ„±λŠ₯을 보여주며, MNLIμ—μ„œ +0.9%(90.2% vs 91.1%), SQuAD v2.0μ—μ„œ +2.3%(88.4% vs 90.7%), RACEμ—μ„œ +3.6%(83.2% vs 86.8%)의 μ„±λŠ₯ ν–₯상을 λ‹¬μ„±ν–ˆμŠ΅λ‹ˆλ‹€. DeBERTa μ½”λ“œμ™€ 사전 ν•™μŠ΅λœ λͺ¨λΈμ€ https://github.com/microsoft/DeBERTa μ—μ„œ 곡개될 μ˜ˆμ •μž…λ‹ˆλ‹€.*

[DeBERTa](https://huggingface.co/DeBERTa) λͺ¨λΈμ˜ ν…μ„œν”Œλ‘œ 2.0 κ΅¬ν˜„μ€ [kamalkraj](https://huggingface.co/kamalkraj)κ°€ κΈ°μ—¬ν–ˆμŠ΅λ‹ˆλ‹€. 원본 μ½”λ“œλŠ” [이곳](https://github.com/microsoft/DeBERTa)μ—μ„œ ν™•μΈν•˜μ‹€ 수 μžˆμŠ΅λ‹ˆλ‹€.

## λ¦¬μ†ŒμŠ€[[resources]]


DeBERTaλ₯Ό μ‹œμž‘ν•˜λŠ” 데 도움이 λ˜λŠ” Hugging Face와 community 자료 λͺ©λ‘(🌎둜 ν‘œμ‹œλ¨) μž…λ‹ˆλ‹€. 여기에 포함될 자료λ₯Ό μ œμΆœν•˜κ³  μ‹ΆμœΌμ‹œλ‹€λ©΄ PR(Pull Request)λ₯Ό μ—΄μ–΄μ£Όμ„Έμš”. 리뷰해 λ“œλ¦¬κ² μŠ΅λ‹ˆλ‹€! μžλ£ŒλŠ” κΈ°μ‘΄ 자료λ₯Ό λ³΅μ œν•˜λŠ” λŒ€μ‹  μƒˆλ‘œμš΄ λ‚΄μš©μ„ λ‹΄κ³  μžˆμ–΄μ•Ό ν•©λ‹ˆλ‹€.


<PipelineTag pipeline="text-classification"/>

- DeBERTa와 [DeepSpeedλ₯Ό μ΄μš©ν•΄μ„œ λŒ€ν˜• λͺ¨λΈ ν•™μŠ΅μ„ κ°€μ†μ‹œν‚€λŠ”](https://huggingface.co/blog/accelerate-deepspeed) 방법에 λŒ€ν•œ 포슀트.
- DeBERTa와 [λ¨Έμ‹ λŸ¬λ‹μœΌλ‘œ ν•œμΈ΅ ν–₯μƒλœ 고객 μ„œλΉ„μŠ€](https://huggingface.co/blog/supercharge-customer-service-with-machine-learning)에 λŒ€ν•œ λΈ”λ‘œκ·Έ 포슀트.
- [`DebertaForSequenceClassification`]λŠ” 이 [예제 슀크립트](https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-classification)와 [λ…ΈνŠΈλΆ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/text_classification.ipynb)μ—μ„œ μ§€μ›λ©λ‹ˆλ‹€.
- [`TFDebertaForSequenceClassification`]λŠ” 이 [예제 슀크립트](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/text-classification)와 [λ…ΈνŠΈλΆ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/text_classification-tf.ipynb)μ—μ„œ μ§€μ›λ©λ‹ˆλ‹€.
- [ν…μŠ€νŠΈ λΆ„λ₯˜ μž‘μ—… κ°€μ΄λ“œ](../tasks/sequence_classification)

<PipelineTag pipeline="token-classification" />

- [`DebertaForTokenClassification`]λŠ” 이 [예제 슀크립트](https://github.com/huggingface/transformers/tree/main/examples/pytorch/token-classification)와 [λ…ΈνŠΈλΆ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/token_classification.ipynb)μ—μ„œ μ§€μ›ν•©λ‹ˆλ‹€.
- [`TFDebertaForTokenClassification`]λŠ” 이 [예제 슀크립트](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/token-classification)와 [λ…ΈνŠΈλΆ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/token_classification-tf.ipynb)μ—μ„œ μ§€μ›ν•©λ‹ˆλ‹€.
- πŸ€— Hugging Face μ½”μŠ€μ˜ [토큰 λΆ„λ₯˜](https://huggingface.co/course/chapter7/2?fw=pt) μž₯.
- πŸ€— Hugging Face μ½”μŠ€μ˜ [BPE(Byte-Pair Encoding) 토큰화](https://huggingface.co/course/chapter6/5?fw=pt) μž₯.
- [토큰 λΆ„λ₯˜ μž‘μ—… κ°€μ΄λ“œ](../tasks/token_classification)

<PipelineTag pipeline="fill-mask"/>

- [`DebertaForMaskedLM`]λŠ” 이 [예제 슀크립트](https://github.com/huggingface/transformers/tree/main/examples/pytorch/language-modeling#robertabertdistilbert-and-masked-language-modeling)와 [λ…ΈνŠΈλΆ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling.ipynb)μ—μ„œ μ§€μ›ν•©λ‹ˆλ‹€.
- [`TFDebertaForMaskedLM`]은 이 [예제 슀크립트](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/language-modeling#run_mlmpy)와 [λ…ΈνŠΈλΆ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling-tf.ipynb)μ—μ„œ μ§€μ›ν•©λ‹ˆλ‹€.
- πŸ€— Hugging Face μ½”μŠ€μ˜ [마슀크 μ–Έμ–΄ λͺ¨λΈλ§](https://huggingface.co/course/chapter7/3?fw=pt) μž₯.
- [마슀크 μ–Έμ–΄ λͺ¨λΈλ§ μž‘μ—… κ°€μ΄λ“œ](../tasks/masked_language_modeling)

<PipelineTag pipeline="question-answering"/>

- [`DebertaForQuestionAnswering`]은 이 [예제 슀크립트](https://github.com/huggingface/transformers/tree/main/examples/pytorch/question-answering)와 [λ…ΈνŠΈλΆ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/question_answering.ipynb)μ—μ„œ μ§€μ›ν•©λ‹ˆλ‹€.
- [`TFDebertaForQuestionAnswering`]λŠ” 이 [예제 슀크립트](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/question-answering)와 [λ…ΈνŠΈλΆ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/question_answering-tf.ipynb)μ—μ„œ μ§€μ›ν•©λ‹ˆλ‹€.
- πŸ€— Hugging Face μ½”μŠ€μ˜ [μ§ˆμ˜μ‘λ‹΅(Question answering)](https://huggingface.co/course/chapter7/7?fw=pt) μž₯.
- [μ§ˆμ˜μ‘λ‹΅ μž‘μ—… κ°€μ΄λ“œ](../tasks/question_answering)

## DebertaConfig[[transformers.DebertaConfig]]

[[autodoc]] DebertaConfig

## DebertaTokenizer[[transformers.DebertaTokenizer]]

[[autodoc]] DebertaTokenizer
    - build_inputs_with_special_tokens
    - get_special_tokens_mask
    - create_token_type_ids_from_sequences
    - save_vocabulary

## DebertaTokenizerFast[[transformers.DebertaTokenizerFast]]

[[autodoc]] DebertaTokenizerFast
    - build_inputs_with_special_tokens
    - create_token_type_ids_from_sequences

<frameworkcontent>
<pt>

## DebertaModel[[transformers.DebertaModel]]

[[autodoc]] DebertaModel
    - forward

## DebertaPreTrainedModel[[transformers.DebertaPreTrainedModel]]

[[autodoc]] DebertaPreTrainedModel

## DebertaForMaskedLM[[transformers.DebertaForMaskedLM]]

[[autodoc]] DebertaForMaskedLM
    - forward

## DebertaForSequenceClassification[[transformers.DebertaForSequenceClassification]]

[[autodoc]] DebertaForSequenceClassification
    - forward

## DebertaForTokenClassification[[transformers.DebertaForTokenClassification]]

[[autodoc]] DebertaForTokenClassification
    - forward

## DebertaForQuestionAnswering[[transformers.DebertaForQuestionAnswering]]

[[autodoc]] DebertaForQuestionAnswering
    - forward

</pt>
<tf>

## TFDebertaModel[[transformers.TFDebertaModel]]

[[autodoc]] TFDebertaModel
    - call

## TFDebertaPreTrainedModel[[transformers.TFDebertaPreTrainedModel]]

[[autodoc]] TFDebertaPreTrainedModel
    - call

## TFDebertaForMaskedLM[[transformers.TFDebertaForMaskedLM]]

[[autodoc]] TFDebertaForMaskedLM
    - call

## TFDebertaForSequenceClassification[[transformers.TFDebertaForSequenceClassification]]

[[autodoc]] TFDebertaForSequenceClassification
    - call

## TFDebertaForTokenClassification[[transformers.TFDebertaForTokenClassification]]

[[autodoc]] TFDebertaForTokenClassification
    - call

## TFDebertaForQuestionAnswering[[transformers.TFDebertaForQuestionAnswering]]

[[autodoc]] TFDebertaForQuestionAnswering
    - call

</tf>
</frameworkcontent>