IITR oorkee@ SMM 4 H 2024 Cross-Platform Age Detection in T witter and R eddit Using Transformer-Based Model (2024)

Abstract: This paper outlines the methodology for the automatic extraction of self-reported ages from social media posts as part of the Social Media Mining for Health (SMM4H) 2024 Workshop Shared Tasks. The focus was on Task 6: “Self-reported exact age classification with cross-platform evaluation in English.” The goal was to accurately identify age-related information from user-generated content, which is crucial for applications in public health monitoring, targeted advertising, and demographic research. A number of transformer-based models were employed, including RoBERTa-Base, BERT-Base, BiLSTM, and Flan T5 Base, leveraging their advanced capabilities in natural language understanding. The training strategies included fine-tuning foundational pre-trained language models and evaluating model performance using standard metrics: F1-score, Precision, and Recall. The experimental results demonstrated that the RoBERTa-Base model significantly outperformed the other models in this classification task. The best results achieved with the RoBERTa-Base model were an F1-score of 0.878, a Precision of 0.899, and a Recall of 0.858.

## introduction social media data (e.g., reddit and twitter) plays a crucial role in health informatics, helping researchers understand public opinions on healthrelated issues. to engage researchers and students in analyzing social media data, the social media mining for health applications (smm4h) shared tasks workshop is organized by the university of pennsylvania's health language processing lab. the smm4h-2024 workshop focuses on large language models (llms) and the generalizability of social media nlp. this year's workshop includes seven shared tasks. among these, we have worked on task 6: "self-reported exact age classification with cross-platform evaluation in english." our motivation for tackling this task stems from the observation that many patients express their health needs and medical concerns through social media. to enhance the research utility of social media data, it is essential to develop techniques for automatically identifying demographic information, such as user age, from these platforms. a detailed overview of the shared tasks in the 9th edition of the workshop can be found in @xcite the task-6 presented in this workshop is a continuation of the work from smm4h 2022 (weissenbacher et al., 2022) workshop. several papers have already been published addressing this task, highlighting its importance and the various approaches researchers have taken to solve it. for instance, @xcite , @xcite , @xcite and @xcite explored different methodologies and achieved notable results . the structure of this paper is as follows: section 2 describes the motivation for the transformer based approaches, section 3 describes the dataset and details of the classification task. section 4 outlines the methodology and various experiments conducted. section 5 discusses the results of these experiments. finally, section 6 concludes the paper, summarizing our findings and suggesting potential directions for future research. ## motivation for using transformer-based approaches the task of extracting self-reported ages from social media posts, specifically tweets, poses significant challenges due to the similarity in content between posts that do and do not contain self-reported age information. this is illustrated by the word clouds generated from the labeled & unlabelled dataset for the top 50 bigrams, as shown in figures 1a and 1b . the word clouds from the labeled (self-reported age) and unlabeled (no self-reported age) datasets appear very similar, indicating that distinguishing between the two categories based solely on content can be difficult. common phrases such as "years old," "happy birthday," and "social anxiety" are prevalent in both word clouds, which underscores the complexity of the task. given the subtle differences in the language used in these tweets, transformer-based models @xcite are well-suited for this classification task. these models leverage deep learning techniques and advanced natural language understanding capabilities to capture nuanced patterns in text. mathematically, the problem can be formulated as follows: given a set of tweets @xmath0, t 2 , . . . , t n }, the goal is to classify each tweet t i into one of two classes: ## task description and dataset the goal of this task is to develop an effective algorithm for the binary classification of tweets based on whether the exact age of the user can be determined from the tweet at the time it was posted. a tweet is labeled as "1" if the user's age can be determined from the text of the tweet at the time it was posted; otherwise, the tweet is labeled as "0." for this task, datasets are provided by the smm4h-2024 workshop. the dataset includes posts from two social media platforms: twitter and reddit. the dataset contains approximately 13,200 tweets and 100,000 reddit posts. this dataset is divided into three parts: the training data consists of 8,800 tweets from smm4h22 and 100,000 unlabeled reddit posts. for validation, we used 2,200 tweets from smm4h22 and 1,000 reddit posts related to dry eye disease, also from smm4h22. the testing data includes 2,200 tweets from smm4h22, 2,000 reddit posts about dry eye disease from smm4h22, and 12,482 reddit posts about social anxiety. the evaluation metrics used to evaluate in this task are standard metrics f1-score, precision, recall. ## methods and experiments in this task, various models from the huggingface toolkit @xcite were used for the automatic extraction of the exact age from tweets. the models used for the experiments are listed below: roberta-base @xcite : this model was trained on a dataset containing 8,800 tweets. the tweets were tokenized using the model's subword tokenizer with a maximum token length of 128. the adam optimizer (kingma and ba, 2017) was used for training with the following hyperparameters: learning @xmath1, number of @xmath2, and batch @xmath3. bert-base @xcite : the bert model from the hugging face library was used as a classifier. the create optimizer module from the hugging face toolkit library was used to fine-tune the bert model. the learning rate was set to 2e-5, and the batch size was 16. the model is trained for upto 4 epochs bilstm @xcite : bilstms are effective for binary classification tasks as they contain two separate layers, one processing the input in the forward direction and the other in the backward direction. this bidirectional processing ensures the entire text sequence is effectively classified. the sigmoid function was used as the activation function, and the adam optimizer was used for training. the model was trained for up to 5 epochs. flan t5 base @xcite : this model from the hugging face library was used for various nlp tasks, including summarizing, question answering, and text classification. for this task, the model was fine-tuned on the training dataset with a learning rate of 3e-4, a batch size of 8, and trained for 2 epochs. ## results and discussion using the validation dataset provided by the organizers of the smm4h-2024 workshop, the performance of the models was evaluated using the metrics precision, recall, and f1-score. the results of the different models on the validation dataset are presented in subsequently, the predictions of the bestperforming model, the roberta-base, were submitted on the test dataset. the results of these predictions are shown in additionally, in this context, roberta demonstrates a high level of accuracy, correctly predicting the labels for three out of the four examples. specifically, it successfully identified examples without selfreported age information (examples 1 and 3) and one with self-reported age (example 2). however, it incorrectly classified example 4, highlighting its occasional limitations in dealing with certain bert correctly predicted two examples but struggled with implicit age information. flants also performed well on two examples but was less consistent than roberta, especially with subtle context differences. bilstm, known for its sequential processing capability, accurately identified tweets without self-reported age information but had difficulty with context-dependent tweets. overall, ## conclusion this work presents our experiments on the binary classification of texts to determine whether they contain self-reported exact age information. we explored various transformer-based models, including roberta-base, bert-base, bilstm, and flan t5 base aiming to identify the most effective model for this binary classification task. our results demonstrate that the roberta-base model outperforms the other models, achieving an f1-score of 0.878, a precision of 0.899, and a recall of 0.858. the superior performance of the transformerbased models underscore their potential for practical applications in public health monitoring, targeted advertising, and demographic research. by leveraging the advanced natural language processing capabilities of transformer-based models, we were able to effectively capture nuanced patterns in text, thereby improving the accuracy of age classification tasks. while the results are promising, there are still challenges to address, such as the occasional misclassification of tweets with subtle context differences and the token limit of transformer-based models. our study highlights the importance of model robustness and the need for further research in this area. future work could focus on developing effective chunking methods for input text to improve the classification accuracy and dealing with implicit age information and diverse linguistic constructs. overall, this study demonstrates the efficacy of transformer-based models in classifying social media posts based on the presence of self-reported age information, providing a foundation for more advanced analysis of user-generated content.