Closed carina-kauf closed 1 year ago
Name | Link |
---|---|
Latest commit | 5637b27bc178f4224cd8838530c9c47efe07aefe |
Latest deploy log | https://app.netlify.com/sites/pyminicons/deploys/648869ec7c15cc000876fd54 |
Name | Link |
---|---|
Latest commit | 5637b27bc178f4224cd8838530c9c47efe07aefe |
Latest deploy log | https://app.netlify.com/sites/pyminicons/deploys/648869ec7c15cc000876fd54 |
this is brilliant! Thanks @carina-kauf!!
This PR adds a better scoring method for masked language models (Kauf & Ivanova, 2023) to the
MaskedLMScorer
class within thescorer
module.Key addition:
PLL_metric='within_word_l2r'
scoring optionThe key addition is a new optional string argument called
PLL_metric
, which can take one of two values:'original'
(default) : this option implements the original pseudo-log-likelihood scoring functionality for masked language models, following Salazar et al. (2020).'within_word_l2r'
: this option implements the improved pseudo-log-likelihood scoring functionality for masked language models, following Kauf & Ivanova (2023); paper to appear in the proceedings of ACL2023. This new pseudo-log-likelihood scoring method leverages a locally-autoregressive scoring strategy to avoid the overestimation of probabilities of tokens in multi-token words. In particular, tokens probabilities are estimated using the bidirectional context, excluding any future tokens that belong to the same word as the current target token.The optional
PLL_metric
string argument was added to the following functions within theMaskedLMScorer
class:prepare_text
: key update to attention masks (mask out future subword tokens, leveraging word ids)sequence_score
: now calls theprepare_text
function with thePLL_metric
argumenttoken_score
: now calls theprepare_text
function with thePLL_metric
argumentUsage