arXiv:2012.15520v2 [cs.CL] 7 Mar 2021

12
ARAGPT2: Pre-Trained Transformer for Arabic Language Generation Wissam Antoun and Fady Baly and Hazem Hajj American University of Beirut {wfa07, fbg06, hh63}@aub.edu.lb Abstract Recently, pre-trained transformer-based archi- tectures have proven to be very efficient at language modeling and understanding, given that they are trained on a large enough cor- pus. Applications in language generation for Arabic are still lagging in comparison to other NLP advances primarily due to the lack of advanced Arabic language generation models. In this paper, we develop the first advanced Arabic language generation model, AraGPT2, trained from scratch on a large Arabic corpus of internet text and news articles. Our largest model, ARAGPT2- MEGA, has 1.46 billion pa- rameters, which makes it the largest Arabic language model available. The MEGA model was evaluated and showed success on different tasks including synthetic news generation, and zero-shot question answering. For text gener- ation, our best model achieves a perplexity of 29.8 on held-out Wikipedia articles. A study conducted with human evaluators showed the significant success of AraGPT2-mega in gen- erating news articles that are difficult to dis- tinguish from articles written by humans. We thus develop and release an automatic discrim- inator model with a 98% percent accuracy in detecting model-generated text. The models are also publicly available 1 , hoping to encour- age new research directions and applications for Arabic NLP. 1 Introduction Few years ago, Natural language processing (NLP) was revolutionized with the introduction of multi-head self-attention transformer architec- ture (Vaswani et al., 2017). The transformer achieved superior performance compared to recur- rent neural networks several NLP tasks including machine translation, sentence classification with 1 Pretrained variants of ARAGPT2 (base, medium, large, mega) and discriminator are publicly available on github.com/aub-mind/arabert/tree/master/aragpt2 BERT (Devlin et al., 2019), and ELECTRA (Clark et al., 2020b), and sentence completion with GPT- 2(Radford et al., 2019), GROVER (Zellers et al., 2019), and CTRL (Keskar et al., 2019). Recent works have shown that larger models pre-trained on larger datasets can further improve performance i.e. RoBERTa (Liu et al., 2019), and XLM-R (Con- neau et al., 2019). On the other hand, work on Arabic language modeling has mostly targeted natural language understanding (NLU) by pre-training transformer- based models using the Masked Language Model- ing (MLM) task i.e. ARABERT (Antoun et al., 2020a). In contrast, Arabic text generation or causal language modeling hasn’t received much attention. Few works such as hULMonA (ElJundi et al., 2019) used next word prediction as a pre- training task in for transfer learning in Arabic text classification. (Khooli, 2020) and (Doiron, 2020) leveraged the existing GPT2 English model and adapted it for Arabic using text from the Arabic Wikipedia dumps, which is sub-optimal for Arabic. In this paper, the first advanced language gener- ation models built from the grounds up on Arabic language have been developed. The process of pre- training ARAGPT2, a GPT-2 transformer model for the Arabic language is described. The model comes in 4 size variants: base (135M 2 ), medium (370M), large (792M) and mega (1.46B 3 ), which allows the exploration of ARAGPT2 in multiple ap- plications with different data availability and com- putational constraints. The perplexity measure is used to automatically evaluate ARAGPT2. Fur- thermore, a human-based evaluation is provided, which highlights the ability of ARAGPT2 to de- ceive human evaluators. Finally, an ARAELEC- TRA (Antoun et al., 2020b) based detector is devel- 2 Million Parameters 3 Billion Parameters arXiv:2012.15520v2 [cs.CL] 7 Mar 2021

Transcript of arXiv:2012.15520v2 [cs.CL] 7 Mar 2021

Page 1: arXiv:2012.15520v2 [cs.CL] 7 Mar 2021

ARAGPT2: Pre-Trained Transformerfor Arabic Language Generation

Wissam Antoun and Fady Baly and Hazem HajjAmerican University of Beirut

{wfa07, fbg06, hh63}@aub.edu.lb

Abstract

Recently, pre-trained transformer-based archi-tectures have proven to be very efficient atlanguage modeling and understanding, giventhat they are trained on a large enough cor-pus. Applications in language generation forArabic are still lagging in comparison to otherNLP advances primarily due to the lack ofadvanced Arabic language generation models.In this paper, we develop the first advancedArabic language generation model, AraGPT2,trained from scratch on a large Arabic corpusof internet text and news articles. Our largestmodel, ARAGPT2-MEGA, has 1.46 billion pa-rameters, which makes it the largest Arabiclanguage model available. The MEGA modelwas evaluated and showed success on differenttasks including synthetic news generation, andzero-shot question answering. For text gener-ation, our best model achieves a perplexity of29.8 on held-out Wikipedia articles. A studyconducted with human evaluators showed thesignificant success of AraGPT2-mega in gen-erating news articles that are difficult to dis-tinguish from articles written by humans. Wethus develop and release an automatic discrim-inator model with a 98% percent accuracy indetecting model-generated text. The modelsare also publicly available1, hoping to encour-age new research directions and applicationsfor Arabic NLP.

1 Introduction

Few years ago, Natural language processing(NLP) was revolutionized with the introductionof multi-head self-attention transformer architec-ture (Vaswani et al., 2017). The transformerachieved superior performance compared to recur-rent neural networks several NLP tasks includingmachine translation, sentence classification with

1Pretrained variants of ARAGPT2 (base, medium,large, mega) and discriminator are publicly available ongithub.com/aub-mind/arabert/tree/master/aragpt2

BERT (Devlin et al., 2019), and ELECTRA (Clarket al., 2020b), and sentence completion with GPT-2 (Radford et al., 2019), GROVER (Zellers et al.,2019), and CTRL (Keskar et al., 2019). Recentworks have shown that larger models pre-trainedon larger datasets can further improve performancei.e. RoBERTa (Liu et al., 2019), and XLM-R (Con-neau et al., 2019).

On the other hand, work on Arabic languagemodeling has mostly targeted natural languageunderstanding (NLU) by pre-training transformer-based models using the Masked Language Model-ing (MLM) task i.e. ARABERT (Antoun et al.,2020a). In contrast, Arabic text generation orcausal language modeling hasn’t received muchattention. Few works such as hULMonA (ElJundiet al., 2019) used next word prediction as a pre-training task in for transfer learning in Arabic textclassification. (Khooli, 2020) and (Doiron, 2020)leveraged the existing GPT2 English model andadapted it for Arabic using text from the ArabicWikipedia dumps, which is sub-optimal for Arabic.

In this paper, the first advanced language gener-ation models built from the grounds up on Arabiclanguage have been developed. The process of pre-training ARAGPT2, a GPT-2 transformer modelfor the Arabic language is described. The modelcomes in 4 size variants: base (135M2), medium(370M), large (792M) and mega (1.46B3), whichallows the exploration of ARAGPT2 in multiple ap-plications with different data availability and com-putational constraints. The perplexity measure isused to automatically evaluate ARAGPT2. Fur-thermore, a human-based evaluation is provided,which highlights the ability of ARAGPT2 to de-ceive human evaluators. Finally, an ARAELEC-TRA (Antoun et al., 2020b) based detector is devel-

2Million Parameters3Billion Parameters

arX

iv:2

012.

1552

0v2

[cs

.CL

] 7

Mar

202

1

Page 2: arXiv:2012.15520v2 [cs.CL] 7 Mar 2021

oped and released. It is able to consistently identifynews articles written by ARAGPT2. Making suchpowerful models publicly available to the Arabicresearch community enables research in rising Ara-bic NLP fields i.e Conversational Agents (Naouset al., 2020), Detection of Automatic News Gener-ation Detection (Harrag et al., 2020)...

Our contributions can be summarized as follows:• A methodology to pre-train a billion-size

GPT2 model on a large-scale Arabic corpus.• An automatic discriminator that achieves a

98% accuracy in detecting model-generatedsynthetic text.

• The four variants of ARAGPT2 are releasedon popular NLP libraries, along with the auto-matic ARAGPT2 discriminator.

The rest of the paper is structured as follows.Section 2 provides a concise review of previousliterature on Arabic language modeling. Sec-tion 3 details the methodology used in developingARAGPT2. Section 4 describes the experimentalsetup, evaluation procedures and results. In addi-tion, the approach to build a machine-generatedtext discriminator is presented in Section 5. Fi-nally, a conclusion of the work and implicationsare mentioned in Section 6.

2 Related Works

2.1 English and Non-Arabic Languagemodeling

GPT-1 (Radford et al., 2018) showed that CausalLanguage Modeling4 is an effective pre-trainingtechnique that improves a model’s generalizationcapabilities. GPT-2 then showed that using a largermodel trained on a larger dataset surpasses thestate-of-the-art of many tasks in a zero-shot setting,where a model solves a task without receiving anytraining on that task. Taking the scaling approachto the extreme led to the creation of GPT-3 (Brownet al., 2020), with 175 billion parameter model,also trained with CLM using terabytes of internettext. GPT-3 explored the idea of few-shot learning,where a model is given examples from a new taskas a text prompt, which unlocks new capabilitiesat test time. It was later shown that a carefullydesigned GPT-3 prompt allows the model to gener-ate website designs, scramble/unscramble words...

4This is the regular Language Modeling objective wherethe model learns the probability of a word given the previ-ous context. The CLM acronym is used to distinguish frommasked language modeling (MLM).

The advantage of scaling model sizes and trainingdatasets comes with drawbacks, particularly thehigh computational cost, in addition to the hugecorpora required for pre-training. It was estimatedthat training GPT-2 and GPT-3 costs $43K and$4.6M respectively, without any hyper-parametertuning. These drawbacks restricted the availabil-ity of large pre-trained models to English mainlyand a handful of other languages i.e. ruGPT35 forRussian, and Chinese 1.5B GPT2 (Zhang, 2019).

2.2 Arabic Language modeling

Work on Arabic causal language modeling hasbeen mostly limited to automatic speech recogni-tion (ASR) systems. Since the language modelingcomponent in ASR systems is a key module that en-sures that the output text adheres with the statisticalstructure of language. Work on Arabic languagemodels in ASR systems has mostly relied on N-grams language models. (Ali et al., 2014) builtan N-grams language model (LM) using GALEtraining data transcripts of 1.4M words. More re-cent work in Arabic ASR implemented a recur-rent neural network as an LM, using 130M tokens,and achieved a perplexity of 481 compared to 436for a 4-gram LM (Khurana et al., 2019). Hamedet al. (2017) developed a code-switched Arabic-English language model using tri-gram LM andprovided performance superior compared to twoseparate monolingual LMs. The code-switched LMwas trained on 2.3M sentences or 13M words andachieved a perplexity of 275.

With the rising popularity of transfer learning inNLP, Arabic CLM was used as a pre-training taskfor an Arabic universal LM, hULMonA (ElJundiet al., 2019). The model was then fine-tuned ondifferent downstream text classification tasks. hUL-MonA is a 3 stack of AWD-LSTM6 layers (Howardand Ruder, 2018), trained on 600K Wikipedia arti-cle pre-segmented using the MADAMIRA Arabicmorphological analyzer and disambiguator (Pashaet al., 2014).

Masked Language Modeling (MLM) has beenuseful as a pre-training task for several Arabic NLUmodels. Masked Language Modeling (MLM) isa slightly different objective than CLM that re-quires a system to predict a masked word withina sequence compared to CLM which predicts themissing word at the end of a sequence. MLM

5https://github.com/sberbank-ai/ru-gpts/6ASGD Weight-Dropped LSTM

Page 3: arXiv:2012.15520v2 [cs.CL] 7 Mar 2021

was used in models such as ARABERT (An-toun et al., 2020a), Arabic-BERT (Safaya et al.,2020), Arabic-ALBERT7, GigaBERT (Lan et al.,2020), MarBERT (Abdul-Mageed et al., 2020), andQARiB (Chowdhury et al., 2020). Only two workshave attempted to create an Arabic transformercausal language model. Khooli (2020) and Doiron(2020) finetuned the OpenAI GPT2-base model onArabic Wikipedia, which was mainly trained onEnglish text. Doiron (2020) also continued trainingon a collection of dialectal Arabic datasets, in orderto create a dialectal Arabic GPT2. While this ap-proach has shown the capability to generate Arabictext, it is sub-optimal for Arabic and is useful incases where the training data is scarce.

Our proposed model is hence, the first Arabictransformer-based causal language model trainedfrom scratch on the largest Arabic corpora availableat the time of writing.

3 ARAGPT2: Methodology

ARAGPT2 is a stacked transformer-decoder modeltrained using the causal language modeling objec-tive. The model is trained on 77GB of Arabic text.ARAGPT2 comes in four variants as detailed inTable 1, with the smallest model, base, having thesame size as ARABERT-base which makes it ac-cessible for the larger part of researchers. Largermodel variants (medium, large, xlarge) offer im-proved performance but are harder to fine-tune andcomputationally more expensive. The ARAGPT2-detector is based on the pre-trained ARAELEC-TRA model fine-tuned on the synthetically gener-ated dataset. More details on the training procedureand dataset are provided in the following sections.

3.1 Model

ARAGPT2 closely follows GPT2’s variant archi-tectures and training procedure. Table 1 shows thedifferent model sizes, number of heads, numberof layers, parameter count, and optimizer used foreach model variant. All models are trained withcontext sizes of 1024 tokens. The LAMB (Youet al., 2019) optimizer is used in the base andmedium models only, since it allows using largebatch sizes without worrying about training diver-gence. Using LAMB and Adam (Kingma and Ba,2014) to train the large and mega variants isn’tpossible on TPUv3 due to the optimizer’s highmemory requirements, since memory cost scales

7https://github.com/KUIS-AI-Lab/Arabic-ALBERT/

linearly with the number of parameters. The lim-itations were overcome by following the trainingprocedure of the GROVER model (Zellers et al.,2019) by using the Adafactor optimizer (Shazeerand Stern, 2018), which reduces memory require-ments by factoring the second-order momentumparameters into a tensor product of two vectors.The GROVER architecture was also used insteadof GPT2’s, in which the layer normalization orderin the transformer block is changed.

3.2 Dataset

The training dataset is a collection of the publiclyavailable Arabic corpora listed below:

• The unshuffled OSCAR corpus (Ortiz Suarezet al., 2020).

• The Arabic Wikipedia dump from September2020.

• The 1.5B words Arabic Corpus (El-Khair,2016).

• The OSIAN corpus (Zeroual et al., 2019).• News articles provided by As-safir newspaper.

Preprocessing First, the corpus was filtered byremoving short documents with less than 3 sen-tences, and documents with more than 20% re-peated sentences. URLs, emails, and user men-tions were also replaced with special tokens. Alldiacritics, and elongations were removed as well,while punctuation and non-alphabetic characterswere padded with white-spaces. Moreover, the‘<|endoftext|>’ token is appended at theend of each document. The total dataset size is77GB with 8.8B words8. The majority of the train-ing data is comprised of Arabic news article, whichis mostly written in MSA. The corpus also containsa small set of English words i.e. named entities,which are kept without lower-casing. Subsequently,a Byte-level byte-pair-encoding (BPE) tokenizer istrained with 64000 vocabulary size on all of ourpreprocessed dataset, using the optimized BPE im-plementation from the HuggingFace library (Wolfet al., 2020). Finally, the BPE encoding is appliedon the preprocessed dataset, which results in a to-tal of 9.7M training examples with 1024 sub-wordtokens each.

8Word count was done after preprocessing, where whitespace is inserted before and after punctuations, brackets, num-bers... which increased the total word count

Page 4: arXiv:2012.15520v2 [cs.CL] 7 Mar 2021

Model Size Architecture Context Size Emb. Size Heads Layers OptimizerBase 135M GPT2 1024 768 12 12 LAMBMedium 370M GPT2 1024 1024 16 24 LAMBLarge 792M GROVER 1024 1280 20 36 AdafactorMega 1.46B GROVER 1024 1536 24 48 Adafactor

Table 1: ARAGPT2 model variants with sizes, architecture and optimizerModel Batch Size Learning Rate Steps Time (days) PPL

Base 1792 1.27e-3 120K 1.5 55.8Medium* 80 3e-4 1M 23 45.7Large 256 1e-4 220K 3 36.6Mega 256 1e-4 780K 9 29.8

Table 2: ARAGPT2 training details and validation perplexity. *Medium was trained on a TPUv3-8 with a smallbatch size, since the model was not converging with a large batch size

4 Experiments and Evaluation

4.1 Pre-training Setup

All models were trained on a TPUv3-128 slice9

with different batch sizes and the total numberof steps as shown in Table 2. Base and megawere trained for approximately 20 epochs, whilemedium and large were trained for 10 and 6epochs respectively, due to TPU access limitations.

4.2 Numerical Evaluation

For the validation dataset, the Arabic Wikipediaarticles that were published after August 2020were used, since older articles were included inthe September Wikipedia dump. The perplexityscore was selected as a numerical evaluation met-ric since it measures the degree of ’uncertainty’ amodel has assigning probabilities to the test text.Table 2 shows that, unsurprisingly, validation per-plexity keeps improving with larger model sizes.In fact, the model is still under-fitting the validationset from Wikipedia. The generation capabilities ofthe different variants of ARAGPT2 is illustratedthrough the selected examples in Appendix A.

4.3 Zero-Shot Evaluation

During zero-shot task evaluation, the model is onlygiven a natural language instruction to motivateand ground the task, without any back-propagationhappening. The task of searching and finding thebest input prompt, also known as “prompt engineer-ing”, is hard. Since the search space is practicallyinfinite, and the performance is highly sensitive tochanges in the prompt. The zero-shot performanceof ARAGPT2-Mega is evaluated on two tasks,

9TPUv3-128 has a total of 2TB of HBM memory with16GB per core. TPUs were freely provided by the TFRCprogram.

question answering, and translation. ARAGPT2-MEGA correctly answers 25% of the trivia ques-tions but fails in English-to-Arabic translation. De-tails on the datasets, prompts, and evaluation arepresented in Appendix B.

4.4 Evaluating the Human Ability to DetectMachine-Generated Text

The gold standard for evaluating a model’s lan-guage generation capability is human evaluation.We presented 74 Arabic-speaking subjects fromvarious social media with a survey designed totest the average-human ability to distinguish be-tween machine-generated and human-written textand thus testing the model’s ability to deceive ahuman subject. The survey had a total of 8 newsarticles, 4 machine-generated using ARAGPT2-Mega and 4 written by humans. Each categorywas split into long and short text, which allowsus to test the long-term generation coherency. Inaddition, the human evaluators are allowed to addjustification for each answer.

The survey results, Figure 1, show thatARAGPT2-Mega successfully fooled approx. 60%of the respondents, with longer passages having ahigher error rate than short passages. In the pro-vided explanations, some subjects relied on punc-tuation mistakes, coherence, and repetition issues,while others spotted factual inaccuracies. However,the results also show that humans were misclassi-fying human-written 50% the time (chance levelperformance), while also citing factual inconsis-tencies, grammatical errors, and unusual writingstyles10.

These surprising results show that ARAGPT2can accurately generate human-like text while

10Survey results are available on our GitHub repository.

Page 5: arXiv:2012.15520v2 [cs.CL] 7 Mar 2021

Figure 1: Survey results showing human error rates onmachine generated (left) and human written text (right)

maintaining grammatical correctness that can foolthe average reader. It should be noted that there ex-ist some tools, i.e. the Giant Language model TestRoom (GLTR) (Gehrmann et al., 2019), that allowshumans to study the statistical distributional differ-ences in text generated by GPT2-based models andhuman-written text. Figure 5 in Appendix C dis-plays a visualization of token-level information cre-ated by GLTR with text generated by ARAGPT2and on human-written articles.

5 Automatic Detection of MachineGenerated Text

Large language models could have a significant so-cietal impact if used for malicious purposes, suchas automating the generation of misleading newsarticles, fake reviews, or high-quality phishingmessages. The survey in Section 4.4, showcasesthe failure of the average-human to consistentlydetect machine-generated text, which motivatesthe problem of automatic detection of ARAGPT2-generated text. Related work on the detection ofmachine-generated text by Jawahar et al. (2020) in-dicates that automatic detectors like the GROVER-detector (Zellers et al., 2019) and the RoBERTA-detector (Solaiman et al., 2019) have better suc-cess than human evaluators. In addition, previouswork on detecting Arabic GPT2 (Khooli, 2020)auto-generated tweets, achieved 98.7% accuracy,by fine-tuning an ARABERTv0.1 (Antoun et al.,2020a) based classifier (Harrag et al., 2020).

Our detector is based on the pre-trained ARA-ELECTRA (Antoun et al., 2020b) model, whichwe fine-tuned on a dataset created by combining1500 human-written news articles, with 1500 ar-

ticles generated by ARAGPT2-Mega. For articlegeneration, we only provided the model with ashort prompt of 25 words. We created two versionsof the dataset, one with short texts (150 tokens)and one with long texts (500 tokens), in order toevaluate the impact of the text’s length.

Fine-tuned ARAELECTRA achieves 98.7% and94.9% F1-score on long and short text respec-tively11, which indicates that longer text is easierto detect than short text. The high scores achievedby ARAELECTRA can be explained by the factthat machine-generated text tends to be more pre-dictable compared to human-written text (see Ap-pendix C, Fig. 5). The difference in text predictabil-ity can be easily exploited by a language model todetect machine-generated text. Another contribut-ing factor is that ARAELECTRA was pre-trainedon the exact same dataset as ARAGPT2.

6 Conclusion

ARAGPT2 is the first advanced Arabic languagegeneration model based on the transformer archi-tecture. The model was trained on the largest pub-licly available collection of filtered Arabic corpora.The model was evaluated using the perplexity mea-sure which measures how well a probability modelpredicts a sample. Results show that ARAGPT2is able to produce high quality Arabic text that iscoherent, grammatically correct and syntacticallysound.

It is important to note that ARAGPT2, like manyML models, has ethical implications and can beused maliciously i.e. automatic fake news genera-tion, modeling the dataset inherent biases... To helpdetect misuse of the model, a detector model thatis tasked to detect output generated by ARAGPT2is also released. More importantly, our hopes thatpublicly releasing ARAGPT2 will open up doorsfor new research possibilities for the Arabic NLPcommunity.

Acknowledgments

This research was supported by the University Re-search Board (URB) at the American Universityof Beirut (AUB), and by the TFRC program forproviding free access to cloud TPUs. Many thanksto As-Safir newspaper for the data access, and alsothanks to Nick Doiron for the insightful discus-sions.

11The trained model will be publicly available in our repos-itory

Page 6: arXiv:2012.15520v2 [cs.CL] 7 Mar 2021

ReferencesMuhammad Abdul-Mageed, Chiyu Zhang, Abdel-

Rahim Elmadany, and Lyle Ungar. 2020. To-ward micro-dialect identification in diaglossic andcode-switched environments. arXiv preprintarXiv:2010.04900.

Ahmed Ali, Yifan Zhang, Patrick Cardinal, Najim Da-hak, Stephan Vogel, and James Glass. 2014. A com-plete kaldi recipe for building arabic speech recogni-tion systems. In 2014 IEEE spoken language tech-nology workshop (SLT), pages 525–529. IEEE.

Wissam Antoun, Fady Baly, and Hazem Hajj. 2020a.Arabert: Transformer-based model for arabic lan-guage understanding. In LREC 2020 Workshop Lan-guage Resources and Evaluation Conference 11–16May 2020, page 9.

Wissam Antoun, Fady Baly, and Hazem Hajj. 2020b.Araelectra: Pre-training text discriminators for ara-bic language understanding.

Tom B Brown, Benjamin Mann, Nick Ryder, MelanieSubbiah, Jared Kaplan, Prafulla Dhariwal, ArvindNeelakantan, Pranav Shyam, Girish Sastry, AmandaAskell, et al. 2020. Language models are few-shotlearners. arXiv preprint arXiv:2005.14165.

Shammur Absar Chowdhury, Ahmed Abdelali, Ka-reem Darwish, Jung Soon-Gyo, Joni Salminen, andBernard J. Jansen. 2020. Improving Arabic text cate-gorization using transformer training diversification.In Proceedings of the Fifth Arabic Natural LanguageProcessing Workshop, pages 226–236, Barcelona,Spain (Online). Association for Computational Lin-guistics.

Jonathan H. Clark, Eunsol Choi, Michael Collins, DanGarrette, Tom Kwiatkowski, Vitaly Nikolaev, andJennimaria Palomaki. 2020a. Tydi qa: A benchmarkfor information-seeking question answering in typo-logically diverse languages. Transactions of the As-sociation for Computational Linguistics.

Kevin Clark, Minh-Thang Luong, Quoc V Le, andChristopher D Manning. 2020b. Electra: Pre-training text encoders as discriminators rather thangenerators. arXiv preprint arXiv:2003.10555.

Alexis Conneau, Kartikay Khandelwal, Naman Goyal,Vishrav Chaudhary, Guillaume Wenzek, FranciscoGuzman, Edouard Grave, Myle Ott, Luke Zettle-moyer, and Veselin Stoyanov. 2019. Unsupervisedcross-lingual representation learning at scale. arXivpreprint arXiv:1911.02116.

Jacob Devlin, Ming-Wei Chang, Kenton Lee, andKristina Toutanova. 2019. Bert: Pre-training ofdeep bidirectional transformers for language under-standing. In Proceedings of the 2019 Conference ofthe North American Chapter of the Association forComputational Linguistics: Human Language Tech-nologies, Volume 1 (Long and Short Papers), pages4171–4186.

Nick Doiron. 2020. Making a mini gpt-2 with dialectprompts.

Ibrahim Abu El-Khair. 2016. 1.5 billion words arabiccorpus. arXiv preprint arXiv:1611.04033.

Obeida ElJundi, Wissam Antoun, Nour El Droubi,Hazem Hajj, Wassim El-Hajj, and Khaled Shaban.2019. hulmona: The universal language model inarabic. In Proceedings of the Fourth Arabic NaturalLanguage Processing Workshop, pages 68–77.

Sebastian Gehrmann, Hendrik Strobelt, and Alexan-der M Rush. 2019. Gltr: Statistical detectionand visualization of generated text. arXiv preprintarXiv:1906.04043.

Injy Hamed, Mohamed Elmahdy, and Slim Abdennad-her. 2017. Building a first language model for code-switch arabic-english. Procedia Computer Science,117:208–216.

Fouzi Harrag, Maria Dabbah, Kareem Darwish, andAhmed Abdelali. 2020. Bert transformer model fordetecting Arabic GPT2 auto-generated tweets. InProceedings of the Fifth Arabic Natural LanguageProcessing Workshop, pages 207–214, Barcelona,Spain (Online). Association for Computational Lin-guistics.

Jeremy Howard and Sebastian Ruder. 2018. Univer-sal language model fine-tuning for text classification.arXiv preprint arXiv:1801.06146.

Ganesh Jawahar, Muhammad Abdul-Mageed, andLaks Lakshmanan, V.S. 2020. Automatic detectionof machine generated text: A critical survey. InProceedings of the 28th International Conferenceon Computational Linguistics, pages 2296–2309,Barcelona, Spain (Online). International Committeeon Computational Linguistics.

Nitish Shirish Keskar, Bryan McCann, Lav R Varshney,Caiming Xiong, and Richard Socher. 2019. Ctrl: Aconditional transformer language model for control-lable generation. arXiv preprint arXiv:1909.05858.

Abed Khooli. 2020. gpt2-small-arabic.

Sameer Khurana, Ahmed Ali, and James Glass. 2019.Darts: Dialectal arabic transcription system. arXivpreprint arXiv:1909.12163.

Diederik P Kingma and Jimmy Ba. 2014. Adam: Amethod for stochastic optimization. arXiv preprintarXiv:1412.6980.

Wuwei Lan, Yang Chen, Wei Xu, and Alan Ritter. 2020.Gigabert: Zero-shot transfer learning from englishto arabic. In Proceedings of The 2020 Conference onEmpirical Methods on Natural Language Process-ing (EMNLP).

Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Man-dar Joshi, Danqi Chen, Omer Levy, Mike Lewis,Luke Zettlemoyer, and Veselin Stoyanov. 2019.Roberta: A robustly optimized bert pretraining ap-proach. arXiv preprint arXiv:1907.11692.

Page 7: arXiv:2012.15520v2 [cs.CL] 7 Mar 2021

Hussein Mozannar, Elie Maamary, Karl El Hajal, andHazem Hajj. 2019. Neural Arabic question answer-ing. In Proceedings of the Fourth Arabic Natu-ral Language Processing Workshop, pages 108–118,Florence, Italy. Association for Computational Lin-guistics.

Tarek Naous, Christian Hokayem, and Hazem Hajj.2020. Empathy-driven Arabic conversational chat-bot. In Proceedings of the Fifth Arabic Natu-ral Language Processing Workshop, pages 58–68,Barcelona, Spain (Online). Association for Compu-tational Linguistics.

Pedro Javier Ortiz Suarez, Laurent Romary, and BenoıtSagot. 2020. A monolingual approach to contextual-ized word embeddings for mid-resource languages.In Proceedings of the 58th Annual Meeting of theAssociation for Computational Linguistics, pages1703–1714, Online. Association for ComputationalLinguistics.

Arfath Pasha, Mohamed Al-Badrashiny, Mona Diab,Ahmed El Kholy, Ramy Eskander, Nizar Habash,Manoj Pooleery, Owen Rambow, and Ryan Roth.2014. MADAMIRA: A fast, comprehensive toolfor morphological analysis and disambiguation ofArabic. In Proceedings of the Ninth InternationalConference on Language Resources and Evalua-tion (LREC’14), pages 1094–1101, Reykjavik, Ice-land. European Language Resources Association(ELRA).

Matt Post. 2018. A call for clarity in reporting BLEUscores. In Proceedings of the Third Conference onMachine Translation: Research Papers, pages 186–191, Belgium, Brussels. Association for Computa-tional Linguistics.

Alec Radford, Karthik Narasimhan, Tim Salimans, andIlya Sutskever. 2018. Improving language under-standing by generative pre-training.

Alec Radford, Jeffrey Wu, Rewon Child, David Luan,Dario Amodei, and Ilya Sutskever. 2019. Languagemodels are unsupervised multitask learners. Ope-nAI.

Ali Safaya, Moutasem Abdullatif, and Deniz Yuret.2020. KUISAIL at SemEval-2020 task 12: BERT-CNN for offensive speech identification in social me-dia. In Proceedings of the Fourteenth Workshop onSemantic Evaluation, pages 2054–2059, Barcelona(online). International Committee for ComputationalLinguistics.

Noam Shazeer and Mitchell Stern. 2018. Adafactor:Adaptive learning rates with sublinear memory cost.arXiv preprint arXiv:1804.04235.

Irene Solaiman, Miles Brundage, Jack Clark, AmandaAskell, Ariel Herbert-Voss, Jeff Wu, Alec Rad-ford, Gretchen Krueger, Jong Wook Kim, SarahKreps, et al. 2019. Release strategies and the so-cial impacts of language models. arXiv preprintarXiv:1908.09203.

Jorgrg Tiedemann. 2012. Parallel data, tools and inter-faces in opus. In Proceedings of the Eight Interna-tional Conference on Language Resources and Eval-uation (LREC’12), Istanbul, Turkey. European Lan-guage Resources Association (ELRA).

Ashish Vaswani, Noam Shazeer, Niki Parmar, JakobUszkoreit, Llion Jones, Aidan N Gomez, ukaszKaiser, and Illia Polosukhin. 2017. Attention is allyou need. Advances in neural information process-ing systems, 30:5998–6008.

Thomas Wolf, Lysandre Debut, Victor Sanh, JulienChaumond, Clement Delangue, Anthony Moi, Pier-ric Cistac, Tim Rault, Remi Louf, Morgan Funtow-icz, 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 M. Rush. 2020.Transformers: State-of-the-art natural language pro-cessing. In Proceedings of the 2020 Conference onEmpirical Methods in Natural Language Processing:System Demonstrations, pages 38–45, Online. Asso-ciation for Computational Linguistics.

Yang You, Jing Li, Sashank Reddi, Jonathan Hseu,Sanjiv Kumar, Srinadh Bhojanapalli, Xiaodan Song,James Demmel, Kurt Keutzer, and Cho-Jui Hsieh.2019. Large batch optimization for deep learn-ing: Training bert in 76 minutes. arXiv preprintarXiv:1904.00962.

Rowan Zellers, Ari Holtzman, Hannah Rashkin,Yonatan Bisk, Ali Farhadi, Franziska Roesner, andYejin Choi. 2019. Defending against neural fakenews. In Advances in neural information processingsystems, pages 9054–9065.

Imad Zeroual, Dirk Goldhahn, Thomas Eckart, and Ab-delhak Lakhouaja. 2019. Osian: Open source inter-national arabic news corpus-preparation and integra-tion into the clarin-infrastructure. In Proceedingsof the Fourth Arabic Natural Language ProcessingWorkshop, pages 175–182.

Zhibo Zhang. 2019. Gpt2-ml: Gpt-2 for multiplelanguages. https://github.com/imcaspar/gpt2-ml.

Page 8: arXiv:2012.15520v2 [cs.CL] 7 Mar 2021

A Generated Samples from ARAGPT2

Prompt

أحدث حصول لقاح شركة " أوكسفورد " البريطانية على الموافقة في موطنه ، حالة من الارتياح في العالم ، نظرا إلى فعاليته في وقاية

، فضلا عن سعره المناسب وسهولة تخزينه اللافتة مقارنة بالتطعيمات الأخرى المتاحة في السوق الدولية . وبحسب كورونا الجسم من وباء

شبكة " سكاي نيوز " البريطانية فإن هذا الموافقة على هذا اللقاح تعني الشيء الكثير للعالم وليست مجرد خبر عادي .

Generated Text 1

لمرة الأولى التي يحصببف فيها لقاح مضبباد لكورونا على موافقة منظمة الصببحة العالمية ، كما أنها المرة الأولى وقالت الشبببكة إن هذه هي ا

عاما . وأضببافت أن الشببركة حصببلت أيضببا على موافقة إدارة 20التي تحصببف فيها شببركة بريطانية على مثف هذه الموافقة منذ أكثر من

المضببباد لفيروي زيكا الذي تم تطويره بالتعاون مر شبببركة " سلاكسبببو سبببميثكلاين " ل دوية ( لقاحها FDAالغذاء والدواء الأميركية )

وشبركة " سبانوفي أفنتي" " الفرنسبية للصبناعات الدوا.ية . وأشبارت إلى أنه لم يتم حتى اعن اععلان عن أي حالات إببابة بكورونا بين

قلت الشببكة عن المدير التنفيذي لشبركة " كلاكسبو سبميي كلاين " قوله ن " نحن البشبر في الولايات المتحدة أو سيرها من دول العالم . ون

بة سبعداء للغاية بحصبولنا على هذه الموافقة لأن كلي يعني أننا تمكنا من تحقيه هدفنا المتمثف في حماية أكبر عدد ممكن من الناي من اعببا

من اللقباحبات المضببببادة لهبذا الفيروي وسيره من الأمراي المعبديبة بفيروي كورونبا " . وأضببببا ن " نب مبف أن نتمكن من إنتبا المزيبد

المنتشرة في كمير أنحاء العالم خلال السنوات القليلة المقبلة "

يذكر أن فيروس كورونا المسبب لملازمم الربرا اسوسبل اللانةسبي حو ألف الةيروسباي اللاب لالبي اللتام اللانةسبب ج وح لاولف للا ا ن عل مسبلاو الاال مالوماي فيية عن ملبفر حذا الةيروس وح لرا انلاةال، ج كما ح يولف لالاي ويا ب أو مدباف ليوع لازل، ك لكن

اسمراض والوياي منتا بالوحياي الملالفل اسميركي كاني يف أعلني فب ويي سبببابن من الربببتر اللارع أن لةالا مراكم السبببيلرل عل( MERS - CoVلالريبيا أنلاللا، ربرك نوفارلاس السبويسبري أ بي فاعليلا، فب الوياي من مرض ملازمم الربرا اسوسبل اللانةسبي

من أعراض رببيت بععراض احنةلونما ك وكاني منمم اللبل الاالمي يف أعلني فب ربتر سببلامبر لف اسلةال والبالغين الذين ياانون أيلول المادبب لاسبليل أول لال وفال نالم عن االباب بةيروس كورونا فب المملك الاربي السباوفي ج ليف لاوفب رلل يبل من الامر

تذا الةيروس ك وكان الرلل يف نةل إل مسببلارببة الملص فيلببل اللا لببلببب عاما كان ياانب من عفل أمراض مممن لراء إلببابلا، ب 69

ومركم اسبلاف فب مفين الرياض باف رباور بععراض لانةسبي لافل أفي إل ف ول، فب بيبوب ولاوفب باف يومين من إف ال، المسبلاربة فول مللس اللاااون ور يس الللن ال ليلي لمكافل ك ويال الفكلاور عزء الالوان المفير الاا للمكلا اللانةيذع لمللس ومراء اللببببل ل

اسمراض المافي إن، بناء عل ما أعلنلا، منمم اللببل الاالمي فةف لامي الموافة عل لل ومارل اللببل بالمملك الاربي السبباوفي للامويفحا باللةاح الوايب

Generated Text 2

على موافقة منظمة الصبحة العالمية ، ما يعني أنه 19 -وقالت الشببكة إن هذه هي المرة الأولى التي يحصبف فيها لقاح مضباد لفيروي كوفيد

( تم تطويره بالتعاون Tamifluسبيكون متاحا للجمير خلال الأسبابير القليلة المقبلة .وأضبافت أن هذا اللقاح الذي يحمف اسبم " تاميفلو " )

( الفرنسببية ، وهما Sanofi Pasteur( وشببركة " سببانوفي باسببتور " ) GlaxoSmithKlineشببركة " سلاكسببو سببميي كلاين " ) مر

( الدوا.ية .وقال ر.ي" قسببم الأمراي المعدية في منظمة الصببحة العالمية AstraZenecaشببركتان تابعتان لمجموعة " أسببترا زينيكا " )

( FDAلغبايبة بحصببببول هبذا اللقباح على الموافقبة النهبا.يبة من قببف إدارة الأسبذيبة والعقباقير الأمريكيبة ) ديفيبد نباببارو ن " نحن مسببببرورون ل

( " . وأضبا ن " إنه نب سبار لجمير العاملين في مجال الرعاية الصبحية والمرضبى الذين سبيسبتفيدون WHOومنظمة الصبحة العالمية )

ذي لشببركة " سلاكسببوسببميي كلاين " ، بروي أرمسببترونن ن " إننا سببعداء كدا بهذا الخبر من هذا اللقاح " .من كهته ، قال الر.ي" التنفي

قد عملنا السبار ، ونحن واققون من أننا سبنتمكن من إنتا كميات كبيرة من هذا اللقاح لتلبية الطلب العالمي المتزايد عليه " .وتابر قا.لا ن " ل

متحدة لضبمان الحصبول على الموافقات التنظيمية اللازمة لهذا اللقاح ، ون مف أن نتمكن بشبكف وقيه مر وزارة الصبحة العامة في المملكة ال

من إنتاكه بكميات كافية لتلبية احتياكات المرضبى في كمير أنحاء العالم " .يشبار إلى أن فيروي كورونا المسببب لمتلازمة الشبرق الأوسب

لجهاز التنفسبي ، ولا توكد حتى اعن على مسبتوى العالم معلومات دقيقة ( هو أحد الفيروسبات التي تصبيب ا MERS - CoVالتنفسبية )

عن مصبببببدر هبذا الفيروي ولا طرق انتقبالبه ، كمبا لا يوكبد تطعيم وقبا.ي أو مضببببباد حيوي لعلاكبه . لكن هنباا العبديبد من اعكراءات

لمرضببى وسسببف اليدين بانتظاج وتجنب لم" العين والاحتياطات التي يمكن اتخاكها للحد من خطر اعبببابة به ، مثف اعقلال من مخالطة ا

والأنف والفم واسببتخداج المناديف عند السببعال أو العط" وتغطية الفم والأنف أقناء السببعال أو العطاي وتغطية الأنف والفم عند العط" أو

عاج والشبرا سير المسبتخدمة بعد السبعال باسبتخداج منديف والتخلم منه مباشبرة في سبلة النفايات وعدج مشباركة اعخرين في أدوات الط

قانية على الأقف قم شببطفها بالماء البارد وتجفيف اليدين بمنشببفة 20سسببلها كيدا والحرع على سسببف اليدين بالصببابون والماء الداف لمدة

أعلنت الأسببو الماضبي أن نظيفة والابتعاد عن أماكن الازدحاج والتجمعات البشبرية قدر اعمكان .يذكر أن منظمة الصبحة العالمية كانت قد

شبخصبا منذ اكتشبا المري في شبهر سببتمبر 563حالة ، توفي منها 991عدد حالات اعببابة المككدة بفيروي كورونا الجديد ارتفر إلى

. 2012أيلول

Figure 2: Random unseen context about coronavirus vaccine(top). Followed by two generated samples buARAGPT2-mega. Generated text 1 (topp = 0.95), Generated text 2 (topp = 1)

Page 9: arXiv:2012.15520v2 [cs.CL] 7 Mar 2021

Prompt

يحكى أن مزارعا مخادعا قام ببيع بئر الماء الموجود في أرضه لجاره مقابل مبلغ كبير من المال ، وعندما جاء المزارع الذي اشترى البئر

أبعك الماء الموجود ليستخدم الماء الموجود فيه في اليوم التالي قال له الرجل المخادع : اذهب من هنا أيها الرجل فأنا قد بعتك البئر لكنني لم

فيه ، دهش الرجل مما سمع وتوجه إلى القاضي ليشتكي المزارع المخادع له بعد محاولات عديدة لإقناعه بأن البئر والماء الذي فيه من حقه

Generated Text 1

: لقد اشتتتريم منك البئر لكنك لم وأن عليه أن يدفع المبلغ الذي اشتتتراه به نمنا للبئر ، لكن القاضتتي رفش الشتتكوى وقال للرجل المخادع

تشتتتر مني الماء فوفي يوم من اايام وبينما كان أحد المزارعين يجلع على إحدى شتترفات منزله المعلى على حديقى مليئى بااشتتجار رأى

ه بعش الحلوى التي رجلا قادما نحوه وبيده كيع مليء بالحلوى فستتلم عليه وستتأله عن ستتبب مجيئه إليه فألبره الرجل بأنه يريد أن يععي

يحبها ، فقال له المزارع : حستتنا ستتأععيك ما تريد بشتتر واحد وهو أن لا تخبر أحدا بهذا اامر أبدا ، وافل الرجل على شتتر المزارع

احصتل وأععاه الكيع المملوء بالحلوى ، وقبل أن يغادر المزرعى ستأله المزارع قالالا : هل تعلم يا ستيدي بأنني رجل فقير ولا أملك مالا

على الحلوى ؟ فأجابه الرجل : نعم أعلم ذلك ولكن المشتكلى هي أنني لا أستتعيع أن أععيك الحلوى دون أن تخبرني بذلك ، ضتحك المزارع

قليلا نم قال للرجل : إذا ألبرتني قبل أن تععيني الحلوى فلن أستتمل لك بألذ أي شتتيء منها حتى لو كان هذا الشتتيء هو نمن الحلوى التي

تك إياها فألبر المزارع جاره بما حدث معه و لب منه أن يوصتتتتله إلى القاضتتتتي لعله يجد حلا لمشتتتتكلته ، ذهب جار المزارع إلى أععي

القاضتتي وألبره بما حدث مع جاره ، فستتأله القاضتتي مستتتغربا : لماذا فعلم ذلك ؟ أجابه الجار : انني أريد أن أعرل كيل حصتتلم على

دون أن تععيها احد غيرك !وبالفعل عندما وصتل الجار إلى القاضتي لب منه القاضتي أن يريه الصتندو الحلوى دون أن تألذها مني و

الذي يحتوي على الحلوى ، نظر القاضتتتي إلى الصتتتندو فوجد بدالله صتتتندوقا لر كبيرا مليئا بالحلوى ، تعجب القاضتتتي من محتويات

ا يوجد بدالله ، فتل القاضتتي الصتتندو فوجده مملوءا بالحلوى وقد كتب عليه الصتتندو لكنه ستترعان ما قرر أن يفتل الصتتندو ليرى ماذ

عبارة تقول : " هذه الحلوى لمن يستتعيع الحصتول عليها فق" " ، استتغرل القاضتي من محتوى الصتندو وقرر أن يعيد فتحه مرة ألرى

عما يحتويه كل صتندو فأجال صتاحب الصتندو الاال ليجد بدالله صتندوقا نالاا مليئا بالحلوى أياتا ، ستأل القاضتي صتاحب الصتندوقين

قالالا : إن هذين الصتتندوقين مخصتتصتتان للفقراء الذين لا يستتتعيعون الحصتتول على الحلوى ، أما الصتتندوقين اخلرين فهما مخصتتصتتان

للأغنياء الذين يستعيعون الحصول على تلك الحلوى ف

Prompt

يحكى أن ااستتتد ملك الغابى وأقوى ستتتكانها كان ذات يوم نالاما ، عندما بدأ فأر صتتتغير يعيش في الغابى نفستتتها بالركش حوله والقفز فوقه

للاستتيقا ، وعندما قام ااستد من نومه كان غاضتبا ، فوضتع قباتته الاتخمى فو وإصتدار أصتوات مزعجى ، مما أقلل نوم ااستد ودفعه

الفأر ، وزمجر وفتل فمه ينوي ابتلاع الفأر الصتغير بلقمى واحدة ، صتاا الفأر عندها بصتوت يرتجل من الخول راجيا أن يعفو ااستد عنه

، وقال :

Generated Text 1

العيش بدونك " فأجال ااستد قالالا : " أنا ملك الغابى ، وأنم أيها الفأر الصتغير " ستامحني يا ملك الغابى ، أرجوك ستامحني ، فأنا لا أستتعيع

مجرد تابع لي ، ولا تستتعيع عمل أي شتيء دون إذني ، أما أنا فأستتعيع أن أعمل ما أشتاء وأعيش كما أشتاء ، ولكن بشتر واحد وهو أن

قال الفأر : " نعم ستتيدي ، ستتأفعل كل ما تأمرني به ، وستتأقاتتي على تستتاعدني على القاتتاء على جميع الفئران التي تعيش في الغابى " فف

جميع الفئران الموجودة في الغابى ، وستتتي بك إلى هنا لتعيش معي وتاكل من عامي وتشترل من مالاى وتنام في فراشتي " فضتحك ااستد

لام منذ قليل فق" ، ولكني لم أكن أعرل أنك ملك الغابى ضتحكى عاليى نم قال للفأر : " هل أنم موافل ؟ " ، فقال الفأر : " لقد ستمعم هذا الك

وستتيدها ، وأن لك ستتلعانا علي الحيوانات كلها ، لذلك أرجو منك أن تستتمل لي بأن أعيش معك تحم ستتقل واحد وتحم حمايى ستتلعانك

هانئى ، وبالفعل ذهب الفأر مع ااستتد وملكك " ففرا ااستتد كايرا بالفكرة ، و لب من الفأر أن يذهب معه إلى بيته ليعيشتتا معا حياة ستتعيدة

إلى بيم ااستد الذي رحب به أجمل ترحيب ، وأععاه قععى كبيرة من الخشتب ليصتنع منها ستريرا كبيرا له ولزوجته وأولاده ، وهكذا عا

حمل المزيد من ااعباء الفأر مع ااستد في ستعادة وهناء فوبعد فترة قصتيرة من الزمن ، مرلأ ااستد مرضتا شتديدا ، ولم يعد قادرا على ت

الملقاة على عاتقه ، فعلب من الفأر أن يستتاعده في حمل ستتريره الاقيل والذهال به إلى العبيب ، فوافل الفأر على الفور ، وذهب مستترعا

تقامه إلى العبيب ليخبره بأنه مصتال بمرلأ لعير يحتا إلى جراحى عاجلى ، لكنه رفش إجراء الجراحى لوفا من غاتب ااستد عليه وان

منه ، لكن الفأر أصتتر على الذهال إلى العبيب لإجراء الجراحى ، وفي أنناء ذلك ستتمع صتتوت ااستتد يناديه ويقول له : " ماذا تريد مني يا

ملك الغابى ؟ " ، فأجابه الفأر : " أريد أن أحملك على هري اذهب بك إلى العبيب حتى يشتتتخا حالتك ويصتتتل لك العلا المناستتتب

ظر ااسد إلى الفأر مبتسما وقال له : " هيا بنا يا صديقي العزيز لنذهبلحالتك " فن

Figure 3: Random unseen contexts about children stories. Followed by a generated sample by ARAGPT2-megawith topp = 0.95

Page 10: arXiv:2012.15520v2 [cs.CL] 7 Mar 2021

Prompt 1 (Cooking Recipes)

فتة الدجاج اللبنانية طريقة التحضير نضع الدجاج في قدر من الماء مع البصل والهيل وورق الغار والملح والفلفل الأسود ونسلقه على نار

الزيت ونقلي فيه الخبز متوسطة حتى ينضج تماما . صفي الدجاج من المرق ونفتته ونضعه جانبا ثم نصفي المرق ونضعه في وعاء . نحمي

حتى يصبح ذهبيا ومقرمشا .

Generated Text

نوزع شرائح الفليفلة الخضراء والحمراء والخضراء والبندورة المقشرة والمفرومة فوق الخبز ، ثم نرش فوقها القليل من البقدونس المفروم

ن الطحين ثم ندخل الصنينية للى فرب محمى مسنبقا على حرارة والصننورر المحم . ندهن صنينية فرب رالقليل من الزيت ونرشنها رالقليل م

دقيقة أو حتى يحمر وجه الصننينية . نخرج الصننينية من الفرب ونترلها لتبرد قلي ثم نقطعها 20و 15درجة مئوية لمدة تتراوح رين 180

ونقدمها ساخنة .

Prompt 2 (Short Conversation - Greeting)

مرحبا ليف حالك ؟

Generated Text

ط اب شناء رخير . اليوم جبتلمم لعبة حلوة لتير و هي عبارة عن ممموعة من المرا الملونة رللواب مختلفة لل ما عليك فعله هو الضنغ

اضغط عليها مرة أخرىعلى المرة التي تريد أب ترميها في المماب المخص لها ثم

Prompt 3 (Wikipedia-style)

لبناب تعد الممهورية اللبنانية دولة عررية عاصنمتها ريرو ، وتقع على الشناطا المطل على المزء الشنرقي للبحر الأريل المتوسنط ، وتعد

تعتبر موطنا لأقدم الحضننارا البشننرية في الألفية الثالثة قبل المي د واحدة من ألثر البلداب الممتظة رالسننماب ، ورالعودة للى تاريخها فهي

خاصننة المنطقة السنناحلية منها ، فمانت من أهم المرالز الثقافية والتمارية في ذلك الوقت ، ولاب لتضنناريسننها الوعرة دورا مهما على مر

م حصلت لبناب على استق لها رعد الانتداب 1946، وفي عام م 1926التاريخ في لموء عدة جماعا لليها ، وأعلنت لدولة جمهورية عام

الفرنسي .

Generated Text

[تعد اللغة العررية هي اللغة الرسنننمية للب د ، رافضنننافة للى وجود لغتين رسنننميتين أخريين هما افنمليزية والفرنسنننية ، أما الديانة ٢[]١]

% من لجمالي عدد السنماب ، ويتوزع الباقوب على الطوائف المسنيحية 96موب حوالي السنائدة في الب د فهي افسن م ، حيي يشنمل المسنل

والديانا الأخرى ، ومن أررز المعالم السننياحية في لبناب مدينة ريرو التي تعد عاصننمة الب د ومرلزها الثقافي والاقتصننادا ، لما يوجد

قلعة رعلبك ، وررج ليفل ، ومتحف سنرسن، ، وقصر ريت الدين ال ا يعد واحدا من رها العديد من المواقع الأثرية الهامة مثل مغارة جعيتا ، و

[تعتمد السننياحة في لبناب رشننمل أسنناسنني على الطبيعة الخ رة ٣أقدم القصننور التاريخية في العالم ، وريرها المثير من المعالم المميزة . ]

اء عطلتهم الصنيفية في المناط، المبلية والسناحلية ل سنتمتاع رالمنا ر والمناخ المعتدل صنيفا وشنتاء ، ل لك ف ب أرلا السنياح يفضنلوب قضن

الطبيعينة الخ رنة والمننا ر المنائينة الرائعنة ، رينمنا يفضنننننل البعل الخر التوجنه للى المندب والمنناط، النداخلينة للتمتع رمنناخهنا المعتندل

والاستممام في أحضاب الطبيعة الساحرة

Figure 4: Random unseen contexts on miscellaneous topics. Followed by a generated sample by ARAGPT2-megawith topp = 0.95

Page 11: arXiv:2012.15520v2 [cs.CL] 7 Mar 2021

B Zero-Shot Learning

B.1 Question Answering

In zero-shot factoid question answering, the infor-mation contained within the language model canbe queried. The model is tested on the Arabicexamples from the TyDiQA (Clark et al., 2020a)validation dataset (921 examples), and on the testset of ARCD (Mozannar et al., 2019) (702 exam-ples). Hence, the model os provided with the fol-lowing prompt: “Answer the following question:”- “: ú

ÍA

�JË @ È@

ñ�Ë@ á« I. k.

@” , followed by the question,

then the phrase “The answer is” - “:ñë H. @ñm.Ì'@”. It is

also possible to append the phrase “in the year” -“ÐA« ú

¯”, if the expected answer is a year, as shown

in Table 3.Table 3: The input prompt for question answering

É�Ê�Ó áÓ�é�®Êg Èð

@

�I

�Q« ú

�æÓ : ú

ÍA

�JË @ È@

ñ�Ë@ á« I. k.

@

ÐA« ú

¯ ñë H. @ñm.

Ì'@ ? ZAÓYË@ úæ�A�Ó

�éÊ

�KA

�¯ ú

¯AK.

Answer the following question: When was the firstepisode of the series Buffy the Vampire Slayer shown?The answer is in the year

The answer length is set to be the same as thegold answer length, and a repetition penalty is ap-plied as in CTRL (Keskar et al., 2019), which penal-izes the probability scores of previously generatedtokens. A ‘no repeat tri-gram’ strategy that inhibitsthe model from generating the same tri-gram morethan once has also been employed. Note that thecontext passage is not provided, which forces themodel to rely only on the information gained dur-ing pretraining.

The model achieves a 3.93% exact-match scoreand an F1-score of 14.51% on TyDiQA, and 4.07%exact-match score and 13.88% F1-score on ARCD.Since exact-match and F1-score misses answersthat are correct but are worded differently (asshown in Table 4). A subset of 500 answers fromthe best TyDiQA run is selected, and scored man-ually. Manual scoring shows that ARAGPT2 cor-rectly answered 24.6% of the questions. The modelwas particularly good in countries and capitals ques-tion, year of birth and death, and some geography.Yet it was failing mostly on questions about quan-tities i.e. population counts, area, age... The pre-defined answer length negatively affected the gen-erated answers in some cases, which is a limitationof the current approach.

Table 4: Examples of correct answers that have zeroexact match score.

Question ? ÉK. ñK XQ

®Ë

@ ñë áÓ

Who is Alfred Nobel?

Predicted Answer ¨Q��m×ð ,

�IJÓA

JKYË@ ¨Q�

�m×

Inventor of the dynamite, and the inventor of

Ground Truth ø

YKñ� ù

KAJÒJ»ð ¨Q�

�m×ð �Y

JêÓ

An engineer and an inventor and a Swedish chemist

Question ? ÐY�®Ë@

�èQºË ú

ÍðYË@ XAm�

�'B@ ��A

�K ú

�æÓ

When was the FIFA founded?

Predicted Answer . Ð 1904

1904 AD

Ground Truth 1904 ÐAªË@ áÓ ñKAÓ 21

21 May of the year 1904

Question ? AªKX PA

«X@

ñë áÓ

Who is Edgar Degas?

Predicted Answer ÐA« ��PAK. ú

¯ YËð , ú

æ�

�Q

¯ ú

ÎJº

��

��

àA

J¯ é

K @

He is a French visual artist, born in

Ground Truth úæ�

�Q

¯

�HAm�

' ð ÐA�P ð ú

ÎJº

��

��

àA

Visual artist and painter and sculptor

B.2 TranslationA experiments has also been conducted to test thetranslation capability of ARAGPT2 by append-ing the prompt “What is the translation of thissentence ?:” - “:?

�éÊÒm.

Ì'@ èYë

�éÔg

.Q�K ù

ë AÓ” to the sen-

tence from the source language, in order to inducethe translation behavior of the model. We thenapply greedy decoding to get the generated tar-get sentence. Evaluation is performed on 5000randomly selected pairs from the English-ArabicTatoeba (Tiedemann, 2012) dataset. The modelachieved only 1.32 BLEU score12. The low score isdue to the scarce representation of English words inthe vocabulary, since most words were split into sin-gle characters. Additionally, given that the promptdesign greatly affects the model’s zero-shot perfor-mance, our prompt design might have been sub-optimal. Nevertheless, this negative result encour-ages research into prompt engineering for Arabiclanguage models, which we leave as future work.

12Using the sacrebleu scorer (Post, 2018)

Page 12: arXiv:2012.15520v2 [cs.CL] 7 Mar 2021

C GLTR Analysis and Visualizations

Giant Language model Test Room

The histograms show some statistic about the text: Frac(p) describes the fraction of probability for the actualword divided by the maximum probability of any word at this position. The Top 10 entropy describes theentropy along the top 10 results for each word.

Test-Model: gpt-2-small

Quick start - select a demo text:

machine: GPT-2 small top_k 5 temp 1 machine: GPT-2 small top_k 40 temp .7

machine*: unicorn text (GPT2 large) human: NYTimes article human: academic text

human: woodchuck :)

or enter a text:

analyze

top k count

0102030405060708090

frac(p) histogram

0510152025303540455055

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

1

top 10 entropy(p) histogram

02468101214161820

0 0.20.40.60.8 1 1.21.41.61.8 2 2.22.4

1.55

Top K Frac P Colors (top k): 10 100 1000

شرطي فیھا أصیب ، المحتلة القدس في دھس عملیة ، أمس ، العمود رأس حي من ( عاما 23 ) السلایمة محمود محمد المقدسي الشاب نفذحرس شرطة عناصر من عددا بسیارتھ صدم سیارة سائق إن روزنفیلد میكي الإسرائیلیة الشرطة باسم المتحدث وقال . طفیفة بجروح إسرائیليھداسا مستشفى إلى أثرھا على نقل طفیفة بجروح أحدھم إصابة إلى أدى ما الغربیة القدس في یافا شارع في بدوریة یقومون كانوا الذین الحدود. الأقصى المسجد جنوب سلوان بلدة سكان من فلسطیني شاب ھو العملیة منفذ أن الإسرائیلیة الإعلام وسائل وذكرت . العلاج لتلقي كارم عین

Tweet about GLTR MIT-IBM Watson AI lab and Harvard NLP

بجروح طفیفة .وقال المتحدث باسم الشرطة الإسرائیلیة میكي روزنفیلد إن سائق سیارة صدم بسیارتھ عددا من عناصر شرطة حرس الحدود الذین كانوا یقومون بدوریة في شارع یافا في القدس الغربیة ما أدى إلى إصابة أحدھم بجروح طفیفة نقل على أثرھا إلى مستشفى ھداسا عین كارم لتلقي العلاج..وذكرت وسائل الإعلام الإسرائیلیة أن منفذ العملیة ھو شاب فلسطیني من سكان بلدة سلوان جنوب المسجد الأقصى

(a) Text generated by ARAGPT2-Mega. The first sentence is the human-written prompt

Giant Language model Test Room

The histograms show some statistic about the text: Frac(p) describes the fraction of probability for the actualword divided by the maximum probability of any word at this position. The Top 10 entropy describes theentropy along the top 10 results for each word.

Test-Model: gpt-2-small

Quick start - select a demo text:

machine: GPT-2 small top_k 5 temp 1 machine: GPT-2 small top_k 40 temp .7

machine*: unicorn text (GPT2 large) human: NYTimes article human: academic text

human: woodchuck :)

or enter a text:

analyze

top k count

0102030405060708090

frac(p) histogram

0510152025303540455055

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

0.423

top 10 entropy(p) histogram

02468101214161820

0 0.20.40.60.8 1 1.21.41.61.8 2 2.22.4

1.6

9

Top K Frac P Colors (top k): 10 100 1000

جدیة الأكثر الاختبار أن غیر ، عسكریة أو سیاسیة ، المعارضة أو الدولة مع سواء ، الماضیة الفترة في واختبارات تحدیات سلسلة الأكراد واجھالشعب حمایة وحدات مقاتلو تمكن حیث ، ( كوباني ) العرب عین في داعش - والشام العراق في الإسلامیة الدولة تنظیم مواجھتھم في كان

، القریبة مواقعھم تحصین مع بالتزامن ، المنطقة عن وإبعاده داعش تقدم كسر من ، الدولي التحالف وطیران البشمركة مع بالتعاون ، الكردیةجبھة �� للتصدي الأكراد المقاتلین من العدید انطلاق محطة فكانت عفرین أما . العین رأس إلى وصولا عامودا أو القامشلي في سواء

. والزھراء نبل عن الحصار تخفیف في مھما دورا ولعبوا ، والأشرفیة مقصود الشیخ مثل ، حلب في أحیاء حتى ، النصرة

Tweet about GLTR MIT-IBM Watson AI lab and Harvard NLP

البشمركة وطیران التحالف الدولي ، من كسر تقدم داعش وإبعاده عن المنطقة ، بالتزامن مع تحصین مواقعھم القریبة ، سواء في القامشلي أو عامودا وصولا إلى رأس العین . أما عفرین فكانت محطة انطلاق العدید من المقاتلین الأكراد للتصدي ل جبھة النصرة ، حتى أحیاء في حلب ، مثل الشیخ. مقصود والأشرفیة ، ولعبوا دورا مھما في تخفیف الحصار عن نبل والزھراء

(b) Human-Written TextFigure 5: It is clear that the machine generated text in (a) is mostly green and yellow highlighted, while in thehuman-written text, (b), an increase in red and purple highlighted words can be noticed. P.S.: We use ARAGPT2-base as the backend model in GLTR