{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/unmasking-the-mask-evaluating-social-biases","title":"Unmasking the Mask -- Evaluating Social Biases in Masked Language Models","arxiv_id":"2104.07496","date":"2021-04-15","proceeding":null,"authors":["Masahiro Kaneko","Danushka Bollegala"],"abstract":"Masked Language Models (MLMs) have shown superior performances in numerous downstream NLP tasks when used as text encoders. Unfortunately, MLMs also demonstrate significantly worrying levels of social biases. We show that the previously proposed evaluation metrics for quantifying the social biases in MLMs are problematic due to following reasons: (1) prediction accuracy of the masked tokens itself tend to be low in some MLMs, which raises questions regarding the reliability of the evaluation metrics that use the (pseudo) likelihood of the predicted tokens, and (2) the correlation between the prediction accuracy of the mask and the performance in downstream NLP tasks is not taken into consideration, and (3) high frequency words in the training data are masked more often, introducing noise due to this selection bias in the test cases. To overcome the above-mentioned disfluencies, we propose All Unmasked Likelihood (AUL), a bias evaluation measure that predicts all tokens in a test case given the MLM embedding of the unmasked input. We find that AUL accurately detects different types of biases in MLMs. We also propose AUL with attention weights (AULA) to evaluate tokens based on their importance in a sentence. However, unlike AUL and AULA, previously proposed bias evaluation measures for MLMs systematically overestimate the measured biases, and are heavily influenced by the unmasked tokens in the context.","url_abs":"https://arxiv.org/abs/2104.07496v1","url_pdf":"https://arxiv.org/pdf/2104.07496v1.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"unmasking-the-mask-evaluating-social-biases","repo_url":"https://github.com/kanekomasahiro/evaluate_bias_in_mlm","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"unmasking-the-mask-evaluating-social-biases","repo_url":"https://github.com/zalkikar/mlm-bias","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"selection-bias","task_name":"Selection bias"},{"task_slug":"sentence","task_name":"Sentence"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2104.07496","atlas_url":"https://app.syntology.ai/?focus=2104.07496","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2104.07496"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/kanekomasahiro/evaluate_bias_in_mlm","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/zalkikar/mlm-bias","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":4,"ran_fixture":1,"unverified":3},"by_repo_kind":{"official":{"samples":2,"ran":1,"repositories":1},"listed":{"samples":6,"ran":4,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"37152278142c6d80","entry":"format_mlm_bias_results","repo":"zalkikar/mlm-bias","repo_kind":"listed","path":"mlm_bias.py","file_url":"https://github.com/zalkikar/mlm-bias/blob/HEAD/mlm_bias.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"37152278142c6d80"}},{"code_sha256_prefix":"a245f3af7d435fda","entry":"get_mask_combinations","repo":"zalkikar/mlm-bias","repo_kind":"listed","path":"mlm_bias/utils/experiments.py","file_url":"https://github.com/zalkikar/mlm-bias/blob/HEAD/mlm_bias/utils/experiments.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"a245f3af7d435fda"}},{"code_sha256_prefix":"0ccfc1bf4bfdb5d5","entry":"get_mlm_output","repo":"zalkikar/mlm-bias","repo_kind":"listed","path":"mlm_bias/utils/measures.py","file_url":"https://github.com/zalkikar/mlm-bias/blob/HEAD/mlm_bias/utils/measures.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"0ccfc1bf4bfdb5d5"}},{"code_sha256_prefix":"0363b6dd31fc8ff4","entry":"get_span","repo":"kanekomasahiro/evaluate_bias_in_mlm","repo_kind":"official","path":"evaluate.py","file_url":"https://github.com/kanekomasahiro/evaluate_bias_in_mlm/blob/HEAD/evaluate.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"0363b6dd31fc8ff4"}},{"code_sha256_prefix":"cc4093eaeb834ccc","entry":"get_span","repo":"zalkikar/mlm-bias","repo_kind":"listed","path":"mlm_bias/utils/experiments.py","file_url":"https://github.com/zalkikar/mlm-bias/blob/HEAD/mlm_bias/utils/experiments.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"cc4093eaeb834ccc"}},{"code_sha256_prefix":"997a7feea4d687b3","entry":"compute_crr_dp","repo":"zalkikar/mlm-bias","repo_kind":"listed","path":"mlm_bias/utils/measures.py","file_url":"https://github.com/zalkikar/mlm-bias/blob/HEAD/mlm_bias/utils/measures.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"997a7feea4d687b3"}},{"code_sha256_prefix":"f551e45c8801e149","entry":"compute_crr_dp_batched","repo":"zalkikar/mlm-bias","repo_kind":"listed","path":"mlm_bias/utils/measures.py","file_url":"https://github.com/zalkikar/mlm-bias/blob/HEAD/mlm_bias/utils/measures.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"f551e45c8801e149"}},{"code_sha256_prefix":"871a5830b1030f4a","entry":"get_rank_for_gold_token","repo":"kanekomasahiro/evaluate_bias_in_mlm","repo_kind":"official","path":"evaluate.py","file_url":"https://github.com/kanekomasahiro/evaluate_bias_in_mlm/blob/HEAD/evaluate.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"871a5830b1030f4a"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}