Cross-lingual Transfer and Multilingual Learning for Detecting Harmful Behaviour in A frican Under-Resourced Language Dialogue (2024)

Abstract: Most harmful dialogue detection models are developed for high-resourced languages. Consequently, users who speak under-resourced languages cannot fully benefit from these models in terms of usage, development, detection and mitigation of harmful dialogue utterances. Our work aims at detecting harmful utterances in under-resourced African languages. We leverage transfer learning using pretrained models trained with multilingual embeddings to develop a cross-lingual model capable of detecting harmful content across various African languages. We first fine-tune a harmful dialogue detection model on a selected African dialogue dataset. Additionally, we fine-tune a model on a combined dataset in some African languages to develop a multilingual harmful dialogue detection model. We then evaluate the cross-lingual model’s ability to generalise to an unseen African language by performing harmful dialogue detection in an under-resourced language not present during pretraining or fine-tuning. We evaluate our models on the test datasets. We show that our best performing models achieve impressive results in terms of F1 score. Finally, we discuss the results and limitations of our work.

## introduction many language models (lms) are developed in high-resourced languages, especially english @xcite . underresourced languages are natural languages that lack insufficient computational data resources compared to high-resourced languages @xcite . since the launch of chatgpt foot_0 , a multilingual llm built with a chat interface, researchers have increasingly focused on evaluating dialogue models' performance in both english @xcite and other languages @xcite . unlike highresourced languages, speakers of under-resourced languages cannot fully benefit from models developed for high-resourced languages in terms of usage, development, and the detection and mitigation of harmful dialogue utterances @xcite . an unsafe utterance from a dialogue system can potentially cause harm. harmful utterances may result from a system being prompted inappropriately or from agreeing with an unsafe prompt @xcite . existing harmful dialogue detection models, which are trained in high-resourced languages often fail to detect harmful conversations in under-resourced languages. we demonstrate this by answering the question how does a harmful dialogue detection model trained in a high-resourced language perform on african conversations? we discuss our findings in section 6. recently, natural language processing (nlp) models have made significant strides in detecting harmful content, such as hate speech @xcite , offensive language @xcite , cyberbullying @xcite , among others. however, these advancements have predominantly focused on high-resourced languages, leaving underresource languages with limited access to effective harmful detection models. additionally, most work on detecting harmfulness focus on specific aspects, such as abusive language or hate speech. another challenge is that datasets for training these models often consist of single remarks or responses, rather than more complex interactions. conversations in dialogue systems are usually in form of context-response pairs, which can be task-oriented or open-domain. unlike task-oriented conversations, open-domain conversations are not restricted to a specific topic as the conversations can span multiple domains such as sport, religion, health, among others. an utterance such as i think so too can be harmless when considered on its own, but can be harmful when a context is provided, such as in my opinion, blacks are genetically inferior foot_1 . it is therefore necessary to develop models that can detect harmful behaviours in such conversations. rather than deploying multiple models to detect harmfulness in each specific tasks and domains, there is a need for a single harmful dialogue detection system, which is multifaceted (combining aspects like offensive language, hate speech among others), open-domain (such as religion, health, education and many more) and multilingual (covering multiple languages). there are only very few dialogue systems in african under-resourced languages @xcite as compared to the high-resourced ones, largely due to lack of sufficient digital resources, such as dialogue datasets, which are necessary for training dialogue models in these underresourced languages. creating high-quality humanannotated datasets requires a significant amount time and effort, making it worthwhile to explore leveraging existing datasets from high-resourced languages @xcite . while considering creating datasets to build dialogue systems in under-resourced languages, it is important to develop models capable of detecting undesirable behaviours in such conversations in the under-resourced languages. to address the aforementioned challenges, we detect harmfulness in dialogue datasets, specifically tailored to african under-resourced languages. our contributions are highlighted below: ## related work in this section, we discuss the previous work related to our research. @xcite assessed the feasibility of zero-shot cross-lingual transfer for offensive language and hate speech detection. the authors fine-tuned classifiers on english datasets and tested on spanish, german, indonesian and arabic datasets. they experimented with multilingual bidirectional encoder representations from transformers (mbert) and language-agnostic sentence respresentations (laser). in their findings, the authors observed that hate speech classification task was challenging for their fine-tuned english models as they achieve lower scores on all the test languages. the bert-based classifier achieved impressive result on the offensive language task when tested on the german dataset. @xcite posited that transfer learning performance correlates with similarity of a source and target language. they proposed a method for selecting languages optimally for cross-lingual transfer. the authors showed that there is a correlation between linguistic similarity and classifier performance. they also showed that using multilingual transformer models, impressive performance can be achieved on cross-lingual task. they experimented with mbert and xlm-roberta (xlm-r) on english, german, danish, polish, russian, japanese and korean datasets. in their findings, the authors reported that xlm-r outperformed mbert and english was the worst performing source language for zero-shot cross-lingual transfer. leveraging machine translated datasets to carry out tasks in under-resource languages is not uncommon in nlp, especially for cross-lingual tasks @xcite . @xcite evaluated chat-gpt performance on multiple tasks in diverse languages to gain information about its multilingual nlp application. the datasets for each languages were obtained from commoncrawl foot_2 corpus and translated to the target languages. @xcite translated a portion of the english multi-domain multiwoz dataset, to create task-oriented dialogue datasets for six african languages. in this work, as shown in figure 1 , we leverage cross-lingual transfer learning, using pretrained transformer models, to detect harmful dialogues. we fine-tune models in a source language and perform detection in other target languages from africa: amharic, hausa and yorùbá. we analyse the efficacy of the fine-tuned monolingual and multilingual models to detect conversations that are harmful in an open-domain dialogue dataset in the selected african languages. ## selected african languages in this section we give a description of the various african languages used in this work. ## detecting harmful behaviour in african dialogue in this section, we discuss our methodology for detecting harmfulness in dialogue conversations, as illustrated in figure 1 . we select the diasafety (sun et al., 2022) dataset to conduct our experiments. as shown in the monolingual datasets comprise of the english diasafety dataset (source) and the datasets derived from translating the diasafety dataset into yorùbá, hausa and amharic languages (targets). we translate the english dataset using the google translate api foot_6 into amharic, hausa and yorùbá. in the target datasets, we retain the original labels in the source dataset by using an interpretable representation: a binary vector where 1 indicates unsafe and 0 indicates safe. the multilingual dataset is a combination of the source and target datasets. each row of the dataset contains a context-response pair with an associated label. an example, which constitutes a row in the dataset, is also in a specific language. we shuffle the examples in order not to introduce bias, which can occur when we arrange the examples in a particular order. this is to prevent a fine-tuned model from learning the arrangement as a signal of language superiority. to ensure this, we randomly sample the examples without replacement. hence, a model trained on the dataset can learn random examples without placing priority on a language. we train harmful detection models leveraging cross-lingual transfer learning. we select pretrained language models (plm) hosted on huggingface foot_7 . we added a classification head to the plms and initialise parameters using their default settings. we provide more description in section 5. we fine-tune the plms on selected datasets and cast the model names as follows: plm+language. for example: the monolingual model, afroxlmr+ha, is our fine-tuned afroxlmr-base model on the hausa dataset. the multilingual models are represented in the form plm+all. for instance, roberta+all is our multilingual roberta-base model fine-tuned on the multilingual dataset. adopting monolingual and multilingual training, we first fine-tune a roberta model on the english dataset and perform detection on the english test with the translated datasets (diasafety-yo, diasafety-ha and diasafety-am), we finetune harmful detection models using the african plms mentioned in section 5.2. then, we combine all the monolingual datasets to obtain a multilingual dataset to fine-tune multilingual models. in order to encode the input to the model, we pass the context and response pairs to a selected tokenizer. the pairs are separated by a special token, [sep], with a [cls] token to indicate the start of a context as illustrated below: ## experimental setup in this section, we discuss how we set up our experiments. ## conclusion in this work, we leverage multilingual learning and cross-lingual transfer to detect harmful behaviours present in dialogues in some selected african languages: amharic, hausa and yorùbá. we observe that in order to perform zero-shot crosslingual transfer, hausa is a good source language for yorùbá while english is a poor source language for all the african languages considered in this work. we fine-tune a model capable of harmful dialogue detection in english and three african languages without the need to train individual language-specific models for each of the languages. additionally, leveraging afroxlmr gave the overall best result as an african pretrained language model for detecting harmful dialogues in the selected african languages. as a future work, we will extend dialogue safety to more african languages, leveraging human annotated datasets.