Team jelarson at S em E val 2024 Task 8: Predicting Boundary Line Between Human and Machine Generated Text (2024)

Abstract: In this paper, we handle the task of building a system that, given a document written first by a human and then finished by an LLM, the system must determine the transition word i.e. where the machine begins to write. We built a system by examining the data for textual anomalies and combining a method of heuristic approaches with a linear regression model based on the text length of each document.

## introduction large language models (llms) have never been more available than they are today. the consequence of this is an increase in machine-generated content within various domains. while some of this content could be considered useful, concerns related to the abuse of llms has arisen, e.g. the generation of fake product reviews @xcite , spamming/phishing schemes @xcite and fake news generation @xcite @xcite . @xcite demonstrated that humans can only detect human generated text from machine generated text at chance level. this illustrates the clear need for automatic systems to detect llm generated content. regarding mere impressionistic differences between the two types of text, it has been observed that llms tend to be more focused, i.e. never leaving the subject matter of their prompt, more objective and highly formal. their human counterparts tend to be less formal, with more propensity to stray from the topic at hand and more emotional. in terms of linguistic differences between the two, humans use less nouns and conjugations, while employing more punctuation and adverbs. dependency relations are shown to be shorter. lastly, human texts have more types in texts of the same length @xcite . an assumption many researchers take is that llms is that language models sample from the head to generate natural looking text e.g. max sampling @xcite and k-max sampling @xcite . @xcite use a bag-of-words approach with tf-idf feature vectors (both unigrams and bigrams) and a logistic regression model to differentiate between human-written web pages and text generated web pages from gpt2. they examine a different number of parameters of the llm (117m, 345m, 762m and 1,542m) as well as different sampling methods (k-sampling (sampling the highest probability tokens until a threshold of specified tokens is reached), p-sampling (sampling from the smallest possible set of words until a cumulative probability is reached) and pure sampling (also known as temperature sampling, where lower 'temperatures' are associated with higher probabilities for tokens). their findings are that the larger the llm, the harder to detect how machine-like the generated text is and k samples are easier to detect than pure samples, probably due to the fact that k samples over-produce common words, which is easy to detect using statistical methods. @xcite use bert and a group of statistical features: the probability of each word, absolute rank of each word and the entropy of the distribution and create a tool for users to see specifically what features are more likely to be machine generated over human generated. they clearly show that the model gpt-2 oversamples certain words; it is worth pointing out, however, that as llms grow more sophisticated, such methods might not work as well. @xcite use fine tuning on roberta and finds it can detect text generated from gpt-2 with an accuracy of 95%. the most noteworthy aspect of this study is that finetuning on gpt-2 itself did not yield as impressive results, which contradicts @xcite findings which allude to the idea that the best detector of text generated from llms are the llms themselves. the roberta detector has also been used in detecting fake news articles from several llms @xcite , amazon product reviews @xcite and biomedical texts @xcite . ## task this task is slightly different from the tasks described in the previous sections, since the purpose of this task is to guess the correct index at which the llm starts writing. since it no longer a binary classification task, i.e. given a document guess if it is a human or machine who wrote it, (which should be approached as an authorship attribution task), it was deemed helpful to examine other computational tasks whose purpose is to generate a boundary line in documents. @xcite used four different classifiers to classify words in bilingual documents. they found that naive-bayes worked the best using either 1-5-grams, both character and word level. @xcite used a similar bayesian model to detect language segments in multilingual documents, using byte-encoded n-grams as features and achieving the best results with higher-resource languages like english. although the task here is profoundly different from these two previous examples, we took inspiration from these studies believing there must be linguistic differences that can be detected with statistical methods between the human generated text and the machine generated text. the dataset for this task is the same from @xcite . we created a script to manually examine the transition words for all documents. one striking feature of the data is that only the human generated text featured single line breaks. another was that in many cases the transition word occurred after tokens which had a word, followed by two full stops and another word. ## data examination we also examined how frequent each transition token was in the corpus and how often it occurred as a transition word. since the final evaluation was in terms of the distance from the actual index where the transition word occurred using the formula @xmath0.split(' '), we decided to include tokens with different case and punctuation as separate tokens. ## experiments for all experiments, scores are reported as a mean of the results of three @xmath1, assuming random choice was involved somehow. ## results the solution we submitted to the contest was our baseline linear regression model, since it performed the best, with the exception of the one model with the outlier rule. we chose this over the latter since we assumed the test data would have less outliers in terms of text length, so the baseline linear regression model might perform the best. our final score for our submission was an mae of 48.139. we first examined the test data for the same anomalies found in the training data. figure 4 shows the distribution of the indexes based on text length for test data. it is much less linearly distributed than the training data (r 2 = 0.26471) and contains a lot more outliers, which explains why our linear model performed much more poorly on it. the next sections explain experiments we did with the training data to improve the linear and heuristic model. ## post hoc data analysis since the test data is less linearly distributed than the training data, we decided to try different linear models for different lengths of text. nonetheless, we still trained a linear model on the test data to get a baseline for subsequent experiments. we obtained a baseline of 44.6 mae. after, we tried different fitting the data to a different number of linear models based upon different text lengths. we used up to six different models in each experiment, adjusting bin sizes. ultimately, we fit each bin to correspond to the number of quintiles for the model e.g. for final bimodal model, we used the threshold as the median. our best result ended up being a sixmodal model with the bins 250, 500, 750, 1000 and 1250. we decided to use this linear model when applying subsequent heuristic methods. regarding heuristics, we found that of the frequent transition words in the test data, the ones that almost always occurred as the transition word in a document containing it were those with a relative frequency in the corpus under 0.0001, with the exception of commas and empty strings. combining this rule with the baseline linear model reduced mae by ~2. we then looked at repeat higher order n-grams with worse performance. even though the machine generally generated repeat higher order n-grams, it was still not predictive when determining the boundary line. lastly, we looked at frequent transition bigrams and frequent transition trigrams. setting these as the index when they occurred in a document only improved our score slightly. more than anything, they were more accurate in picking the index if they occurred at the beginning of the document, in which case the index for that document was 0.