AraXLNet: pre-trained language model for sentiment analysis of Arabic
Paper · 2022 · Alhanouf Alduailej and Abdulrahman Alothaim
Summary
Arabic tweets can express the same opinion using different word forms or regional varieties. A system that assigns sentiment labels has to learn which of those differences matter for deciding whether a message is favorable, unfavorable, or neutral. The authors approach this as a problem of sentiment analysis with two sources of training data. They first train XLNet on a large collection of Arabic text, where the words themselves provide the prediction targets. They then adapt it to tweets whose sentiment has already been annotated. They call the resulting language model AraXLNet and present it as the first Arabic adaptation of XLNet.
The pretraining collection contains 60,667,300 sentences, drawn mainly from subtitles and supplemented with hotel and book reviews. XLNet learns to predict tokens from different arrangements of the available context. Across those arrangements, a target can draw on text that originally stood before it or after it. The authors also test an Arabic-specific preprocessing choice. They use Farasa to divide words into meaningful parts before SentencePiece turns the text into the sub-word units XLNet reads. A comparison run omits Farasa. After pretraining, both versions undergo fine-tuning for sentiment classification, with a linear classification layer trained alongside the pretrained network.
On the AraSenTi test data, AraXLNet with Farasa achieves 94.78% accuracy, compared with 84.65% for AraBERT. The corresponding scores are 93.01% and 92.13% on ASTD, and 85.77% and 85.05% on SemEval. AJGT reverses that ordering. AraBERT reaches 91.94% test accuracy there, while AraXLNet with Farasa reaches 88.43%. AraXLNet with Farasa scores above the support vector machine baseline and above its own unsegmented version on every benchmark.
The comparison between AraXLNet’s two versions directly addresses the value of Farasa in this pipeline. The comparison with AraBERT addresses the performance of the complete systems, which differ in more than how they learn to predict tokens. The paper attributes AraXLNet’s performance to several choices, including its vocabulary and pretraining objective. The experiments give the strongest direct evidence for the segmentation choice, and the AJGT result shows that the preferred AraXLNet setup can still trail another Arabic system.
Deep dive: AraXLNet: pre-trained language model for sentiment analysis of Arabic
AraXLNet adapts XLNet to Arabic and tests how pretraining and Farasa word segmentation affect sentiment classification on Twitter datasets. · about 33 minutes to read
The problem and its context
From a message to a sentiment label
The paper takes a common use of social media as its starting point. People write short messages to react to products, organizations, events, or public issues. As those messages accumulate, reading them individually becomes an impractical way to find out how people responded. The setting calls for a way to turn each message into an observation that can be counted and compared with others. A polarity label provides one such observation. The label expresses a judgment about the direction of the opinion conveyed by the text.
The paper places this task within natural language processing and treats it as text classification. This means there is a defined set of labels, and the system must choose among them for a given input. The unit could be a document, a sentence, or a smaller piece of text. Here the main unit is a tweet. What the labels mean depends on the collection. A binary task gives the classifier a choice between positive and negative. A collection that includes neutral or mixed messages asks for additional distinctions. The paper surveys these possibilities and then works with existing benchmark collections whose original label inventories vary.
That variation changes what counts as a mistake. In a binary task, a favorable message misclassified as unfavorable has received the only alternative label. In a task that includes neutral sentiment, the classifier also has to identify when the available text expresses neither positive nor negative sentiment strongly enough to receive one of those labels. A mixed category can represent another decision, since the text may convey opposing reactions. The paper’s related work describes this practical consequence of the label scheme. Earlier Arabic experiments found that classification performance depended on how many categories a system had to distinguish.
Arabic introduces another set of decisions before the classifier assigns any label. The authors emphasize its rich morphology, meaning the ways words are formed and vary. Related forms can share meaning yet appear as different strings. Treating every written form as a distinct item can make it harder for a system to reuse what it learned from one form when it encounters another. The authors also emphasize dialect variation. Tweets can contain forms associated with a region, and the paper describes dialect writing as lacking a single codified standard. Accordingly, a large general Arabic collection and a benchmark of regional tweets offer different kinds of evidence.
The authors describe a shortage of Arabic resources relative to the research and training options they cite for English. Their approach responds to two parts of that problem. A supply of unlabeled Arabic text gives a pretraining system examples of how the language is used. Annotated tweets tell a sentiment classifier which distinctions its predictions must match. The first can come from collections that were assembled for purposes other than tweet sentiment. The second must reflect an explicit label scheme, which makes it more specialized.
How earlier approaches represented sentiment
The paper traces a path from lexicons and conventional classifiers to neural networks. A sentiment lexicon is a dictionary in which opinion words carry polarity information. A system can match words in a new text against the dictionary and use the matches to estimate its sentiment. The paper describes dictionary-based methods that expand a hand-prepared list through relations such as synonymy and antonymy. It also describes corpus-based methods that use patterns in a collection of texts to find further expressions for a particular domain. A dictionary can supply a direct clue to sentiment, while its coverage of a new domain or a different context depends on how it was assembled.
The distinction between a word’s polarity and the polarity of the whole message matters here. Finding a scored word supplies evidence that has to be interpreted within the rest of the text. The paper uses this difficulty to explain why a general dictionary can struggle when an expression’s orientation depends on context. It also discusses earlier work that combined sentiment lexicons with corpus-derived features for Arabic tweets. In that work, deciding how to represent the input and deciding how to classify it were related parts of the design. A better input feature could improve the classifier without changing the set of labels it had to predict.
The authors also review supervised machine learning. A supervised classifier sees examples paired with their expected outputs and uses those pairs to learn how to assign a label to a new example. A decision tree reaches its output through successive choices based on input features. A support vector machine, or SVM, learns a separating boundary in a representation of those inputs. Naïve Bayes uses probabilities and a simplifying independence assumption, while nearest-neighbor classification bases a decision on similar labeled examples. The paper presents these methods as ways to move from a text representation to a discrete label.
In a conventional setup, building that representation can require a separate feature-engineering step. The paper describes examples that count terms or use TF-IDF to score words. A learning algorithm can use those values to distinguish among known labels. Its access to the original message is mediated by the features. Researchers therefore have to consider which properties of a tweet their representation preserves, especially if those properties are likely to differ between dialects or collections.
The neural approaches in the paper’s background learn intermediate representations during training. A network transforms the input through successive layers, and the predictions produced by the final layer give a way to adjust the weights in the earlier layers. The authors describe convolutional and recurrent approaches that preceded the newer pretraining systems, including an Arabic sentiment study that combined a convolutional neural network with a long short-term memory network. For AraXLNet, the relevant transition is from learning those representations entirely for an immediate classification task to learning them through a broader language task first.
Why the authors chose XLNet
The paper’s account of transfer learning begins with a change in what the network is asked to predict. During pretraining, the signal comes from a large text collection and concerns relationships among its words or tokens. During task training, the signal comes from the answer attached to each example. A sentiment label tells the system how a message was classified. It gives little direct information about how the structures within that message recur elsewhere. A language objective provides a separate opportunity to learn about those structures before the network encounters the labels.
The authors use BERT and its successors to explain the setting for XLNet. BERT learns from text with selected tokens masked. Predicting a missing token can draw on visible context to its left and right. In the comparison the paper makes, BERT predicts the masked targets separately given the same corrupted input. XLNet changes the prediction arrangement so that, for some orders, one target can become the context for another. It retains autoregressive prediction, in which each prediction conditions on earlier entries in the chosen order, and uses changing orders to get evidence from both directions in the original sequence.
These architectures are part of the paper’s account of Transformers and attention. The relevant feature of the Transformer here is its ability to produce a representation of a position using other positions made available to it. XLNet builds on Transformer-XL, which the authors describe as combining segment recurrence with relative position encoding. The paper presents these features as part of the inherited architecture for working with text sequences. Its own contribution is to train an Arabic version of that architecture and investigate its performance on tweet sentiment.
Arabic pretraining had precedents in the authors’ account. Multilingual BERT included Arabic among the languages on which it was trained. hULMonA provided an earlier example of pretraining specifically for Arabic, and AraBERT adapted BERT to Arabic text. The paper describes research on applying these systems to sentiment and, for AraBERT, to other language tasks. That background gives the authors an Arabic point of comparison. Their hypothesis is that the advantages motivating XLNet in earlier work will carry over when the architecture learns from Arabic text and is then trained to recognize Arabic sentiment labels.
The method, step by step
Give pretraining and fine-tuning different jobs
AraXLNet begins with two collections that serve different purposes. The first is a general Arabic corpus for pretraining. No sentiment judgment is needed at this stage because the targets are tokens already present in the text. The second consists of previously annotated Twitter benchmarks. In this stage the task is to predict a sentiment category, so the expected answer is associated with the tweet as a whole.
The two stages are connected through the weights of the network. Pretraining produces a set of trained weights for processing Arabic sequences. The authors attach a new output layer for classification and continue training the resulting system with annotated tweets. The output layer starts untrained. The layers below it already reflect the pretraining task and can continue changing in response to the sentiment labels. The method therefore uses pretraining as the starting point for learning the classification task.
From Arabic text to AraXLNet sentiment predictions
The steps in order.
Assemble the Arabic pretraining corpus
The authors give 60,667,300 sentences as the size of the collected pretraining corpus. OpenSubtitles supplies 60 million different Arabic sentences and is the dominant source. Its layout places each sentence on a separate line, which the authors say simplifies preparation. These texts give the pretrained network language from a source quite different from a collection of labeled tweets.
Reviews supply the rest of the sources named in the paper. HARD contributes 93,700 hotel reviews and includes both Modern Standard Arabic and dialect writing. LABR supplies 63,000 Arabic book reviews. BRAD contributes 510,600 book reviews in Modern Standard Arabic and dialectal Arabic, and the paper describes it as an extension of LABR. The collection total describes sentences, while the review-source counts describe reviews. These units matter when interpreting the corpus description because a review is a source document and a sentence is a unit of the assembled text.
The review collections are useful to this stage for their writing. The pretraining objective asks the network to learn from the tokens that occur, even when a source collection was originally designed for sentiment research. This lets the authors make use of reviews alongside subtitles under a single learning objective. The downstream collection then supplies the labels and the genre on which they conduct the sentiment experiments.
Segment words and encode the result
The authors describe cleaning as part of preparing text. Among the material they identify for possible removal are web addresses, mention markers, hashtag markers, numerals, and non-Arabic words. The paper describes these operations at a general level. The preprocessing comparison centers on a specific decision with a named alternative, whether the pipeline uses Farasa.
Farasa handles Arabic word segmentation. Its task is to propose boundaries inside a written word that may contain attached material. The paper describes it as using a ranking variant of the SVM with linear kernels. It uses information from lexicons, vocabulary entries, and other features to score candidate segmentations. The resulting pieces give the later stages a representation in which a component can appear separately across forms where it had previously been attached to other material.
SentencePiece has a different job. It performs subword tokenization and maps the resulting units to identifiers. A sub-word unit can represent a part of a written word, allowing sequences to be expressed using the items available in a fixed vocabulary. An identifier gives each item an integer code that can be passed to the network. With Farasa enabled, Arabic-specific segmentation shapes the text that SentencePiece receives. With Farasa omitted, SentencePiece still supplies the sub-word representation. Both experimental versions therefore have a tokenizer.
This sequence of operations explains the authors’ motivation for using Farasa. When related written forms are segmented into recurring parts, their shared pieces can occur in more of the network’s inputs. That is the authors’ rationale for reducing redundant vocabulary use. The paper identifies 64 K as AraXLNet’s vocabulary size. This figure describes the inventory of encoded units. It does not describe the number of words in the corpus or how many positions a single input can have.
The preprocessing account also names [CLS] and [SEP] as special markers. The authors describe [CLS] at the start of a sentence and [SEP] at its end. These entries are part of how the paper describes the input format. Their role in the sequence is separate from the sentiment label supplied during fine-tuning. The label is the expected output for an example, whereas the markers are among the items passed through the network.
Understand the prediction task XLNet inherits
The paper introduces XLNet by comparing its objective with masked prediction. It represents a text as an ordered sequence.
x = [x₁, …, x_T]
Here x is the original text expressed as tokens, T is its length in tokens, and x₁ and x_T are the first and last tokens. A subscript gives the token’s position, and the ellipsis stands for the positions between those shown. The square brackets indicate an ordered sequence.
For BERT, the authors distinguish the original sequence, a version with some tokens masked, and the original identities of the hidden tokens. Its training problem is to recover those identities using the corrupted sequence. The paper writes the joint reconstruction objective and its position-by-position approximation. In normalized notation, the relationship is as follows.
max_θ log p_θ(x̄ ∣ x̂) ≈ max_θ ∑_{t=1}^{T} m_t log p_θ(x_t ∣ x̂)
Here θ denotes the network parameters and max_θ asks for parameter values that maximize the expression that follows. p_θ is a probability under those parameters, and log takes its logarithm. x̂ is the sequence with selected positions masked. x̄ is the set of original token identities sought at those positions. The vertical bar means “conditioned on,” so the corrupted sequence after the bar is what the predictor can use. The sum ∑ runs over position t from 1 through the sequence length T. m_t is the mask indicator. Its value is 1 when x_t, the token at position t, is a target, and it zeros out the term otherwise. The approximation sign ≈ marks the replacement of the joint prediction by separate terms for the masked positions.
The paper further expresses a masked-position probability in terms of the Transformer’s hidden representation and candidate token embeddings. Writing the position explicitly, the probability takes this form.
p_θ(x_t ∣ x̂) = exp(H_θ(x̂)_t · e(x_t)) / ∑_{x′} exp(H_θ(x̂)_t · e(x′))
On the left, p_θ(x_t ∣ x̂) is the assigned probability of the original token at position t given the corrupted sequence. On the right, H_θ is the Transformer with parameters θ. H_θ(x̂)_t is its hidden vector at position t when it processes x̂. The function e gives a token’s embedding, a vector representation used in the scoring operation. x′ denotes a candidate token in the vocabulary. The dot · is a dot product, which gives a score for pairing the hidden vector with a candidate embedding. exp applies the exponential function. The slash denotes division, and the sum ∑ in the denominator adds the exponentiated scores over candidate tokens. Dividing by that total makes the numerator’s score a probability.
The drawback highlighted by the authors lies in what the separate prediction terms can see. If neighboring words are both masked, the system sees the same corrupted input when predicting either masked position. The paper illustrates this with the country name formed by the tokens New and Zealand. In masked prediction, both identities have been hidden. The remaining words can support a prediction, but the calculation for the second part of the name has no direct access to the first part as a visible token. The missing names can be related in the actual text even though this objective predicts them separately.
XLNet changes the order in which prediction terms are written. Think of the original sentence as a row of positions. A permutation lists those positions in another order. For a given prediction term, the earlier positions in that list supply the context and the current position is the target. In a different list, the same target may have different context available. A position that stands later in the written sentence can come earlier in the list used for prediction.
max_θ E_{z ∼ Z_T}[∑_{t=1}^{T} log p_θ(x_{z_t} ∣ x_{z_{<t}})]
max_θ again denotes maximization over the parameters θ. E is an expectation, which averages the bracketed objective over the choices of ordering indicated below it. Z_T is the set of permutations of the T sequence positions. z is an ordering from that set, and ∼ indicates that it is drawn from the specified set. Within the sum, t is the step in the chosen order and goes from 1 to T. z_t is the original position listed at step t. z_{<t} denotes the positions occurring before that step, where < means “earlier than.” x_{z_t} is the target token, and x_{z_{<t}} denotes the tokens at the preceding positions in that order. p_θ gives the conditional probability of the target using those tokens, log takes its logarithm, and ∑ adds the terms.
In an ordering where New becomes available before Zealand is predicted, the latter prediction can use the former as part of its context. The example illustrates the dependency that motivates the objective. There can also be an ordering in which a token draws on a position originally to its right. Across orderings, the objective can therefore train the network to use left and right context. Within an individual prediction term, what it sees is still restricted by the order. The permutation concerns which positions count as prior information for prediction. The original sequence supplies the positions and tokens to which that order refers.
The authors identify another difference that matters for transfer. The masked objective makes [MASK] part of the input seen during pretraining. In the paper’s comparison, that particular training signal is absent from ordinary downstream inputs. XLNet’s permutation objective can impose limits on the available context without replacing target words in the input with the mask symbol. The authors present this as addressing a discrepancy between pretraining and use on downstream tasks. The AraXLNet study adopts that design and evaluates the resulting Arabic system as a classifier.
Train the network from scratch and adapt it to tweets
The authors initialize the Arabic XLNet training run without a checkpoint. Their description names train.py as the training script and TFRecords as the format used for the input records. They report a pretraining batch size of 32, where the batch size is the number of training inputs processed together for a training update. Their implementation discussion associates that setting with a TPU environment and describes adjusting batching and the number of cores for other hardware. They used Python in Google Colab and Google Cloud Storage for persistent files. After pretraining, they converted the TensorFlow checkpoint to PyTorch for sentiment fine-tuning.
In the account of what the pretrained system learns, the authors refer to word embeddings, or numerical representations obtained from the distribution of units in the text. For the sentiment stage, the procedure they describe carries forward the pretrained XLNet checkpoint. The classification interface takes the trained network and places a single linear layer above it. That layer turns the representation used for the input sequence into scores for the sentiment classes. Its initial weights have yet to learn the categories of the annotated task.
The network receives inputs of a common length for fine-tuning. The authors set the maximum sequence length to 128 and specify padding and truncation at the end. A shorter sequence is extended to the required size with padding. A sequence that exceeds the maximum is shortened at the end. The limit applies to the units represented in the input arrays after tokenization. A word that has been split contributes multiple positions, so the length limit should be read as a property of the encoded input.
During fine-tuning, the authors train the linear layer and the pretrained network together. They move inputs to the GPU, perform a forward pass to obtain predictions, compute gradients in a backward pass, and use the optimizer to update weights. A gradient indicates how changing a parameter would locally change the training objective. In this setup those updates can reach both the new classification layer and the layers that learned from the Arabic corpus. The authors monitor the training progress as they repeat this procedure on the annotated data.
The final output is a sequence classifier. Its input is a tweet represented as token identifiers, and its prediction is a class for the sequence. The experiments examine whether that process yields decisions that agree with the benchmark annotations. The two AraXLNet settings take different routes through preprocessing, but their task is the same at this stage. Each has to turn the sequence representation produced by its own training pipeline into a sentiment label.
Experiments and results
What the benchmark collections contain
The paper uses annotated Twitter data for its evaluation and benchmarks. AraSenTi contains 17,573 tweets in Saudi dialect and Modern Standard Arabic. Its original annotation scheme includes positive, negative, neutral, and mixed. This collection connects the paper’s concern with dialect variation to a specific evaluation setting. Its messages are drawn from a genre in which the authors expect to encounter forms that differ from more standardized Arabic writing.
ASTD contains over 10,000 entries and also has positive, negative, neutral, and mixed categories in the source collection. SemEval is a training and testing resource from a Twitter sentiment task whose categories are positive, negative, and neutral. The paper describes the broader SemEval resource as containing more than 70,000 tweets across Arabic and English. That is the size of the resource as described, rather than the size of the Arabic test split. The article reports AraXLNet’s result for its Arabic sentiment evaluation.
AJGT contains 1,800 tweets in Jordanian dialect. They were manually labeled positive or negative, making the original task binary. This is a different annotation setup from the other collections as described in the dataset section. The results reports for the other collections also display paired class rows, however, and the paper gives too little information to reconstruct how the original inventories became the evaluated classes. The accuracy figures are best read as scores under the paper’s reported test conditions, without assuming they cover every original label in every collection.
The sentiment labels matter separately from the size or language variety of a collection. A dataset can be useful for studying Arabic while posing an easier or harder distinction than another dataset. Which labels appear, how common they are, and which examples the classifier sees in training all shape a test result. The paper compares systems within each benchmark. It supplies no common test distribution that would turn the absolute scores across benchmarks into a ranking of dialects or of inherent difficulty.
How the paper measures a prediction
The authors evaluate classifier outputs using counts of agreement and disagreement with the labels. In the binary explanation they give, P is the number of actual positive examples and N is the number of actual negative examples. There are several ways to count successes and errors within those totals. True positives and true negatives are correctly assigned positive and negative examples. A false positive is an example predicted positive whose recorded label is negative. A false negative is an actual positive assigned the negative label. Those counts determine what each evaluation measure emphasizes.
Precision = TP / (TP + FP)
TP is the true-positive count, and FP is the false-positive count. The plus sign adds the two kinds of predicted positive examples in the denominator. The slash divides the true positives by that total. Precision therefore asks how many of the system’s positive decisions are correct.
Recall = TP / (TP + FN)
TP again counts true positives, and FN counts false negatives. The denominator adds the positives that the system found and the positives that it missed. Dividing by that total gives recall, the share of actual positives that the classifier recovered.
F1-score = 2 × (Recall × Precision) / (Recall + Precision)
F1-score is the combined measure, and Recall and Precision have the meanings given above. The multiplication sign × gives their product and applies the factor 2. The slash divides by their sum, with the parentheses specifying which operations belong together. Taking the harmonic mean of recall and precision gives this value. It falls when either measure is low, so a class score can reveal an uneven result that overall accuracy leaves harder to see.
Accuracy = (TP + TN) / (TP + FP + FN + TN)
TP and TN count correct positive and negative decisions. FP and FN count the two directions of error. The plus signs add the relevant counts, the parentheses collect the numerator and denominator, and the slash divides correct decisions by all decisions. Accuracy therefore gives each evaluated example one opportunity to contribute a correct prediction regardless of its class.
The paper also reports class support, meaning the number of labeled examples belonging to a class. Its classification reports distinguish macro averages, which give each class equal influence, and weighted averages, which take class support into account. The paper prints the following expression under its discussion of weighted averages.
Weighted average = (TP₀ + TP₁) / (Support₀ + Support₁)
TP₀ and TP₁ denote correct predictions for the classes indexed 0 and 1. Support₀ and Support₁ are the numbers of actual examples in those respective classes. The numerator adds correct predictions, and the denominator adds the available examples. The resulting ratio counts correct predictions across the displayed classes. This expression by itself gives the aggregate fraction correct when those classes cover the evaluation set. The classification reports separately label weighted precision, weighted recall, and weighted F1, each of which summarizes a different underlying measure.
How the systems compare on test accuracy
The paper compares AraXLNet with Farasa, AraXLNet without Farasa, AraBERTv1, and an SVM baseline. AraBERTv1 also uses Farasa in the comparison. The baseline comparison thus includes an Arabic pretrained system that shares the named segmenter, as well as a conventional supervised classifier. The paper discusses these systems together using the test accuracy percentages.
Test accuracy of AraXLNet and baselines on AraSenTi
AraXLNet leads the comparison with Farasa and also exceeds AraBERT without it.
The numbers
| System or setting | accuracy % |
|---|---|
| AraXLNet with Farasa (this paper) | 94.78 |
| AraXLNet without Farasa | 93.07 |
| AraBERT | 84.65 |
| SVM | 63.21 |
AraSenTi gives AraXLNet with Farasa the highest reported test accuracy in the comparison. The version without Farasa also places ahead of AraBERT on this benchmark. This makes the two comparisons informative in different ways. The ordering of the AraXLNet runs shows that Farasa improves the result in the authors’ pipeline. The position of the run without Farasa shows that the overall lead over AraBERT on AraSenTi is present in both AraXLNet settings.
Test accuracy of AraXLNet and baselines on ASTD
The Farasa setting puts AraXLNet ahead of AraBERT on this benchmark.
The numbers
| System or setting | accuracy % |
|---|---|
| AraXLNet with Farasa (this paper) | 93.01 |
| AraBERT | 92.13 |
| AraXLNet without Farasa | 88.03 |
| SVM | 69.49 |
On ASTD, the position of AraBERT lies between the two AraXLNet settings. Here the preprocessing choice changes which system leads the comparison. The ordering is the same on SemEval. AraXLNet with Farasa reaches 85.77% test accuracy there, followed by AraBERT at 85.05%, AraXLNet without Farasa at 83.64%, and the SVM at 81.08%. The numbers establish the ordering of the reported results. The paper does not give a measure of uncertainty around either benchmark’s comparison.
Test accuracy of AraXLNet and baselines on AJGT
AraBERT leads on AJGT, while Farasa improves the accuracy of AraXLNet.
The numbers
| System or setting | accuracy % |
|---|---|
| AraBERT | 91.94 |
| AraXLNet with Farasa (this paper) | 88.43 |
| AraXLNet without Farasa | 84.33 |
| SVM | 81.94 |
AJGT separates the two main claims especially clearly. AraXLNet with Farasa again outperforms its counterpart and the SVM. AraBERT nonetheless has the highest reported test accuracy. The result supports the usefulness of Farasa within AraXLNet on Jordanian tweets, while the system comparison favors AraBERT under the paper’s AJGT setup. This is the benchmark exception to the lead highlighted for AraXLNet in the abstract.
Across the benchmarks, the SVM places last in the test accuracy comparison. That is a result for the baseline as evaluated here. It gives one point of reference for what the reported AraXLNet scores mean. The AraBERT comparison sets a more demanding reference and shows a range of outcomes. The paper’s strongest AraXLNet system leads on AraSenTi, ASTD, and SemEval, while the ordering changes on AJGT.
What the classification reports add
The test percentages and the classification reports use different scales. The percentages summarize accuracy for direct comparison with the baselines. The reports give precision, recall, and F1 as decimals for the individual class rows and as aggregates. Macro F1 gives equal weight to each class’s F1, making a weaker class matter even when it accounts for fewer examples. Weighted F1 gives more influence to classes with greater support. These aggregates answer questions that the accuracy comparison cannot answer by itself.
On AraSenTi, the with-Farasa test report gives macro F1 of 0.95 and weighted F1 of 0.95. Without Farasa, both reported averages are 0.93. On SemEval, the with-Farasa report gives both macro and weighted F1 as 0.86. The version without Farasa gives macro F1 of 0.83 and weighted F1 of 0.84. In these comparisons the aggregate F1 measures favor the same preprocessing setting as accuracy.
For AJGT, the with-Farasa report gives macro F1 of 0.87 and weighted F1 of 0.88. The version without Farasa gives 0.84 for both. This shows improvement within AraXLNet under the aggregated class measures as well as under example-level accuracy. The baseline comparison on AJGT is given in accuracy, so the AraXLNet classification reports cannot be used to rank its F1 against AraBERT’s.
ASTD gives the clearest example of the value of keeping the metrics distinct. With Farasa, AraXLNet records 0.88 macro F1 and 0.93 weighted F1 in the test report. Without Farasa, macro F1 is 0.71 and weighted F1 is 0.85. The discussion introducing the results gives 0.88 as the F1 for ASTD without Farasa. In the detailed report, 0.88 is the decimal accuracy, while the labeled F1 rows give the two aggregate values above. Reading the detailed rows by their metric labels preserves that distinction.
The ASTD class rows expose the unevenness underlying these aggregates. The second displayed row has recall of 0.67 with Farasa and 0.33 without it. The first row reports recall of 1.00 in both settings. This is evidence that the effect of the comparison is distributed unevenly across the class rows. Because the paper does not identify those rows with the original ASTD labels in the results, the recall figures cannot establish which named sentiment category is being missed there.
What the ablations show
Removing Farasa changes the full training pipeline
The ablation in the paper compares an AraXLNet pipeline that uses Farasa with one that omits it. An ablation is a comparison designed to reveal the contribution of a component by changing whether it is present. Here both versions still tokenize the inputs with SentencePiece and use the XLNet approach to pretraining. The named change is the Arabic segmentation stage. The authors describe separate pretraining runs for the two settings, followed by evaluation on the same named sentiment benchmarks.
At the level of test accuracy, the direction of the result is consistent. The version using Farasa leads its counterpart on AraSenTi, ASTD, SemEval, and AJGT. The comparison is therefore evidence for including Arabic-specific segmentation in this particular route from corpus text to sentiment predictions. Its relevance is broader than how a trained classifier handles a single tweet because the segmentation setting is part of the preparation used to build the pretrained system as well.
That breadth also defines the limit of the ablation. Applying Farasa before sub-word tokenization can alter which forms SentencePiece encounters and how inputs are represented. The network then trains on the sequences it receives. The experiment compares the resulting pipelines together. It does not assign the improvement separately to the way units were defined, to what the pretraining network learned from those units, or to the representation of a downstream tweet. The result belongs to the combination used in the paper.
Aggregate improvements can hide different class behavior
The class rows give some evidence about where the improvement appears in the final decisions. On ASTD, both setups show perfect recall in the first displayed row, while the second has lower recall in both. Farasa is associated with a higher recall in that second row. This helps explain why the macro F1 comparison shows a marked change alongside the accuracy comparison. A measure with equal influence for each class reflects the poorer performance of that row even if the overall share of correct predictions remains fairly high.
Other datasets show that a better aggregate result need not mean every number improves. In the AraSenTi test report, the first displayed class has recall of 0.96 with Farasa and 0.91 without it. In the second displayed row, recall is 0.94 with Farasa and 0.96 without it. Read together, the rows show a change in how the classifier succeeds across the reported classes. They support a claim about higher overall accuracy and F1 in the with-Farasa setting. A claim that every kind of sentiment error declined would require a different pattern of evidence and clearer class identities.
The paper discusses the gains in terms of Arabic morphology. This is a plausible interpretation of a comparison in which the altered component explicitly segments Arabic words. The aggregate results tell us which setting performed better and the class reports reveal some of the effects on classification. The paper supplies no error analysis tracing individual changes in predictions back to specific segmented forms. The connection between a particular linguistic pattern and a corrected decision therefore remains a proposed explanation.
The baseline results answer a different question
The comparison with AraBERTv1 is informative because that baseline already uses Farasa. AraXLNet can lead a segmented Arabic system on several benchmarks, and on AJGT it trails one. These comparisons show where the complete system is competitive. They do not isolate permutation pretraining from the other differences between two pretrained architectures and their training setups.
The authors also give the 64 K vocabulary and XLNet’s ability to learn from bidirectional context as reasons for the system’s performance. The experiment does not vary vocabulary size or switch between masked prediction and permutation prediction within an otherwise shared AraXLNet setup. Those explanations draw on the design and motivation of the system. The reported ablation tests the decision to use Farasa. It offers no corresponding estimate for the magnitude of a vocabulary or objective effect.
The same point applies to the discussion of using more data, training for longer, and increasing batch size. The authors describe these as ways performance could improve. The results compare segmentation settings and baseline systems. They provide no series of runs in which any of those training quantities is varied individually. Their relative contribution therefore remains an open question within the study.
Limitations
The scope the authors set
The authors motivate AraXLNet with the relative scarcity of Arabic resources and the variation encountered in Arabic writing. They address that setting through general Arabic pretraining and tweet sentiment fine-tuning. The corpus includes material from different sources, and the downstream collections include writing associated with different dialects. The evaluation remains a study of polarity classification on the selected Twitter benchmarks. Support for additional language tasks would require evaluation on their corresponding data and outputs.
The closing discussion places further fine-tuning among the directions for improving Arabic sentiment performance. The authors also suggest that longer training, more data, and larger batches can help. Their experiments do not show how predictions would respond to each choice. Read as proposed directions, these statements are consistent with the study’s scope. The demonstrated comparison remains the one between the settings and classifiers for which the paper reports results.
According to the data availability statement, the corresponding author will provide the datasets that were used or analyzed upon reasonable request. Furthermore, the methods name the public collections from which the authors drew material. Those names identify the sources and help a reader understand the genres involved. The processing and evaluation descriptions are still needed to reproduce the assembled corpus and the exact examples scored in each benchmark.
What the reported classes and splits leave open
The original label inventories and the visible class reports are difficult to reconcile from the paper’s description. AraSenTi and ASTD are described as having positive, negative, neutral, and mixed categories, and SemEval is described as having positive, negative, and neutral categories. The reported per-class rows appear in pairs. The paper does not clearly give a mapping from the original labels to those rows or specify which examples were retained if the inventories were reduced. AJGT is already described as binary, but that fact provides no mapping for the other datasets.
This matters when interpreting the headline improvements. A result on a restricted set of labels and a result on an entire original benchmark can represent different decisions. The published accuracy figures describe the authors’ evaluations. They cannot settle how well AraXLNet distinguishes neutral from mixed or what happens when all of a collection’s original categories are retained. Similarly, the per-class recall figures support distinctions between displayed rows while leaving their sentiment identities uncertain.
The dataset sizes in the methods describe the collections. They do not specify the number used for each reported test result. SemEval’s stated total spans Arabic and English, and the tweet counts for the other collections describe their available entries. The paper leaves details of the partitions unclear, including the exact test support used to produce each percentage. That limits a reader’s ability to recreate the protocol and judge how representative its test cases are of the named collection.
There is also uncertainty about how the baseline comparisons were made comparable. The study identifies the AraBERT version and points out that it uses Farasa. The reported scores show the performance the paper assigns to AraBERT and the SVM. A strict comparison of implementation choices would need consistent detail on the data partitions, label mapping, and training conditions used for all of the compared systems. Those details are especially consequential when interpreting results from benchmarks whose original label inventories differ.
What the comparisons can establish about the design
The segmentation result is a repeatable pattern across the reported collections in the sense that it has the same direction in each comparison. The paper gives neither variability across repeated training runs nor intervals around the reported scores. The percentages describe the evaluated runs. Their precision as written does not tell the reader how stable the results would be under a different training run or a different partition of tweets. This matters for interpreting the narrow ordering between AraXLNet and AraBERT on some of the benchmarks.
The paper’s design also leaves the mechanism behind the segmentation gain open. Farasa could affect the distribution of units learned in pretraining and the form of labeled tweets seen during fine-tuning. The study does not evaluate those stages with independently varied segmentation choices. The sequence length limit could interact with the number of pieces a tokenizer produces, yet the paper supplies no breakdown of truncation or token counts by setting. Class outcomes are measured, while these intermediate effects remain unmeasured.
Vocabulary size and the permutation objective are still less directly tested. The vocabulary is reported as a setting, and the objective is a defining part of XLNet. A comparison with AraBERT changes the complete system, so the resulting score cannot reveal what would happen if the authors varied just the vocabulary size or just the prediction objective. Those distinctions matter if the finding is used to reason about a future Arabic system. The paper offers benchmark results for a particular combination of choices and a direct comparison for one preprocessing component.
The corpus composition raises another question about what the network learned. OpenSubtitles dominates the reported amount of text. The review collections introduce other kinds of writing, but the experiments do not compare alternative source mixtures. The paper identifies BRAD as an extension of LABR without explaining how overlapping material was handled in the pretraining collection. It also gives no breakdown of performance by which pretraining source contributed a form or expression. The benefits of specific domains in the corpus therefore cannot be inferred from the aggregate tweet scores.
How far the benchmark evidence travels
Using Twitter collections with different dialect coverage broadens the evaluation within the chosen task. AraSenTi includes Saudi dialect and Modern Standard Arabic, while AJGT provides a Jordanian collection. The benchmark results are aggregated over examples rather than separated by dialect within a collection. A score from one dataset cannot isolate the effect of dialect because that dataset also has its own examples, annotations, and class scheme.
The study fine-tunes for sentiment and then reports results on the named benchmarks. It does not test a design in which one dialect is left out of task training and held back to examine transfer. It likewise gives no direct test of the classifier on other genres such as the subtitles and reviews used for pretraining. Knowing that those genres supplied pretraining text tells us what inputs helped build the initial network. It says little by itself about whether a classifier trained on tweets would give reliable sentiment judgments on those other kinds of writing.
Finally, label agreement is the outcome that all the reported evaluation measures share. A higher score means a greater degree of agreement under the applicable metric and evaluation setup. It supplies evidence about assigning sentiment categories. It does not establish which expressions drove a prediction, how the system represents conflicting opinions inside one message, or whether annotators would agree on a difficult new case. The results are strongest when read at the same level as their test, as measurements of polarity classification on the reported Arabic tweet benchmarks.
What came after
Arabic adaptation and evaluation beyond tweets
Later papers cite AraXLNet in connection with several different problems in Arabic language processing. The titles identify the questions those studies pursued and, in some cases, the approach they evaluated. They leave the specific role of AraXLNet in each experiment unspecified.
Automated essay scoring in Arabic (2024) develops the topic of Arabic essay assessment through a dataset and an analysis of a BERT-based system. It addresses a different downstream target from AraXLNet. Where AraXLNet assigns opinion labels to short messages, essay scoring evaluates written responses according to the scoring task. The connection is the use of a pretrained architecture in an Arabic evaluation setting. The title identifies BERT as the basis of the scoring system and gives no indication that the authors ran AraXLNet on essays.
Resource-Aware Arabic LLM Creation (2024) concerns adaptation, integration, and testing across domains. It takes up the problem of developing systems for Arabic when resource use is itself part of the research question. AraXLNet addresses Arabic adaptation by pretraining an existing architecture on a collected Arabic corpus and specializing it for a downstream task. The later title places its own emphasis on resource-aware development and evaluation across domains. A citation alone does not establish which parts of AraXLNet’s preparation or training design informed that work.
Integrating AI into Arabic Linguistics (2026) proposes a methodological framework with reproducibility and interpretability as explicit concerns. This brings a different question to Arabic research with trained systems. AraXLNet reports how benchmark decisions change when the pipeline includes a particular language-specific component. A methodology for reproducible and interpretable research concerns how such experiments are documented and how their outputs are understood. The later title gives the scope of that framework without specifying an AraXLNet replication or an analysis of its predictions.
Subjectivity, system size, and dialect
Dhati+ (2025) uses fine-tuned systems to evaluate Arabic subjectivity. Subjectivity and polarity concern related properties of a text. Subjectivity concerns whether the text presents a personal perspective or judgment, while polarity concerns the direction of a sentiment. The later work shares the pattern of adapting a trained system to a specific Arabic classification problem. Its named target is subjectivity, and its title supplies no comparison with AraXLNet on the polarity datasets.
When Bigger Isn't Better (2026) directly returns to Arabic sentiment analysis and puts system size in the foreground. AraXLNet’s study compares a particular architecture and preprocessing pipeline with alternatives on benchmark accuracy. The later work’s title frames an evaluation of large language models for the same broad task around whether greater size leads to better results. That identifies a question distinct from AraXLNet’s segmentation comparison. The title gives neither numerical outcomes nor the role AraXLNet played in the evaluation.
University of Tripoli at AraSentEval (2026) fine-tunes MARBERTv2 and CAMELBERT for sentiment analysis across Arabic dialects. This is the closest continuation in task structure among the cited works. It pairs Arabic pretrained systems with sentiment fine-tuning and makes variation across dialects explicit in the evaluation. It names different systems from the ones in AraXLNet’s comparison. Its scope therefore illustrates how later work continued to study dialect coverage and task adaptation without establishing whether the same Farasa comparison would hold in its setting.
Cite
Cite as Alhanouf Alduailej and Abdulrahman Alothaim. 2022. AraXLNet: pre-trained language model for sentiment analysis of Arabic. Journal Of Big Data.
@article{alduailej2022araxlnet,
title = {{AraXLNet: pre-trained language model for sentiment analysis of Arabic}},
author = {Alhanouf Alduailej and Abdulrahman Alothaim},
journal = {Journal Of Big Data},
year = {2022},
doi = {10.1186/s40537-022-00625-z},
url = {https://doi.org/10.1186/s40537-022-00625-z}
}This page in Markdown https://md.research.elamur.ai/free/en/papers/alduailej-2022-araxlnet-pre-trained-language-model/