# Dropout before layer normalization

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdropout-before-layer-normalization%2F2829%3E%5C
**Category:** 🤗Transformers\
**Created:** [December 15, 2020, 9:43am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdropout-before-layer-normalization%2F2829 "2020-12-15T09:43:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lifelongeek](https://avatars.discourse-cdn.com/v4/letter/l/6de8d8/32.png) [@lifelongeek](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Flifelongeek)%5C
**Post date:** [December 15, 2020, 9:43am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdropout-before-layer-normalization%2F2829%2F1 "2020-12-15T09:43:52Z")

</div>

At first stage of BartDecoder, we compute

1. compute token embedding
2. add positional embedding
3. layer normalization
4. dropout (optional)

> x = self.embed\_tokens(input\_ids)  
> x += positions  
> x = self.layernorm(x)  
> x = dropout(x, p, self.training)

I am thinking of moving dropout right before adding positional embedding for making token embedding noisy

> x = self.embed\_tokens(input\_ids)  
> x = dropout(x, p, self.training)  
> x += positions  
> x = self.layernorm(x)

Is there any belief that dropout needs to be placed after layer normalization?
