# What is Your Favorite Gender, MLM?
Gender Bias Evaluation in Multilingual Masked Language Models

Jeongrok Yu, Seong Ug Kim, Jacob Choi, Jinho D. Choi
Department of Computer Science
Emory University, Atlanta, GA
<EMAIL_ADDRESS>

###### Abstract

Bias is a disproportionate prejudice in favor of one side against another. Due
to the success of transformer-based Masked Language Models (MLMs) and their
impact on many NLP tasks, a systematic evaluation of bias in these models is
needed more than ever. While many studies have evaluated gender bias in
English MLMs, only a few works have been conducted for the task in other
languages. This paper proposes a multilingual approach to estimate gender bias
in MLMs from 5 languages: Chinese, English, German, Portuguese, and Spanish.
Unlike previous work, our approach does not depend on parallel corpora coupled
with English to detect gender bias in other languages using multilingual
lexicons. Moreover, a novel model-based method is presented to generate
sentence pairs for a more robust analysis of gender bias, compared to the
traditional lexicon-based method. For each language, both the lexicon-based
and model-based methods are applied to create two datasets respectively, which
are used to evaluate gender bias in an MLM specifically trained for that
language using one existing and 3 new scoring metrics. Our results show that
the previous approach is data-sensitive and not stable as it does not remove
contextual dependencies irrelevant to gender. In fact, the results often flip
when different scoring metrics are used on the same dataset, suggesting that
gender bias should be studied on a large dataset using multiple evaluation
metrics for best practice.

##  1 Introduction

The advent of transformer models Vaswani et al. (2017) and subsequent
development of contextualized embedding encoders Devlin et al. (2019); Liu et
al. (2019) have led to the widespread deployment of large language models for
crucial societal tasks Hartvigsen et al. (2022). However, the use of such
models has brought to light critical concerns regarding bias Bender and
Friedman (2018); Dixon et al. (2018); Hutchinson et al. (2020). Despite
efforts to enhance Masked Language Models (MLMs) Clark et al. (2020); Tan and
Bansal (2019), adapted to pre-train the transformers for language
understanding by predicting masked tokens from their context, the use of
sophisticated models and extensive datasets has intensified worries about bias
in MLMs.

The ubiquity of language models in society has sparked a growing interest in
detecting and mitigating their inherent biases. Detecting gender disparities
in language technologies has gained traction across multiple domains, as
evidenced by studies on identifying human-like biases in a transformer encoder
Kurita et al. (2019) and creating benchmarks for testing gender bias Zhao et
al. (2018a). These works have recognized undesirable biases from language
models, leading to more studies on revealing bias in embeddings Blodgett et
al. (2020). Indeed, language models can have bias issues that must be
addressed to ensure equitable and inclusive outcomes Bender et al. (2021); Sun
et al. (2019).

There has been pioneering work on evaluating gender bias in static word
embeddings using word analogies Bolukbasi et al. (2016), while the evaluation
of gender bias in contextualized word embeddings has largely focused on
monolingual models. Zhao et al. (2018b) analyzed word pairs to differentiate
which words contain gender information/bias. Liang et al. (2020) examined the
MLMs’ tendency to predict gendered pronouns associated with certain
occupations. There have also been innovative debiasing methods for MLMs, such
as re-balancing the corpus by switching bias attribute words Webster et al.
(2020) or using derivation to normalize sentence vectors from MLMs Bommasani
et al. (2020). Nonetheless, there remains a gap in research on gender bias in
multilingual MLMs, which has not been explored to the same extent. This
presents a crucial area for research to ensure that multilingual language
models are free from harmful biases.

This paper improves the gender bias evaluation in multilingual MLMs by
addressing the limitations of previous work. Section 3 identifies such
limitations and presents an enhanced method to generate sentence pairs for
gender bias evaluation in MLMs. Section 4 provides multilingual lexicons to
detect sentences with gendered words for four languages. Section 5 compares
the performance of our method to ones from existing methods. Finally, Section
6 shows that our method retains more data from the target corpus, and is more
consistent than the other methods in evaluating gender bias, especially when
the data is skewed in the gender distribution. Our main contributions are as
follows:111All our resources, including datasets and evaluation scripts, are
publicly available through our open source project:
https://github.com/anonymous.

  * •

We create multilingual gender lexicons to detect sentences with gendered words
in Chinese, English, German, Portuguese, and Spanish without relying on
parallel datasets, which enables us to extract more diverse sets of gendered
sentences and facilitate more robust evaluations.

  * •

We present two novel metrics and methods that provide a rigorous approach to
comparing multilingual MLMs and datasets. Our approach ensures meaningful and
fair comparisons, leading to more reliable and comprehensive assessments of
gender bias in multilingual MLMs.

##  2 Related Work

The issue of bias in large language models has garnered significant attention
in recent years, prompting several studies that aim to assess and address the
presence of bias in MLMs. Nangia et al. (2020) introduced CrowS-Pairs, a
dataset consisting of single sentences with masked attribute words, aiming to
assess potential social bias in terms of race, gender, and religion in MLMs.
Nadeem et al. (2021) adopted a similar approach by masking modified tokens to
measure bias. These studies were confinedto English, however, and lacked a
precise definition of the term “bias”, resulting in ambiguity and assumptions
about its meaning Blodgett et al. (2021).

Ahn and Oh (2021) introduced a novel approach to evaluating bias in MLMs using
pairs of sentences with varying degrees of masking. They proposed a new
metric, the Categorical Bias score, showing the variance of log-likelihood
interpreted as an effect size of the attribute word. In addition, they
analyzed ethnic bias across six languages, making an effort to generalize bias
evaluation. However, their method still required human-written sentences with
bias annotations, which is a limitation in terms of capturing the natural
usage of language and can be exploited when the model finds a simple loophole
around the set of rules Durmus et al. (2022). Our work requires minimal
annotation and is evaluated on a real dataset rather than a contrived one.

A few studies have attempted to evaluate bias in multilingual MLMs. Kaneko and
Bollegala (2022) assessed bias by utilizing a set of English words associated
with males and females and computing their likelihoods. Kaneko et al. (2022)
used a parallel corpus in English and eight other languages, where bias was
annotated solely in English, to evaluate gender bias in the target language
models. Our approach is distinguished in that it does not rely on a parallel
corpus, making it language-independent.

##  3 Methodology

Figure 1: An overview of the lexicon-based sentence extraction (Section 3.3).

###  3.1 Multilingual Bias Evaluation

Kaneko et al. (2022) proposed a Multilingual Bias Evaluation (MBE) score to
assess the gender bias in MLMs across many languages using a multilingual
corpus with English translations. To ensure a fair comparison with previous
work, we adopt the MBE score as our baseline, which employs a three-step
approach to detect potential gender bias.

First, MBE scans English sentences containing male or female nouns. These
nouns are identified using a set of gendered nouns from Bolukbasi et al.
(2016) and common first names from Nangia et al. (2020). MBE extracts the
corresponding sentence in the target language, under the premise that the
parallel sentence also contains gendered terms. The extracted sentences are
categorized into $\mathcal{T}_{f}$ and $\mathcal{T}_{m}$, representing sets of
female and male sentence.

For each sentence $S=[w_{1},..,w_{n}]\in(\mathcal{T}_{f}\cup\mathcal{T}_{m})$
where $w_{i}$ is the $i$’th token in $S$, MBE estimates its All Unmasked
Likelihood with Attention (AULA; Kaneko and Bollegala (2022)). Given all
tokens in $S$, except for $w_{i}$, and pre-trained parameters $\theta$, the
likelihood of an MLM predicting $w_{i}$ is measured by
$P_{\mathrm{MLM}}\left(w_{i}\mid S\backslash w_{i};\theta\right)$. AULA is
then computed by summing the log-likelihoods of all $w_{i}$ multiplied bythe
averages of the multi-head attention weights $\alpha_{i}$ associated with
$w_{i}$ as in Equation 1:

$A(S)=\frac{1}{|S|}\sum_{\forall{w_{i}\in S}}\alpha_{i}\cdot\log
P_{\mathrm{MLM}}\left(w_{i}\mid S\backslash w_{i};\theta\right)$ (1)

Thus, AULA estimates the relative importance of individual words in the
sentence by the MLM.

Finally, the MBE score is measured by comparing all sentences between $T_{f}$
and $T_{m}$ as in Equation 2:

$\frac{\displaystyle\sum_{\scriptscriptstyle{\forall
S_{m}\in\mathcal{T}_{m}}}\sum_{\scriptscriptstyle{\forall
S_{f}\in\mathcal{T}_{f}}}\gamma\left(S_{m},S_{f}\right)\cdot\mathbb{I}\left(S_{m},S_{f}\right)}{\displaystyle\sum_{\scriptscriptstyle{\forall
S_{m}\in\mathcal{T}_{m}}}\sum_{\forall\scriptscriptstyle{S_{f}\in\mathcal{T}_{f}}}\gamma\left(S_{m},S_{f}\right)}$
(2)

$\gamma(S_{f},S_{m})$ is the cosine similarity score between sentence
embeddings of $S_{f}$ and $S_{m}$. The indicator function
$\mathbb{I}(S_{m},S_{f})$ returns $1$ if
$A\left(S_{m}\right)>A\left(S_{f}\right)$; otherwise, $0$. Therefore, the MBE
score shows the percentage of male sentences that the MLM prefers over female
sentences in the parallel corpus.

###  3.2 Strict Bias Metric

A significant drawback of MBE is its potential lack of rigor in comparisons.
One key limitation lies in the use of AULA to calculate sentence
likelihoodsthat can lead to tokens unrelated to gendered words exerting undue
influence on the score. This is even more problematic when comparing AULAs for
sentences that are notably dissimilar.

To address unexpected measurement errors in evaluating MLM bias, we propose
the Strict Bias Metric (SBM), which solely compares likelihoods between
parallel sentences differ only by gendered words, minimizing potential
confounding factors. As the number of comparisons in AULAs decreases when
using SBM, it allows for a more focused and targeted analysis so that SBM
ensures a meaningful assessment by capturing the likelihood differences
incurred only by variations in gender words. The SBM score is measured as in
Equation 3:

$\frac{\sum_{(S_{m},S_{f})\in(\mathcal{T}_{m}\times\mathcal{T}_{f})}\mathbb{I}\left(S_{m},S_{f}\right)}{|\mathcal{T}_{m}|}$
(3)

Since SBM requires the identification of the specific gender words, we create
a multilingual lexicon that provides sets of gendered words in five languages
(Section 4.1). Moreover, since SBM needs sentence pairs differ only by gender
words, we present two methods, lexicon-based (Section 3.3) and model-based
(Section 3.4), to generate such sentence pairs using solely monolingual
datasets.

###  3.3 Lexicon-based Sentence Generation

The lexicon-based sentence generation (LSG) first identifies every sentence
containing a single gender word and constructs its counterpart by replacing
the gender word with its opposite gendered word provided in the lexicon
(Section 4.1). For the sentence, “The waitress came over”, LSG generates the
new sentence “The waiter came over” by replacing the gender word (Figure 1).
SBM is then computed between these two sentences, taking into account the
relative importance of those gender words.

Sentences containing multiple gender words are excluded in this approach
because it is ambiguous to identify them as either male- or female-gendered
sentences. For example, a sentence “The actor fell in love with the queen” is
considered neither a male nor female sentence because it contains words for
both genders and masking one of them for an MLM would make this sentence to be
the opposite gender.Including such sentences would undermine the reliability
of the SBM score. Thus, sentences of this nature are excluded from our
experiments to ensure the robustness of bias evaluation.

The corpus may have an imbalanced distribution of sentences with male and
female words that can result in a bias in the overall data representation. To
address this issue, we extract an equal number of male and female sentences
such that $|\mathcal{T}_{m}|=|\mathcal{T}_{f}|$. It is worth mentioning that
we tried to discard sentences exhibiting strong contextual biases towards a
specific gender from our evaluation set (e.g., The princess gave birth to
twins), as they may introduce inherent biases and compromise the results.

###  3.4 Model-based Sentence Generation

Figure 2 describes an overview of our model-based sentence generation (MSG).
Similar to LSG, it begins by collecting sentences with only one gender word.
It then masks the gender word in each sentence and employs an MLM to predict
the most likely male and female words based on the context (e.g., the first
row in Figure 2). This enables MSG to select the most probable gender words
for every sentence by MLM’s predictions, ensuring that the comparisons are
conducted on model-derived sentence pairs.

Figure 2: An overview of the model-based sentence extraction (Section 3.4)
using the examples in Figure 1.

In theory, MSG can always generate both male and female words for any masked
word by taking words from the corresponding gender sets whose MLM scores are
the highest among the others in the sets. However, in practice, MSG may fail
to generate the sentence pair because the MLM does not predict “meaningful”
gender words with high confidence. In this case, MSG adapts LSG to handle the
missing sentence. For the second row example in Figure 2, the MLM effectively
predicts the female word ‘She’ but does not predict any male word with high
confidence, in which case, it takes the opposite gendered word ‘He’ as its
lexicon-based counterpart. On the other hand, sentences for which the MLM
fails to predict both male or female words with high scores are discarded.
Once all sentence pairs are created, SBM is applied to assess potential bias
in the MLM towards any particular gender.

For our experiments, a threshold of $0.01$ is used to determine whether MLM’s
prediction confidence is high or not. This threshold is observed by manual
inspection of MLM predictions in five languages. In addition, we use the
threshold to configure the top-$k$ reliable predictions for MLMs. To determine
the optimal value for $k$, an iterative analysis is conducted with $k$ ranging
from 1 to 15, assessing how many predictions above the threshold are covered
by the top $k$ predictions. Our findings indicate that $k=10$ is the optimal
choice, as the convergence rate of the model exhibits only marginal changes
beyond this cutoff point (Figure 3).

Figure 3: The proportions of sentences containing gender words whose
confidence scores are higher than the threshold $0.01$ covered by the
$k=[1,15]$ predictions.

###  3.5 Direct Comparison Bias Metric

SBM quantifies the extent to which MLMs prefer to predict male words over
female words given the neutral context. Since MLMs provide confidence scores
for the predicted words, it is also possible to make word-level comparisons.
Thus, we propose the Direct Comparison Bias Metric (DBM) that compares the
scores of the predicted gender words for every (predictable) sentence.

Given a sentence containing one gender word, an MLM is employed to predict
male and female words. If the scores for both male and female word predictions
are below the threshold (Section 3.4), the sentence is excluded as the
comparison, in this case, is not meaningful. Then, DBM is measured by
replacing the indicator function $\mathbb{I}(S_{m},S_{f})$ in Eq. 3 with
$\mathbb{I}_{d}(w_{m},w_{f})$, where $w_{m}\in S_{m}$ is the predicted male
word and $w_{f}\in S_{f}$ is the predicted female word. $\mathbb{I}_{d}$
returns $1$ if the MLM’s prediction score of $w_{m}$ is higher than that of
$w_{f}$; otherwise, $0$.

##  4 Data Preparation

###  4.1 Multilingual Gender Lexicon

We leverage the male and female word list provided by Bolukbasi et al. (2016)
to construct our English gender word set. This set consists of pairs of words
with each gender word having its counterpart of the opposite gender, which
makes it suitable for LSG (§3.3) and MSG (§3.4). Unlike Kaneko et al. (2022),
we exclude common first names from the CrowS-Pairs dataset Nangia et al.
(2020) when making our lexicon. This is done to avoid potential issues related
to transliteration during name translation, which can lead to MLMs treating
the first names as phonetically similar words in the target language.

Our Multilingual Gender Lexicon (MGL) is compiled by translating gender words
in the English set using automatic systems, such as Bing222Microsoft Bing
Translator: https://www.bing.com/translator, DeepL333DeepL Translate:
https://www.deepl.com/translator, and Google444Google Translate:
https://translate.google.com, into the following eight languages: Arabic,
Chinese, German, Indonesian, Japanese, Portuguese, Russian, and Spanish. The
automatic translations are carefully evaluated by three native speakers of
each language. If the majority of the reviewers find a translation to be
unnatural or gender-neutral, both the translation and its counterpart
areexcluded from MGL. For example, a pronoun ‘sie’ in German has two meanings:
‘she’ and ‘you’ (honorific). Although ‘sie’ commonly refers to a female, it
was removed from our lexicon to leave no room for ambiguity regarding its
connotation of gender information. This meticulous process ensures that MGL
contains accurate and natural translations of only gendered words in each
language.

###  4.2 MGL Validation

The coverage of MGL is assessed by comparing the words in parallel sentences
extracted from the TED corpus (2020 v1; Reimers and Gurevych
(2020)).555TED2020 v1: https://opus.nlpl.eu/TED2020.php The TED corpus
consists of about 4,000 TED talks that comprise a total of 427,436 English
sentences. Many of the English sentences have been translated into 100+
languages by certified translators.

For the validation, a set $\mathcal{E}_{r}$ of 11,000 English sentences are
randomly sampled from the TED corpus. The sentences in $\mathcal{E}_{r}$ are
checked against the English gender word set (Section 4.1) to create another
set $\mathcal{E}_{g}$ of English gendered sentences. Next, for every target
language $\ell$, a set $\mathcal{G}^{\ell}$ is created by finding $\ell$’s
translations of the sentences in $\mathcal{E}_{g}$ from the corpus. Not all
sentences in $\mathcal{E}_{g}$ may come with translations such that
$|\mathcal{G}^{\ell}|\leq|\mathcal{E}_{g}|$. Finally, a new set
$\mathcal{G}^{\ell}_{g}$ of gendered sentences is created where each sentence
in $\mathcal{G}^{\ell}_{g}$ includes the translated gender word according to
the target-language gender word (Section 4.1). Table 1 illustrates the results
from this validation, including the coverage percentages of MGL for the eight
target languages.

MGL’s coverage rates in gender words are below $0.5$ for the following four
languages: Indonesian, Russian, Japanese and Arabic. Many gender words in
English are translated into gender-neutral words in Indonesian because it
would sound unnatural to use gender-specific translations Dwiastuti (2019).
Both Russian and Arabic are morphologically-rich languages with extensive
inflectional/derivational systems Al-Haj and Lavie (2010); Rozovskaya and Roth
(2019), which contribute to their low coverage rates. Japanese is a pro-drop
langauge allowing the omission of the subject in a sentence, which makes
identifying gender words challenging because the subject pronouns, such as
‘he’ and ‘she’, are often dropped in natural discourse.

Language | $\bm{|\mathcal{G}^{\ell}|}$ | $\bm{|\mathcal{G}^{\ell}_{g}|}$ | Coverage (%)
---|---|---|---
German | 1,226 | 1,124 | 91.7
Spanish | 1,380 | 1,125 | 81.5
Portuguese | 1,206 | 928 | 76.9
Chinese | 1,325 | 997 | 75.2
Indonesian | 671 | 312 | 46.5
Russian | 1,289 | 583 | 45.2
Japanese | 1,288 | 466 | 36.6
Arabic | 1,327 | 252 | 19.0
Table 1: The coverage rates of sentences containing gender words from MGL
across the eight target languages.

It is important to note that the assumption made by Kaneko et al. (2022) that
the gender information in an English sentence containing a gender word is
retained in parallel sentences in the target languages, even if the
corresponding gender words do not exist in the parallel sentences, may not
hold true for certain languages mentioned above (e.g., Indonesian, Japanese).
Thus, our bias evaluation uses only languages with high coverage rates:
English, German, Spanish, Portuguese, and Chinese.

###  4.3 Sentence Pair Generation

Two sets of sentence pairs are created to evaluate gender bias of MLMs, one
using LSG and the other using MSG, in English as well as the top-4 languages
in Table 1, all of which contain sufficient numbers of gendered words
available in MGL. For our experiments, BERT-based language-specific
transformer encoders are used for English Devlin et al. (2019), German Chan et
al. (2020), Spanish Cañete et al. (2020), Portuguese Souza et al. (2020), and
Chinese Cui et al. (2020). The statistics of these datasets in comparison to
the one used by Kaneko et al. (2022) are presented in Table 2.

Language | Kanekoorg | Kanekoall | LSG | MSG | Total
---|---|---|---|---|---
English | — | 39,040 | 25,993 | 28,112 | 34,970
Chinese | 6,800 | 36,270 | 22,196 | 22,616 | 30,547
German | 4,700 | 26,639 | 32,436 | 29,667 | 33,154
Portuguese | 5,700 | 29,975 | 24,608 | 31,670 | 36,072
Spanish | 7,100 | 37,808 | 76,972 | 96,995 | 114,168
Table 2: The statistics of gender bias evaluation datasets. Kanekoorg: # of
gendered sentences used by Kaneko et al. (2022). Kanekoall: # of all gendered
sentences extracted from the TED corpus utilizing the same method as in Kaneko
et al. (2022). Note that the previous work used only a subset of Kanekoall for
their evaluations. LSG & MSG:# of sentence pairs generated by lexicon-based
(§3.3) and model-based (§3.4) methods, respectively; the numbers in these
columns should be doubled for a fair comparison with the numbers in Kaneko∗.
Total: # of all extracted sentences from the TED corpus by using MGL (before
discarding any sentences for balancing).

All sentences consisting of single gender words are extracted from the TED
corpus by leveraging MGL. For LSG, an equal number of male and female
sentences are extracted for the creation of each dataset in Table 2 to
minimize potential contextual bias that arises from imbalanced distributions
between male and female sentences (Section 3.3). However, this constrains the
extracted sentences to the size of the smaller gender category. For example,
if there exist 100 male sentences but only 50 female sentences,half of the
male sentences are discarded to match the number of female sentences.
Consequently, the total number of extracted sentences becomes 100, not 150. In
this case, even if there is contextual bias present in those sentences, the
balanced number of sentences ensures that it does not significantly affect the
overall evaluation results.

Language | Both | One | None
---|---|---|---
English | 63.8% | 16.6% | 19.6%
Chinese | 59.1% | 14.9% | 26.0%
Spanish | 51.9% | 33.1% | 15.0%
Portuguese | 43.0% | 44.8% | 12.2%
German | 30.7% | 58.8% | 10.5%
Table 3: The proportions of sentences extracted using MGL, for which MSG
generates sentences for both genders, one gender, and none.

For MSG, on the other hand, the MLM generates both male and female sentences
for the majority of extracted sentences. Even with input that the MLM
generates only one gender sentences, the ratio between male and female
sentences produced by MSG is often more balanced than that of LSG. For the
previous example where 150 sentences are extracted (100 male and 50 female),
assume that the MLM generates both male and female sentences for 60, only male
sentences for 40, only female sentences for 30, and no sentences for 20. MSG
discards the 20 no-generated sentences and 10 (out of the 40) male-only
sentences, so its count matches to the one for the female-only sentences,
resulting in a retention of 120 sentences, where the ratio between male
andfemale sentences is even. Table 3 shows the proportions among the extracted
sentences MSG generates for both genders, one gender, and none.

For languages such as German, Portuguese, and Spanish, it is important to
ensure grammatical correctness in the sentences generated by LSG and MSG. It
is because these languages have gendered articles, adjectives, demonstratives,
possessives, and attributive pronouns that need to agree with the genders of
the generated words. For German, 19.85% of the extracted sentences contain
such gendered components. To address this, we add mappings between gender
words and their dependent gendered components to MGL for those languages. We
then use the mappings to replace gendered components in the generated
sentences accordingly. For example, in a German sentence “ein guter Mann” (a
good man), when Mann (man) is replaced with Frau (woman), the article ein is
also replaced with eine using the mapping provided in MGL. This ensures that
the generated sentences maintain agreement between gender words and their
associated components.

##  5 Experiments

We utilize the TED parallel corpus (Section 4.2) to build a comprehensive
corpus for the evaluation of gender bias in the transformer-based multilingual
language models (Section 4.3). For evaluation, the transformer implementation
of Wolf et al. (2020) is employed. All experiments are conducted on an Apple
M1-Pro Chip with a 14-core GPU. The entire evaluation process, which includes
processing all sentence pairs in every language, is completed in about two
hours with efficient performance.

Language | Kanekoorg | Kanekoall | LSG | MSG | DBM | Male / Female (Ratio)
---|---|---|---|---|---|---
English | — | 52.07 ($\pm$1.34) | 50.39 ($\pm$0.28) | 45.49 | 75.18 | 62.83 / 37.17 (1.69:1)
Chinese | 52.86 | 46.67 ($\pm$0.55) | 46.42 ($\pm$0.68) | 53.15 | 89.62 | 63.67 / 36.33 (1.75:1)
German | 54.69 | 45.78 ($\pm$1.72) | 52.31 ($\pm$0.64) | 55.43 | 44.72 | 48.92 / 51.08 (0.96:1)
Portuguese | 53.07 | 46.70 ($\pm$0.81) | 51.77 ($\pm$0.44) | 61.04 | 73.36 | 65.89 / 34.11 (1.93:1)
Spanish | 51.44 | 48.52 ($\pm$1.04) | 41.68 ($\pm$0.76) | 50.74 | 72.34 | 66.29 / 33.71 (1.97:1)
Table 4: Left Group: Multilingual Bias Evaluation (MBE) scores evaluated on
the sub-sampled sentences (Kanekoorg) and all sentences in the TED corpus
(Kanekoall; $\pm$: standard deviation). Middle Group: The Strict Bias Metric
(SBM) scores achieved by LSG and MSG, as well as the Direct Comparison Bias
Metrics (DBM) scores obtained by MSG. Right Group: The distributions of (and
the ratios between) male and female sentences in the TED corpus (in %).

###  5.1 Multilingual Bias Evaluation on Kaneko∗

Upon replicating Kaneko et al. (2022), we observe that the previous study
utilized only $\approx$25% of the sentences in the TED corpus (Table 2). For a
more reliable evaluation, we reconstruct these datasets by following their
methods using all sentences in the corpus, and compute the MBE scores (Section
3.1). Table 4 shows the results from Kaneko et al. (2022) (Kanekoorg), as well
as the results evaluated on our reconstructed datasets (Kanekoall).666The
evaluation on Kanekoall is conducted in five-folds, similar to LSG, for the
same reason as explained in Section 5.2.

Surprisingly, while the English MLM shows bias towards male terms in
Kanekoall, MLMs in all the other four languages exhibit bias towards female
terms, which contradicts the findings in Kanekoorg. The discrepancy between
the results obtained from Kanekoorg and Kanekoall highlights the limitations
of working with smaller datasets.

###  5.2 Strict Bias Metric for LSG and MSG

To assess gender bias using LSG, for each language, we create five folds of
evaluation datasets by randomly truncating the larger gender set (Section
4.3), while keeping the sentences in the smaller gender set unchanged across
all folds. Hence, sentences in the larger gender set vary across the different
folds. Table 4 presents the SBM scores (Section 3.2) of this evaluation for
the five languages. Our results reveal that English, German, and Portuguese
MLMs are biased towards males, with the scores greater than 0.5. In contrast,
Chinese and Spanish MLMs depict a bias towards females. These trends are
consistent across all five evaluation folds; thus reinforcing the reliability
of our findings.

For MSG, the SBM scores are also used to assess gender bias. Unlike LSG, only
a small portion of the larger gender sets get truncated using this method;
thus, we create a single fold for the MSG evaluation. Our results show that
the English MLM has a bias towards females, although the other MLMs show a
bias towards males. Interestingly, the findings from LSG and MSG disagree in
terms of the bias directions for English, Chinese, and Spanish. Several
factors may attribute to this, such as differences in the pretrained MLMs or
characteristics of the languages, which we will explore in the future.

###  5.3 Direct Comparison Bias Metric for MSG

Finally, we assess gender bias using the DBM metric (Section 3.5) on the MSG
datasets. The scores obtained by this metric are considerably more extremethan
those from MBE and SBM. Notice that the DBM scores align with the gender
distributions shown inthe TED corpus (Table 4), implying that using DBM to
evaluate gender bias of MLMs on a corpus with a significant gender imbalance
can lead to unreliableresults, although they are suitable for quantifying the
bias in the evaluation corpus itself.

##  6 Analysis

###  6.1 Performance Analysis

The discrepancy in results between Kanekoorg and Kanekoall, as discussed in
Section 4.1, is attributed to the subsampling strategy, which is employed to
balance the number of male and female sentences for a more robust evaluation.
Ironically, it resulted in a less stable evaluation because there is no
guarantee that a randomly selected set of sentences from the larger gender set
would exhibit similar bias as another randomly selected set from the same
group. This issue becomes more challenging when the size of the subsampled set
is significantly smaller than the original gender set. Thus, minimizing the
size gap between the selected set and the original set is crucial for
conducting a robust bias evaluation.

It is worth noting that the standard deviations of the SBM scores from LSG are
noticeably smaller than those of Kanekoall in Table 4, except for Chinese.This
variance can be problematic when the score isclose to the threshold of 50,
potentially resulting in a contradictory finding. In this regard, MSG has an
advantage over MBE and LSG as it generally discards significantly fewer
sentences compared to the other two methods (Table 5) by generating new
sentences for both genders, offering a more stable method for evaluating
gender bias.

Lang | MBE | LSG | MSG
---|---|---|---
English | 31.98 | 25.67 | 19.60
Chinese | 32.13 | 27.34 | 25.96
German | 35.35 | 2.17 | 10.51
Portuguese | 30.90 | 31.78 | 12.20
Spanish | 31.99 | 32.58 | 15.04
Table 5: The percentages of the discarded sentences for balancing both
genders. MSG discards a significantly smaller number of sentences compared to
the other two methods, except for German where LSG shows the least amount of
truncation.

While MSG provides a more consistent evaluation with a lower truncation rate
compared to the other methods, it may end up producing less diversity ingender
words than LSG. Figure 4 shows that LSG extracts sentences with a greater
number of unique gender words across the five languages than MSG. The
proportion of unique gender words used to fill the [Mask] does not exceed 50%
for all languages except for Chinese, where the MLM fills over 18,000
sentences using only 12 male and 4 female words. By incorporating a diverse
set of vocabulary from one-gender predictions obtained using LSG, MSG can
quantify the bias in MLMs even in sentences they are not inclined to generate.

Figure 4: The numbers of gender word types generated by LSG and MSG. MSG:
One|Both: the number of gender word types where MSG generates for only one
gender or both genders, respectively.

###  6.2 Discussion

One major limitation of our evaluation framework is its restriction to the
selected five languages. To extend the applicability of LSG % MSG to
additional languages, further enhancements can be made to MGL by leveraging a
verified parallel corpus and a word alignment tool. While the proposed methods
have effectively extract gendered sentences based on the lexicons, it is worth
noting that gender can also be conveyed through other linguistic features.
This highlights the importance of conducting in-depth morphological analysis
in languages where gender is grammatically encoded in articles, verbs,
adjectives, etc. Another limitation is that our evaluation of gender bias has
been conducted only on language-specific models. Exploring gender bias in
different languages using cross-lingual language models could yield
interesting findings compared to the language-specific models.

MGL opens up opportunities for future research to assess gender bias in a wide
range of MLMs beyond those investigated in this study. Moreover, evaluating
gender bias in any corpus becomes feasible, as it is not limited to a parallel
corpus. Rather than examining MLM gender bias solely through translations from
a parallel corpus, using a corpus in the language of interest can lead to more
meaningful results. This study also raises the question of whether the length
of sentences in language models impacts the gender bias scores, suggesting
further investigation for a conclusive answer.

##  7 Conclusion

This paper presents robust methods for evaluating gender bias in masked
language models across fivelanguages: English, Chinese, German, Portuguese,
and Spanish. Using our multilingual gender lexicon (MGL), three evaluation
metrics: multilingual bias evaluation (MBE), strict bias metric (SBM), and
direct comparison bias metric (DBM), and two sample generation methods:
lexicon-based (LSG) and model-based (MSG), a comprehensive analysis is
conducted, revealing that MSG is the most generalizable and consistent method.

As bias evaluation is a rapidly evolving field with the emergence of new
methods and metrics, we emphasize the importance of a collaborative effort
from diverse perspectives to advance this research. To establish an unbiased
bias evaluation system, it is essential to approach it from multiple angles.
We hope that our work contributes to ongoing endeavors aimed at addressing
gender bias and serves as an inspiration for further exploration in this
critical area of research.

## References

  * Ahn and Oh (2021) Jaimeen Ahn and Alice Oh. 2021.  Mitigating language-dependent ethnic bias in BERT.  In _Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing_ , pages 533–549, Online and Punta Cana, Dominican Republic. Association for Computational Linguistics.
  * Al-Haj and Lavie (2010) Hassan Al-Haj and Alon Lavie. 2010.  The impact of Arabic morphological segmentation on broad-coverage English-to-Arabic statistical machine translation.  In _Proceedings of the 9th Conference of the Association for Machine Translation in the Americas: Research Papers_ , Denver, Colorado, USA. Association for Machine Translation in the Americas.
  * Bender and Friedman (2018) Emily M. Bender and Batya Friedman. 2018.  Data statements for natural language processing: Toward mitigating system bias and enabling better science.  _Transactions of the Association for Computational Linguistics_ , 6:587–604.
  * Bender et al. (2021) Emily M. Bender, Timnit Gebru, Angelina McMillan-Major, and Shmargaret Shmitchell. 2021.  On the dangers of stochastic parrots: Can language models be too big? In _Proceedings of the 2021 ACM Conference on Fairness, Accountability, and Transparency_ , FAccT ’21, page 610–623, New York, NY, USA. Association for Computing Machinery.
  * Blodgett et al. (2020) Su Lin Blodgett, Solon Barocas, Hal Daumé III, and Hanna Wallach. 2020.  Language (technology) is power: A critical survey of “bias” in NLP.  In _Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics_ , pages 5454–5476, Online. Association for Computational Linguistics.
  * Blodgett et al. (2021) Su Lin Blodgett, Gilsinia Lopez, Alexandra Olteanu, Robert Sim, and Hanna Wallach. 2021.  Stereotyping Norwegian salmon: An inventory of pitfalls in fairness benchmark datasets.  In _Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers)_ , pages 1004–1015, Online. Association for Computational Linguistics.
  * Bolukbasi et al. (2016) Tolga Bolukbasi, Kai-Wei Chang, James Zou, Venkatesh Saligrama, and Adam Kalai. 2016\.  Man is to computer programmer as woman is to homemaker? debiasing word embeddings.  In _NeurIPS_.
  * Bommasani et al. (2020) Rishi Bommasani, Kelly Davis, and Claire Cardie. 2020.  Interpreting Pretrained Contextualized Representations via Reductions to Static Embeddings.  In _Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics_ , pages 4758–4781, Online. Association for Computational Linguistics.
  * Cañete et al. (2020) José Cañete, Gabriel Chaperon, Rodrigo Fuentes, Jou-Hui Ho, Hojin Kang, and Jorge Pérez. 2020.  Spanish pre-trained bert model and evaluation data.  In _PML4DC at ICLR 2020_.
  * Chan et al. (2020) Branden Chan, Stefan Schweter, and Timo Möller. 2020.  German’s next language model.  In _Proceedings of the 28th International Conference on Computational Linguistics_ , pages 6788–6796, Barcelona, Spain (Online). International Committee on Computational Linguistics.
  * Clark et al. (2020) Kevin Clark, Minh-Thang Luong, Quoc V. Le, and Christopher D. Manning. 2020.  Electra: Pre-training text encoders as discriminators rather than generators.  In _International Conference on Learning Representations_.
  * Cui et al. (2020) Yiming Cui, Wanxiang Che, Ting Liu, Bing Qin, Shijin Wang, and Guoping Hu. 2020\.  Revisiting pre-trained models for Chinese natural language processing.  In _Findings of the Association for Computational Linguistics: EMNLP 2020_ , pages 657–668, Online. Association for Computational Linguistics.
  * Devlin et al. (2019) Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019.  BERT: Pre-training of deep bidirectional transformers for language understanding.  In _Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers)_ , pages 4171–4186, Minneapolis, Minnesota. Association for Computational Linguistics.
  * Dixon et al. (2018) Lucas Dixon, John Li, Jeffrey Sorensen, and Lucy Vasserman Thain, Nithum. 2018.  Measuring and Mitigating Unintended Bias in Text Classification.  In _Proceedings of the 2018 AAAI/ACM Conference on AI, Ethics, and Society_ , pages 67–73.
  * Durmus et al. (2022) Esin Durmus, Faisal Ladhak, and Tatsunori Hashimoto. 2022.  Spurious correlations in reference-free evaluation of text generation.  In _Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)_ , pages 1443–1454, Dublin, Ireland. Association for Computational Linguistics.
  * Dwiastuti (2019) Meisyarah Dwiastuti. 2019.  English-Indonesian neural machine translation for spoken language domains.  In _Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics: Student Research Workshop_ , pages 309–314, Florence, Italy. Association for Computational Linguistics.
  * Hartvigsen et al. (2022) Thomas Hartvigsen, Saadia Gabriel, Hamid Palangi, Maarten Sap, Dipankar Ray, and Ece Kamar. 2022.  Toxigen: A large-scale machine-generated dataset for adversarial and implicit hate speech detection.  In _ACL 2022_.
  * Hutchinson et al. (2020) Ben Hutchinson, Vinodkumar Prabhakaran, Emily Denton, Kellie Webster, Yu Zhong, and Stephen Denuyl. 2020.  Social biases in NLP models as barriers for persons with disabilities.  In _Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics_ , pages 5491–5501, Online. Association for Computational Linguistics.
  * Kaneko and Bollegala (2022) Masahiro Kaneko and Danushka Bollegala. 2022.  Unmasking the Mask \- Evaluating Social Biases in Masked Language Models.  In _Proc. of the 36st AAAI Conference on Artificial Intelligence_ , pages 11954–11962.
  * Kaneko et al. (2022) Masahiro Kaneko, Aizhan Imankulova, Danushka Bollegala, and Naoaki Okazaki. 2022\.  Gender bias in masked language models for multiple languages.  In _Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies_ , pages 2740–2750, Seattle, United States. Association for Computational Linguistics.
  * Kurita et al. (2019) Keita Kurita, Nidhi Vyas, Ayush Pareek, Alan W Black, and Yulia Tsvetkov. 2019.  Measuring bias in contextualized word representations.  In _Proceedings of the First Workshop on Gender Bias in Natural Language Processing_ , pages 166–172, Florence, Italy. Association for Computational Linguistics.
  * Liang et al. (2020) Sheng Liang, Philipp Dufter, and Hinrich Schütze. 2020.  Monolingual and multilingual reduction of gender bias in contextualized representations.  In _Proceedings of the 28th International Conference on Computational Linguistics_ , pages 5082–5093, Barcelona, Spain (Online). International Committee on Computational Linguistics.
  * Liu et al. (2019) Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019.  Roberta: A robustly optimized BERT pretraining approach.  _CoRR_ , abs/1907.11692.
  * Nadeem et al. (2021) Moin Nadeem, Anna Bethke, and Siva Reddy. 2021.  StereoSet: Measuring stereotypical bias in pretrained language models.  In _Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers)_ , pages 5356–5371, Online. Association for Computational Linguistics.
  * Nangia et al. (2020) Nikita Nangia, Clara Vania, Rasika Bhalerao, and Samuel R. Bowman. 2020.  CrowS-pairs: A challenge dataset for measuring social biases in masked language models.  In _Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP)_ , pages 1953–1967, Online. Association for Computational Linguistics.
  * Reimers and Gurevych (2020) Nils Reimers and Iryna Gurevych. 2020.  Making monolingual sentence embeddings multilingual using knowledge distillation.  In _Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing_. Association for Computational Linguistics.
  * Rozovskaya and Roth (2019) Alla Rozovskaya and Dan Roth. 2019.  Grammar error correction in morphologically rich languages: The case of Russian.  _Transactions of the Association for Computational Linguistics_ , 7:1–17.
  * Souza et al. (2020) Fabio Souza, Rodrigo Nogueira, and Roberto Lotufo. 2020.  Bertimbau: Pretrained bert models for brazilian portuguese.  In _Intelligent Systems: 9th Brazilian Conference, BRACIS 2020, Rio Grande, Brazil, October 20–23, 2020, Proceedings, Part I_ , page 403–417, Berlin, Heidelberg. Springer-Verlag.
  * Sun et al. (2019) Tony Sun, Andrew Gaut, Shirlyn Tang, Yuxin Huang, Mai ElSherief, Jieyu Zhao, Diba Mirza, Elizabeth Belding, Kai-Wei Chang, and William Yang Wang. 2019.  Mitigating gender bias in natural language processing: Literature review.  In _Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics_ , pages 1630–1640, Florence, Italy. Association for Computational Linguistics.
  * Tan and Bansal (2019) Hao Tan and Mohit Bansal. 2019.  LXMERT: Learning cross-modality encoder representations from transformers.  In _Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP)_ , pages 5100–5111, Hong Kong, China. Association for Computational Linguistics.
  * Vaswani et al. (2017) Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017.  Attention is all you need.
  * Webster et al. (2020) Kellie Webster, Xuezhi Wang, Ian Tenney, Alex Beutel, Emily Pitler, Ellie Pavlick, Jilin Chen, and Slav Petrov. 2020.  Measuring and reducing gendered correlations in pre-trained models.
  * Wolf et al. (2020) Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Remi Louf, Morgan Funtowicz, Joe Davison, Sam Shleifer, Patrick von Platen, Clara Ma, Yacine Jernite, Julien Plu, Canwen Xu, Teven Le Scao, Sylvain Gugger, Mariama Drame, Quentin Lhoest, and Alexander Rush. 2020.  Transformers: State-of-the-art natural language processing.  In _Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations_ , pages 38–45, Online. Association for Computational Linguistics.
  * Zhao et al. (2018a) Jieyu Zhao, Tianlu Wang, Mark Yatskar, Vicente Ordonez, and Kai-Wei Chang. 2018a.  Gender bias in coreference resolution: Evaluation and debiasing methods.  In _Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 2 (Short Papers)_ , pages 15–20, New Orleans, Louisiana. Association for Computational Linguistics.
  * Zhao et al. (2018b) Jieyu Zhao, Yichao Zhou, Zeyu Li, Wei Wang, and Kai-Wei Chang. 2018b.  Learning gender-neutral word embeddings.  In _Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing_ , pages 4847–4853, Brussels, Belgium. Association for Computational Linguistics.


# Fault Awareness in the MPI 4.0 Session Model

Roberto Rocco  0000-0002-0223-2900 Dipartimento di Elettronica, Informazione e
Bionigegneria Politecnico di MilanoVia Giuseppe Ponzio, 34MilanItaly
<EMAIL_ADDRESS>,  Gianluca Palermo  Dipartimento di Elettronica,
Informazione e Bionigegneria Politecnico di MilanoVia Giuseppe Ponzio,
34MilanItaly<EMAIL_ADDRESS>and  Daniele Gregori  E4 Computer
Engineering SpaViale Martiri della Libertà, 66Scandiano (RE)Italy
<EMAIL_ADDRESS>
(2023)

###### Abstract.

The latest version of MPI introduces new functionalities like the Session
model, but it still lacks fault management mechanisms. Past efforts produced
tools and MPI standard extensions to manage fault presence, including ULFM.
These measures are effective against faults but do not fully support the new
additions to the standard. In this paper, we combine the fault management
possibilities of ULFM with the new Session model functionality introduced in
version 4.0 of the standard. We focus on the communicator creation procedure,
highlighting criticalities and proposing a method to circumvent them. The
experimental campaign shows that the proposed solution does not significantly
affect applications’ execution time and scalability while better managing the
insurgence of faults.

HPC, MPI Sessions, ULFM, Fault Tolerance

††copyright: acmcopyright††journalyear: 2023††doi:
XXXXXXX.XXXXXXX††conference: ACM International Conference on Computing
Frontiers ; May 09–11, 2023; Bologna, IT††price: 15.00††isbn:
978-1-4503-XXXX-X/18/06††ccs: Computing methodologies Parallel computing
methodologies††ccs: Computer systems organization Reliability

##  1\. Introduction

The increase in computation capabilities is leading the innovation in the
High-Performance Computing (HPC) field. The future (and present) exascale
clusters introduce new challenges for application developers, system
management and framework designers, making even consolidated tools for the HPC
field evolve. One of these tools is the Message Passing Interface (MPI), the
de-facto standard for inter-process communication. With its latest version
(v4.0) (Message Passing Interface Forum, 2021), the MPI standard introduces
functionalities that impact how the application approaches communication. The
new Session model (Holmes et al., 2016) enables communication initialisation
in multiple independent instances, achieving decoupling across different
application modules. It also avoids the creation of a global communicator when
unneeded, which can bring savings in terms of synchronisation and
initialisation overhead.

The higher number of nodes involved in the execution also makes fault
occurrence more frequent. The MPI standard, however, does not specify the
application behaviour after a fault manifests. Many efforts proposed tools to
introduce fault management techniques inside MPI applications, with the User
Level Fault Mitigation (ULFM) extension (Bland et al., 2013) the one currently
receiving the most attention. It proposes a set of additional functionalities
to repair the communicators involved with the fault. The ULFM extension
targets the classical initialisation model, but its approach can also benefit
applications using the Session model.

In this work, we further analyse ULFM usage in applications employing the
Session model. We show the limitations and criticalities of a naive approach
and propose the Horizon set usage, which maintains the benefits of the
Sessions model while achieving fault support. The experimental campaign proved
that our solution does not compromise the scalability and performance of the
application while correctly managing faults.

The paper is structured as follows: Section 2 explains the fundamental
concepts of the Session model and ULFM extension alongside the previous work;
Section 3 explores the fault impact on the initialisation phase for both
models; Section 4 discusses our approach to the problem; and Section 5 shows
the experimental campaign that validates our solution. Lastly, Section 6
concludes the paper.

##  2\. Background

In this section, we discuss the main concepts and works that influence this
effort. We cover the MPI Session model basics in Section 2.1, the fundamental
ULFM principles in Section 2.2, and the previous work in Section 2.3.

###  2.1. The MPI Session model

The main driver behind the Session model introduction is the communication
isolation between different application modules. The problem with the
classical MPI approach (the World model) resides in the uniqueness of the
initialisation call. If many application components, modules or threads want
to use MPI functionalities, they have to coordinate such that only one calls
the MPI_Init function, compromising the isolation between the parts. On the
other hand, the Session model allows each component, module or thread to
initialise and manage its communication independently from the others. This
possibility allows for modularity inside the software and reduces the
coordination need, making the Session approach more scalable and better
fitting the exascale scenario.

While the World model initialisation process happens entirely through the
MPI_Init call, the Session model requires a more complex procedure. Figure 1
summarises the Session model creation flow. Most of the functions are local
and thus require no communication, except for the MPI_Comm_create_from_group
call, which needs participation from all the processes part of the future
communicator. After the communicator generation, the application operates
analogously to the World model.

Figure 1. The Session model execution flow, from the Session creation to the
communicator generation. Boxes in orange represent local operations, the ones
in green the produced handles, and the ones in blue functions that require
synchronisation.

###  2.2. The User Level Fault Mitigation extension

The MPI standard does not specify the execution behaviour after the incurrence
of a fault, practically precluding any fault management technique. Many
efforts proposed solutions to circumvent this limitation, with ULFM (Bland et
al., 2013) being the one currently receiving the most attention. It is an MPI
standard extension that allows the execution to continue even if a process
stops working and introduces calls to propagate faults, remove them and reach
an agreement even in a faulty scenario (with the revoke, shrink and agree
functions respectively). However, faults can impact the execution’s
correctness, requiring additional recovery techniques.

ULFM considers faults as an abrupt and unplanned termination of computation.
Other fault types, like silent data corruption and timing errors, usually
require ad-hoc measures and are thus excluded from the ULFM analysis.
Moreover, ULFM does not provide any recovery mechanism, expecting application
developers to choose it depending on their needs.

The ULFM fault management features apply from communicator creation to its
destruction. This assumption makes the ULFM approach viable in the Session
model since the behaviour after communicator creation is the same as the World
one. However, ULFM does not specify the application behaviour if faults happen
before and during the MPI_Init call. This limitation does not heavily impact
the World model since no MPI routine is callable before initialisation, so
applications perform it as soon as possible. On the other hand, due to the
added flexibility from the Session model, we can avoid calling the MPI_Init
function or invoke the Session initialisation procedure multiple times and
further in the execution, extending the period for a possible undefined
behaviour. In this work, we try to enlarge the ULFM-defined behaviour,
analysing the Session model initialisation phase.

###  2.3. Related work

Aside from the ULFM extension, the other main direction in the MPI fault
tolerance field is the Reinit proposal (Laguna et al., 2014; Chakraborty et
al., 2020). Its main feature is the possibility to perform the MPI_Init
function multiple times. In case of failure, no repair process is necessary
since re-initialising the communication is sufficient. The approach provided
by the Reinit solution is similar to the multiplicity of the sessions but
focuses only on the World model and would bring no additional benefit in the
Session one compared to ULFM.

Out of all the efforts leveraging the ULFM extension, (Rocco and Palermo,
2022) analysed the MPI_Comm_create_from_group function, proposing a solution
that enables the completion of the call even with faults among the involved
processes. They introduce a Liveness Discovery Algorithm that queries the
execution and proactively discovers failures. This solution is promising since
it deals with a critical function of the Session initialisation process but
limits its scope to the World model.

A completely different approach comes from the Session Working Group
(responsible for the Session model development inside the MPI standard). They
are currently working on extending the idea behind the Session model to obtain
isolated communication Bubbles (Huber et al., 2022). This work should open up
for malleability properties in MPI, allowing dynamic reconfiguration of the
execution. Moreover, those benefits also affect fault tolerance since they
allow handling faults as resource changes. While being a promising direction,
the fault tolerance analysis requires additional efforts: the Bubble idea can
represent the faults’ consequences but needs effective detection and
propagation mechanisms. This work is orthogonal to the Bubbles proposal since
it operates at different levels while keeping the approaches compatible.

##  3\. Failures in the initialisation flows

In this section, we analyse the effects of faults on the initialisation flows
of the two MPI execution models. For reference, we use an MPI implementation
with ULFM features enabled. Otherwise, fault incurrence would have just
stopped the execution regardless of our measures.

In the World model, the initialisation procedure consists only of the MPI_Init
function. It involves all the processes part of the execution and produces the
starting communicators. If someone does not participate in the call, the
others will wait until it joins. If that process cannot join, the execution
enters a deadlock state, which is also the case if some process fails before
the function invocation. From the execution viewpoint, it is impossible to
decide whether the function will eventually terminate or is in a deadlock
state: this decision is analogous to the Halting Problem (Turing et al.,
1936). The deadlock-vulnerable function is, however, the first call of every
MPI application, minimising the vulnerability time window. Overall, the
deadlock risk is acceptable, so ULFM can focus on handling faults in the rest
of the application.

In the Session model, we face a different situation: almost all the functions
of the initialisation flow are local, thus requiring no communication and
providing a result even with faults. The only non-local operation is the
MPI_Comm_create_from_group call, which needs the participation of all the
processes involved in the communication creation. Similarly to the MPI_Init
function, the communicator creation call cannot distinguish between faults and
delays and exposes a deadlock whenever a process does not participate.
Differently from the MPI_Init function, however, the initialisation is not
unique and can happen at any point of the application execution, even multiple
times per session. These considerations imply that the deadlock risk has a
high impact and moderate probability of verifying, making the problem
relevant.

##  4\. The Horizon sets

The effort (Rocco and Palermo, 2022) analysed the MPI_Comm_create_from_group
function from the fault management perspective, removing the deadlock
eventuality from its behaviour. The authors leveraged a Liveness Discovery
Algorithm (LDA) to explore the group and remove failed processes. Their
approach requires an already-created communicator, including all the processes
that intend to be part of the new one, so they opted for MPI_COMM_WORLD. Since
MPI_COMM_WORLD is usable only in the World model, that approach is valid only
if another communicator is available. However, to create such a communicator,
we can only use the MPI_Comm_create_from_group function, which can still
deadlock. The situation resembles a chicken-egg problem. Nonetheless, if we
provide a correct communicator, we can use the LDA algorithm and remove the
deadlock eventuality. This analysis aims to create such a communicator, thus
reducing the deadlock vulnerability but preserving the application
performance.

To better visualise the problem, we introduce a set of notions. For a given
group of processes $G$, we define as $Create(C_{G})$ the call which produces a
communicator $C_{G}$ with all the processes part of $G$. Moreover, we refer to
the superset $S(G)$ as the set of communicators containing at least all the
processes of $G$. From these definitions, we can deduce these simple
assumptions:

  1. A.1

$\forall G:C_{G}\in S(G)\land\texttt{MPI\\_COMM\\_WORLD}\in S(G)$

  2. A.2

$\forall G1,G2:C_{G2}\in S(G1)\Rightarrow G2\supseteq G1$

The first assumption guarantees that the superset of each group is never
empty, while the other defines the relationship between different supersets.

(a) new communicator included in Horizon

(b) new communicator intersects Horizon

(c) Horizon included by the new communicator

Figure 2. Evolution of the Horizon set (in blue) when introducing a new
communicator (in red). The grey rectangle represents the global communicator,
each white circle a process inside it. The behaviour depends on whether there
is an inclusion relationship (cases 2(a) and 2(c)) or not (case 2(b)).

The requirement for the Liveness Discovery Algorithm (LDA) and the deadlock
removal is the existence of a call to create a communicator part of the
superset of the group passed as a parameter. Formally:

(1) $LDA\,applicable\,for\,Create(C_{G})\Leftrightarrow\\\ \exists K\in
S(G)\,|\,Create(K)\,prior\,to\,Create(C_{G})$

Given the above analysis, if we want to minimise the deadlock eventuality, we
must define a communicator set $W$ such that $\forall G\,\exists K\in
W\,|\,K\in S(G)$. We should initialise all the communicators inside $W$ before
the first communicator creation call so that, for each successive
$Create(C_{G})$, Equation 1 is valid. Moreover, following the Assumption A.1,
we can deduce that the minimal $W$ set contains only a communicator equivalent
to MPI_COMM_WORLD. Given this conclusion, then naive solution to the deadlock
vulnerability problem is the generation of a global communicator during the
first call of MPI_Session_init, which will happen before any other operation.
This solution, however, features many problems:

  * •

The function MPI_Session_init is local, thus requiring no communication
between processes. Communicator creation needs coordination, changing the
function’s characteristics.

  * •

The MPI_Session_init invocation must happen as soon as possible to minimise
the vulnerability window, compromising the Session model flexibility.

  * •

One of the Session model benefits consists in its scalability due to not
requiring the application to initialise the entire global communicator, but
just the needed portions. This solution loses that benefit.

This naive solution is thus insufficient, but it is a good starting point. Its
main weakness is its need to create a global communicator, regardless of the
characteristics of the application. Moreover, its use costs some of the
Session model benefits, so we opted for a different approach.

While global communicator usage is the safest option, it is not the only one.
To further the analysis, we propose the use of Horizon sets $H(t)$, defined
such that the following formulation is valid:

(2) $\forall G:Create(C_{G})\,prior\,to\,t\Rightarrow\\\ \exists C\in
H(t)\,|\,C\in S(G)\land Create(C)\,prior\,to\,t$

In other words, at each time $t$, a Horizon set contains at least an element
of the superset of all the groups passed as a parameter in a previous
communicator creation call. Moreover, combining the Equation 2 with the
Equation 1, we deduce that the LDA is applicable if there exists an element of
the superset of the group passed as a parameter inside a Horizon set.
Formally:

(3) $\forall Create(C_{G}):Create(C_{G})\,happens\,at\,t+1\\\
LDA\,applicable\,for\,Create(C_{G})\Leftrightarrow\\\ \exists K\in
H(t)\,|\,K\in S(G)$

The Equation 3 links Horizon sets to our problem, so we can reason on the
formers to solve the latter.

Horizon sets evolve with time, growing in size with new communicators. The
collection of all the communicators created before time t is a Horizon set,
and we can use it to decide whether the LDA algorithm is applicable. However,
that Horizon set may not be the lowest cardinality one. We define the minimal
Horizon set as $H^{*}(t)$. Focusing on the minimal Horizon set is mandatory if
we want to reduce the overhead due to communicator management.

We can analyse the evolution of $H^{*}(t)$ by considering all the possible
topology cases of communicator creations, as shown in Figure 2. In general,
the addition of a communicator to the minimal Horizon set must not take place
if another communicator containing it already exists (Figure 2(a)). On the
other hand, the newly inserted communicator removes all the communicators it
includes from the Horizon set (Figure 2(c)). Following these concepts, we can
keep track of $H^{*}(t)$ and use it to remove the deadlock eventuality from
some communication creation calls.

Inside the application code, calls to $Create(C_{G})$ refer to invocations of
functions MPI_Comm_create_from_group or MPI_Init (which creates
MPI_COMM_WORLD). By keeping track of those functions, we can update the
minimal Horizon set correctly and use it to limit the deadlock vulnerability
of the Session model initialisation flow. Moreover, we provide a new ad-hoc
collective function MPIX_Horizon_from_group, which includes the communicator
of the group passed as a parameter inside the Horizon set. While its behaviour
is analogous to the communicator creation functions, it allows the user to
provide the application communication intent.

##  5\. Experimental Results

We integrated the proposed Horizon set management functionalities inside the
Legio library (Rocco et al., 2021; Rocco and Palermo, 2022) since it already
implements the LDA algorithm and operates at the same abstraction level. All
the added functionalities leverage the PMPI layer to avoid tampering with the
application code directly.

The experimental campaign evaluates the proposed solution overhead and
scalability in a real-world scenario. In particular, we integrate the solution
with the embarrassingly parallel (EP) and data traffic (DT) benchmarks part of
the NAS collection (Bailey et al., 1995) and execute them on the
IT4Innovations Karolina cluster, featuring nodes with 2 x AMD Zen 2 EPYC™
7H12, 2.6 GHz processors and 256 GB of RAM, each running 128 MPI processes. We
use the latest version of OpenMPI featuring ULFM (v5.0.0) and implementing MPI
standard 4.0. We changed the two benchmarks to leverage the Session model. We
use a ”C” size workload for both applications, the maximum available for their
executions.

(a) DT benchmark

(b) EP benchmark

Figure 3. Normalised execution times of the two benchmarks over different
network sizes.

We ran tests using different network sizes to evaluate the scalability impact
of our solution. We ran both applications with the naive solution, with
Horizon set support, and without fault management support. For each
configuration, we measured the total time to complete ten executions. Figure 3
shows the benchmarks’ execution time, normalised to the values without fault
management support.

The results from the two benchmarks’ executions differ due to their
peculiarities. In particular, we used the EP benchmark (Figure 3(b)) to stress
the solutions’ scalability, while DT focuses on the overall execution impact
(Figure 3(a)). We can see from the figures that the naive approach always has
more overhead than the proposed Horizon set solution. Moreover, the naive
approach overhead grows with the network size, as visible in Figure 3(b). On
the other hand, the Horizon set solution does not heavily impact the
application scalability since it does not require the initialisation of the
global communicator present in the naive approach.

Aside from performance-oriented experiments, we did functional tests to prove
the resiliency of our approach. Those tests showed that an application
leveraging our solutions is more deadlock-resilient, managing to complete even
with faults in the execution.

##  6\. Conclusion

In this effort, we analysed and limited the impact of faults in MPI
applications using the Session model. We motivated the need for Horizon sets,
and we analysed their behaviour. We showed our proposed implementation of the
Horizon set management functionalities and tested it using benchmarks in a
real-world scenario. Results showed that the Horizon set solution does not
compromise the performance and scalability of executions, reduces the deadlock
vulnerability to faults and performs better than the naive one.

Future work in this area includes interfacing with the MPI Bubbles proposal
and additional evaluation on new benchmarks that could further stress the
capabilities of the Session model.

## References

  * (1)
  * Bailey et al. (1995) David Bailey, Tim Harris, et al. 1995\.  _The NAS parallel benchmarks 2.0_.  Technical Report. Technical Report NAS-95-020, NASA Ames Research Center.
  * Bland et al. (2013) Wesley Bland, Aurelien Bouteiller, et al. 2013\.  Post-failure recovery of MPI communication capability: Design and rationale.  _The International Journal of High Performance Computing Applications_ 27, 3 (2013), 244–254.
  * Chakraborty et al. (2020) Sourav Chakraborty, Ignacio Laguna, et al. 2020\.  EReinit: Scalable and efficient fault-tolerance for bulk-synchronous MPI applications.  _Concurrency and Computation: Practice and Experience_ 32, 3 (2020), e4863.
  * Holmes et al. (2016) Daniel Holmes, Kathryn Mohror, et al. 2016\.  Mpi sessions: Leveraging runtime infrastructure to increase scalability of applications at exascale. In _Proceedings of the 23rd European MPI Users’ Group Meeting_. 121–129.
  * Huber et al. (2022) Dominik Huber, Maximilian Streubel, et al. 2022\.  Towards Dynamic Resource Management with MPI Sessions and PMIx. In _Proceedings of the 29th European MPI Users’ Group Meeting_. 57–67.
  * Laguna et al. (2014) Ignacio Laguna, David F Richards, et al. 2014\.  Evaluating user-level fault tolerance for MPI applications. In _Proceedings of the 21st European MPI Users’ Group Meeting_. 57–62.
  * Message Passing Interface Forum (2021) Message Passing Interface Forum. 2021\.  _MPI: A Message-Passing Interface Standard Version 4.0_.  https://www.mpi-forum.org/docs/mpi-4.0/mpi40-report.pdf
  * Rocco et al. (2021) Roberto Rocco, Davide Gadioli, et al. 2021\.  Legio: fault resiliency for embarrassingly parallel MPI applications.  _The Journal of Supercomputing_ (2021), 1–21.
  * Rocco and Palermo (2022) Roberto Rocco and Gianluca Palermo. 2022.  Fault-Aware Non-Collective Communication Creation and Reparation in MPI.  https://doi.org/10.48550/ARXIV.2209.01849
  * Turing et al. (1936) Alan Mathison Turing et al. 1936\.  On computable numbers, with an application to the Entscheidungsproblem.  _J. of Math_ 58, 345-363 (1936), 5.