# Masked language modeling loss

**URL:** <https://discuss.huggingface.co/t/masked-language-modeling-loss/698>\
**Category:** 🤗Transformers\
**Created:** [August 12, 2020, 4:10pm UTC](https://discuss.huggingface.co/t/masked-language-modeling-loss/698 "2020-08-12T16:10:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![abdallah197](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/abdallah197/32/3973_2.png) [@abdallah197](https://discuss.huggingface.co/u/abdallah197)\
**Post date:** [August 12, 2020, 4:10pm UTC](https://discuss.huggingface.co/t/masked-language-modeling-loss/698/1 "2020-08-12T16:10:50Z")

</div>

Can anyone provide a link to a visual equation walkthrough for the MLM loss, or better how would it be implemented in torch.

---

<div class="post-metadata">

**Author:** ![valhalla](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/valhalla/32/4179_2.png) [@valhalla](https://discuss.huggingface.co/u/valhalla)\
**Post date:** [August 13, 2020, 4:52am UTC](https://discuss.huggingface.co/t/masked-language-modeling-loss/698/2 "2020-08-13T04:52:59Z")

</div>

This [thread](https://discuss.huggingface.co/t/bertformaskedlm-s-loss-and-scores-how-the-loss-is-computed/607) might help you
