Using large language models to understand the public discourse towards vaccination in Brazil between January 2013 and December 2019
Authors: Espinosa Laura , Salathé Marcel 
Published: February 2025

SummaryBackgroundVaccination against infectious diseases prevents diseases, saves lives, and reduces healthcare costs. However, trust, accessibility, and public perceptions influence vaccine acceptance or refusal. Risk communication and community engagement (RCCE) is key in addressing inaccurate claims and misconceptions, and improving vaccine coverage. This study examines how public stance towards vaccination evolved in Brazil from 2013 to 2019 using Twitter data.MethodsWe collected tweets in Portuguese containing vaccine-related keywords from January 2013 to December 2019 using Crowdbreaks. We used Python and GPT-4 with few-shot classification to extract the stance towards vaccination. We performed a descriptive analysis, including time and geographical components, of the stance towards vaccination. Data on measles-mumps-rubella (MMR) vaccination coverage and confirmed measles cases were also analyzed. Pairwise trend comparisons explored relationships between stance, vaccination coverage, and measles incidence.FindingsWe collected 2,197,090 tweets with 1,703,009 classified by stance. Most tweets were neutral (47%), but negative stance increased over time peaking in 2019. This decline in positive stance coincided with the resurgence of measles in 2018-2019. Some states like Rio de Janeiro and Rio Grande do Sul had a consistently lower Twitter vaccine stance (TVS) index. While no clear pattern emerged from trend comparisons, increased measles cases were often followed by a decreased TVS index.InterpretationPublic stance towards vaccination showed a noticeable geographical and temporal variation. The decline in TVS index, suggesting a possible relation with the decline in vaccination coverage, highlights the need for sustained and continuous public health efforts. Monitoring public stance in real-time can support RCCE strategies to improve vaccine confidence and uptake. Future research should integrate offline data and examine how epidemics influence public health stance.Research into contextEvidence before this studyUnderstanding the perception of vaccines by the population is one of the key determinants for ensuring appropriate vaccination coverage and successful prevention and control of vaccine-preventable diseases. Surveys used to be the traditional method to collect this information; however, public social media data allow for a more scalable approach to collect this information. Previous studies have used conceptual models, such as the “3Cs” (Complacency, Convenience, and Confidence), to understand vaccine hesitancy. Additionally, large-scale social media analyses have provided insights into vaccine-related discussions, though traditional surveys often suffer from biases and delayed reporting.Added value of this studyThis study leverages large-scale social media data and large language models (LLMs), specifically GPT-4, to classify public stance toward vaccination over seven years in Brazil. It shows the feasibility of using real-time social media analysis to track vaccine-related discourse, revealing trends in vaccine stance, and providing actionable insights. The study provides a detailed understanding of vaccine stance across different geographical and temporal components, identifying regions where negative stance is more pronounced.Implications of all the available evidenceThe findings highlight the importance of continuously monitoring vaccine stance to support successful and targeted public health interventions and RCCE strategies. While this study focused on a specific social media platform, time, and place, this approach can be easily applied to other data sources, contexts, and time periods.