Genaios at S em E val-2024 Task 8: Detecting Machine-Generated Text by Mixing Language Model Probabilistic Features (2024)

Abstract: This paper describes the participation of the Genaios team in the monolingual track of Subtask A at SemEval-2024 Task 8. Our best system, LLMixtic, is a Transformer Encoder that mixes token-level probabilistic features extracted from four LLaMA-2 models. We obtained the best results in the official ranking (96.88% accuracy), showing a false positive ratio of 4.38% and a false negative ratio of 1.97% on the test set. We further study LLMixtic through ablation, probabilistic, and attention analyses, finding that (i) performance improves as more LLMs and probabilistic features are included, (ii) LLMixtic puts most attention on the features of the last tokens, (iii) it fails on samples where human text probabilities become consistently higher than for generated text, and (iv) LLMixtic’s false negatives exhibit a bias towards text with newlines.

## introduction the analysis of machine-generated text (mgt) has gained popularity in recent times. this is important for detecting and attributing text to large language models (llms) such as llama @xcite and gpt @xcite , and combating fake-news, intellectual property violations @xcite , data leakages @xcite , among other malicious usages @xcite . recent efforts include zeroshot @xcite and supervised systems @xcite . however, large-scale scenarios that combine domains, data sources, or models are still challenging @xcite . as a result, different frameworks to generate high-quality mgt datasets foot_0 @xcite and evaluation campaigns have been released @xcite . in this paper, we describe our solution as the genaios team at semeval-2024 task 8: multigenerator, multidomain, and multilingual black-box machine-generated text detection @xcite . our starting point is the observation that llms assign higher probabilities to mgt than to human text. we propose llmixtic, illustrated in figure 1 , which leverages this via a transformer encoder @xcite that mixes tokenlevel probabilistic features extracted from four llama-2 models, both instructed and base flavors: llama-2-7b, llama-2-7b-chat, llama-2-13b, and llama-2-13b-chat. for each token, our features are (i) the log probability of the observed token, (ii) the log probability of the predicted token, and (iii) the entropy of the distribution. these probabilistic features capture mgt style in a precise manner, favouring detection. as a result, we obtained the best results in the official ranking (96.88% accuracy) for the monolingual track of subtask a: binary human-written vs. machine-generated text classification. our analysis shows that performance improves as more llms and probabilistic features are used. in addition, llmixtic pays more attention to the last tokens of the sequence, where higher probabilities for human texts lead to misclassifications. finally, texts with newlines are predominant among false negatives. the monolingual track of subtask a: binary human-written vs. machine-generated text classification focuses on detecting whether an english text is entirely written by a human or generated by an 🤖 llm. the data is an extension of the m4 dataset @xcite and combines texts from different domains and llms. we show the statistics of the dataset in ## system overview it is known that high-quality human text does not follow high-probability distributions over the next tokens @xcite . in contrast, llms are decoded to sample from regions of high probability, thus assigning higher probability to lowdiversity constructions and lower to human texts. in practice, this causes mgt to be measurably different from human texts, e.g., showing less idiomatic expressions, scarce and repetitive discourse markers, or strictly complying with canonical orderings of constituents @xcite . we developed our system by following these previous findings, and considering that most of the current llms share two key components which condition the probability distributions they learn: (i) the underlying backbone, namely transformer decoder, with few architectural changes and (ii) large portions of their training data both for pretraining and instruction tuning. our system relies on the hypothesis that token-level probabilistic fea-tures extracted from an specific set of llms can be used to differentiate human texts and mgt from a potentially different set of llms, which has been shown to be very effective in existing mgt detectors @xcite . as depicted in figure 1 , our final system is a transformer encoder that mixes token-level probabilistic features extracted from four llama-2 models @xcite , including base and instructed versions: llama-2-7b, llama-2-7b-chat, llama-2-13b, and llama-2-13b-chat. following @xcite , we build feature sequences where each token is represented as the concatenation of three probabilistic features extracted from each llm. specifically, we employ the following features. log probability of the predicted token. measures the highest probability assigned by θ to the next token as: entropy of the distribution. measures the uncertainty of θ for choosing the next token: log probability of the observed token. measures how likely is the observed token x i according to the model θ and the prefix @xmath0: given a text @xmath1, ..., x n ] and a set of llms @xmath2, ..., θ m }, we represent x as a feature sequence @xmath3, . . . , h n ] with each h i denoting the probabilistic features from all the llms for the i-th token, h for instance, our final system uses four llms and three features from each one, @xmath4. note that the features are extracted per-token, which constrains us to use llms with a shared tokenizer. the feature vectors in h are projected to 128 dimensions through a feed-forward layer, and then mixed with a transformer encoder of 1 layer and 4 attention heads. the output of the transformer layer is averaged and a softmax layer is used to compute a probability distribution over the human and generated classes. this classifier on top of the probabilistic features, llmixtic's only trainable component, is comprised of solely 85k parameters, being 0.0002% of the total. ## experimentation we focus on the monolingual track of subtask a, carrying out comparisons among models and ablations of the best system. for these we employ the original training and validation splits provided by the organizers. in the post-evaluation stage, we analyze the errors of llmixtic in the test set by inspecting the probabilistic features extracted from llama-2, the learned attention heads, and text patterns in the misclassified samples. ## analysis we further analyze the behavior of llmixtic in the test set by examining the probabilistic features extracted from llama-2, the learned attention heads, and patterns in misclassified samples. llmixtic fails when human text probabilities become larger than for generated texts. in contrast, llmixtic works better when the generated text probabilities are consistently larger than those from human texts. to illustrate this behavior, figure 2 shows each llm's feature averaged both for correct and erroneous predicted samples. errors occur with unusually high values of α and γ features in the human class, and unusually low values for the generated class. the effect of feature β is also notable, with the margin between human and generated curves being smaller in misclassifications. additionally, for each class, chat and base models reveal different curves for all three features. llmixtic pays more attention to the last positions. figure 3 shows the average of the attention heads across all the samples to illustrate it. this behavior could be the main cause of errors when human text probabilities become consistently larger than those for generated texts in the last positions, as shown in figure 2 . a diagonal pattern with high probability is also noticeable until approximately position 150, after which it disappears. human text is more often confused with generated text than vice versa. there are twice as many false positives as there are false negatives (714 vs. 355). this translates into a false positive rate of 4.38% and a false negative rate of 1.97%. ## conclusion we described the participation of the genaios team in the monolingual track of subtask a at semeval-2024 task 8. we proposed llmix-tic, a transformer encoder that mixes tokenlevel probabilistic features extracted from four base and instructed llama-2 models, namely llama-2-7b, llama-2-7b-chat, llama-2-13b, and llama-2-13b-chat. our system obtained the best results in the official ranking, with small false positive and false negative ratios. our ablation analyses showed that llmixtic's performance improves as more llms and probabilistic features are used. we compared these features across correctly predicted and misclassified samples, finding that llmixtic works better when mgt probabilities are consistently higher than for human text. in addition, attentions are mostly focused on the last tokens, which could be one of the causes of the errors made by llmixtic. finally, the newline character seems predominant in false negatives but not in false positives, which suggests biases either in the data or in our model. aiming to foster r&d in this area, future works will focus on textmachina, 1 a framework to generate mgt datasets for tasks such the ones addressed in this semeval shared task: detection, attribution, boundary, and mixcase detection.