Large language models can disambiguate opioid slang on social media
Authors: Kristy A. Carpenter, Issah A. Samori, Mathew V. Kiang, Keith Humphreys, Anna Lembke, Johannes C. Eichstaedt, Russ B. Altman
Organizations: Departments of 1Biomedical Data Science, Stanford University, Stanford, CA 94305, USA · Departments of 2Bioengineering, Stanford University, Stanford, CA 94305, USA · Departments of 3Epidemiology and Population Health, Stanford University, Stanford, CA 94305, USA · Departments of 4Psychiatry and Behavioral Sciences, Stanford University, Stanford, CA 94305, USA · Center for Innovation to Implementation Veterans Affairs Health Care System, Palo Alto, CA 94304, USA · Departments of 5Psychology, Stanford University, Stanford, CA 94305, USA · Departments of 6Genetics, Stanford University, Stanford, CA 94305, USA · Departments of 7Medicine, Stanford University, Stanford, CA 94305, USA
Social media text shows promise for monitoring trends in the opioid overdose crisis; however, the overwhelming majority of social media text is unrelated to opioids. When leveraging social media text to monitor trends in the ongoing opioid overdose crisis, a common strategy for identifying relevant content is to use a lexicon of opioid-related terms as inclusion criteria. However, many slang terms for opioids, such as "smack" or "blues," have common non-opioid meanings, making them ambiguous. The advanced textual reasoning capability of large language models (LLMs) presents an opportunity to disambiguate these slang terms at scale. We present three tasks on which to evaluate four state-of-the-art LLMs (GPT-4, GPT-5, Gemini 2.5 Pro, and Claude Sonnet 4.5): a lexicon-based setting, in which the LLM must disambiguate a specific term within the context of a given post; a lexicon-free setting, in which the LLM must identify opioid-related posts from context without a lexicon; and an emergent slang setting, in which the LLM must identify opioid-related posts with simulated new slang terms. All four LLMs showed excellent performance across all tasks. In both subtasks of the lexicon-based setting, LLM F1 scores ("fenty" subtask: 0.824-0.972; "smack" subtask: 0.540-0.862) far exceeded those of the best lexicon strategy (0.126 and 0.009, respectively). In the lexicon-free task, LLM F1 scores (0.544-0.769) surpassed those of lexicons (0.080-0.540), and LLMs demonstrated uniformly higher recall. On emergent slang, all LLMs had higher accuracy (average: 0.784), F1 score (average: 0.712), precision (average: 0.981), and recall (average: 0.587) than the two lexicons assessed. Our results show that LLMs can be used to identify relevant content for low-prevalence topics, including but not limited to opioid references, enhancing data provided to downstream analyses and predictive models.
Figures & tables
Figure 1: Bar plot of Task 1 evaluation metrics for “fenty” (solid bars) and “smack” (dotted bars). The four LLMs are compared against the naive benchmarks of including every “fenty”/“smack” tweet as opioid-related, or excluding all tweets.
Figure 2: Bar plot of Task 1 (lexicon-based task) evaluation metrics for “lean” GPT-4 performance is shown compared against the naive benchmarks of including every “lean” tweet as opioid-related, or excluding all tweets.
Figure 3: Bar plot of Task 2 (lexicon-free task) evaluation metrics for geolocated data not pre-filtered by a lexicon. The four LLMs (solid bars) are compared against six existing opioid slang lexicons (hatched bars).
Figure 4: Bar plot of Task 3 (emergent slang task) evaluation metrics. Performance is shown for both the unmodified tweets (solid bars) and modified tweets (hatched bars). The four LLMs are compared against two existing opioid slang lexicons.
Manual label
Opioid-related
Not opioid-related
Unsure
Opioid-related
35
0
0
GPT-4 label
Not opioid-related
1
412
37
Unsure
1
3
3
Table 1: Confusion matrix for GPT-4 labeling of “fenty” tweets.
Manual label
Opioid-related
Not opioid-related
Unsure
Opioid-related
33
0
0
GPT-5 label
Not opioid-related
4
415
40
Unsure
0
0
0
Table 2: Confusion matrix for GPT-5 labeling of “fenty” tweets.
Manual label
Opioid-related
Not opioid-related
Unsure
Opioid-related
37
2
4
Gemini label
Not opioid-related
0
413
35
Unsure
0
0
1
Table 3: Confusion matrix for Gemini 2.5 Pro labeling of “fenty” tweets.
Manual label
Opioid-related
Not opioid-related
Unsure
Opioid-related
28
2
1
Claude label
Not opioid-related
9
412
36
Unsure
0
1
3
Table 4: Confusion matrix for Claude Sonnet 4.5 labeling of “fenty” tweets.
Manual label
Opioid-related
Not opioid-related
Unsure
Opioid-related
23
0
9
Not opioid-related
2
5370
44
GPT-4 label
Unsure
1
86
42
Content Restriction Error
0
262
5
API Error
2
47
2
Table 5: Confusion matrix for GPT-4 labeling of “smack” tweets.
Manual label
Opioid-related
Not opioid-related
Unsure
Opioid-related
25
0
5
GPT-5 label
Not opioid-related
2
5709
61
Unsure
1
56
36
Table 6: Confusion matrix for GPT-5 labeling of “smack” tweets.
Manual label
Opioid-related
Not opioid-related
Unsure
Opioid-related
27
20
25
Gemini label
Not opioid-related
1
5737
73
Unsure
0
2
4
API Error
0
6
0
Table 7: Confusion matrix for Gemini 2.5 Pro labeling of “smack” tweets.
Manual label
Opioid-related
Not opioid-related
Unsure
Opioid-related
25
1
7
Claude label
Not opioid-related
3
5742
73
Unsure
0
22
22
Table 8: Confusion matrix for Claude Sonnet 4.5 labeling of “smack” tweets.
Manual label
Opioid-related
Not opioid-related
Unsure
Unlabeled
Opioid-related
199
36
160
0
Not opioid-related
7
1229
48
57052
GPT-4 label
Unsure
24
537
304
0
Content Restriction Error
3
981
3
0
API Error
3
48
1
0
Table 9: Confusion matrix for GPT-4 labeling of “lean” tweets.
We propose an unsupervised method of resolving slang, unique entities, and folklore from online communities by isolating words in the lexicon that have the highest magnitude of semantic shift. Semantic shift is defined as the evolution of a word's encoded representation as a result of fine-tuning a pretrained Large Language Model (LLM) on a community-specific text corpus. This value is inversely proportional to the cosine similarity between the base model's encoded representation of a word, and a fine-tuned model's encoded representation. We fine-tune the DistilRoBERTa model on text corpora collected from 3 Reddit subreddits (r/Technology, r/Gaming, r/WorldofWarcraft), model a distribution of cosine similarity over the lexicon, and show that one can successfully resolve words that have unique significance to the community by pulling data in the bottom 10-percentile. In contrast, we show that data in the top 10-percentile consist of words that carry relatively universal semantics.
Julia Kruk, Sanchita Porwal, Amitrajit Bhattacharjee +1
Georgia Institute of Technology College of Computing Atlanta, GA, USA
Opioid use disorder (OUD) remains a public health crisis in the United States, yet it is difficult to identify from electronic health records (EHRs) because missing diagnosis codes and supporting evidence are buried in clinical narratives. Accurate OUD identification is critical to support interventions and improve health outcomes. This study developed a rubric-guided large language model (LLM) that incorporated Optimization by PROmpting (OPRO) for OUD computable phenotyping (CP). The framework used an 18-item, expert-identified rubric to instruct LLMs to automatically extract critical text with supporting evidence to determine OUD flags. Two UF Health physicians (GMR and WMG) chart-reviewed 253 patients, including 68 OUD-positive cases. Our LLM-based computable phenotype (CP) achieved the best F1 score of 0.774 and an AUROC of 0.934, outperforming the machine learning-based CP using EHR and natural language processing-extracted variables, and zero-shot LLMs by relative F1 improvements of 12.8% and 44.4%, respectively. The proposed LLM-based CP could link LLM-extracted evidence to OUD phenotyping for better explainability.
Mengxian Lyu, Paredes Pardo, Cheng Peng +7
Department of Health Outcomes and Biomedical Informatics, College of Medicine, University of Florida, Gainesville, FL, USA · Department of Engineering Education, Herbert Wertheim College of Engineering, University of Florida, Gainesville, FL, USA · Department of Psychiatry, College of Medicine, University of Florida, Gainesville, FL, USA +2
Opioid overdose remains a major clinical and public health burden, highlighting the need for scalable approaches to identify patients at high risk. Here, we investigate diagnosis-specific adaptation for 180-day opioid overdose risk prediction from patients' preceding one-year longitudinal ICD histories. We develop OODMAMBA and OODQWEN through continued pretraining on longitudinal diagnostic sequences followed by task-specific fine-tuning. Building on the stronger Qwen-based predictors, we further propose OVERDOSEMOE, a multi-expert framework that integrates models of different scales using complementary expert-weighting strategies. Diagnosis-specific adaptation consistently improved predictive performance over general-purpose language-model baselines, with OODQWEN achieving an AUPRC of 24.47 and an AUROC of 68.56. OVERDOSEMOE further improved discrimination and precision, achieving an AUPRC of 25.17 and an AUROC of 69.49 while outperforming the strongest single-model baselines. Among patients ranked in the top 5% of predicted risk, OVERDOSEMOE identified substantially enriched overdose risk, achieving a PPV of 25.38% while retaining meaningful recall. Evaluation on an independent MIMIC-IV cohort further demonstrated cross-cohort robustness, with complementary weighting strategies showing advantages across different performance measures. These findings demonstrate that diagnosis-specific language-model adaptation combined with multi-expert integration can improve opioid overdose risk stratification and support more robust prediction across heterogeneous electronic health record populations.
Mingchen Li, Rohan Pandey, Junhui Qian +3
Manning College of Information and Computer Sciences, UMass Amherst, Amherst, MA, USA · Center for Healthcare Organization and Implementation Research, VA Bedford Health Care, Bedford, MA, USA · Miner School of Computer and Information Sciences, UMass Lowell, Lowell, MA, USA