Large language models can disambiguate opioid slang on social media

Kristy A. Carpenter, Issah Abubakari Samori, Mathew V. Kiang, Keith Humphreys, Anna Lembke, Johannes C. Eichstaedt, Russ B. Altman

TL;DR

Researchers from Stanford demonstrate that Large Language Models (LLMs) like GPT-5 and Claude 4.5 significantly outperform traditional keyword-based "lexicons" at identifying opioid-related discussions on social media. By leveraging contextual reasoning, these models can distinguish between ambiguous slang (e.g., "smack" as a drug vs. a physical hit) and even identify "emergent" slang they haven't seen before, offering a powerful new tool for public health monitoring.

What Problem Does This Paper Address?

Public health officials want to monitor social media to track the opioid crisis in real-time, but they face a "needle in a haystack" problem. The vast majority of social media posts are irrelevant, and the relevant ones often use "algospeak" or slang to evade censorship.

Traditionally, researchers use lexicons—predefined lists of keywords. However, lexicons fail in two major ways:

  1. Ambiguity: Terms like "blues" (oxycodone), "h" (heroin), or "smack" have common non-drug meanings. A lexicon-based filter for "h" would return millions of useless results.
  2. Evolution: Slang changes rapidly. By the time a new term is added to a research lexicon, the community may have already moved on to a new one.

Methods

The authors evaluated four state-of-the-art models: GPT-4, GPT-5, Gemini 2.5 Pro, and Claude Sonnet 4.5. They designed three specific tasks to test these models against six established research lexicons:

  • Lexicon-based Disambiguation: The LLM is given a post containing a known ambiguous term (like "fenty" or "lean") and must decide if it refers to opioids based on context.
  • Lexicon-free Identification: The LLM scans raw, un-filtered tweets to find opioid-related content without being told what keywords to look for.
  • Emergent Slang (The "Pokemon" Task): To simulate brand-new slang, the researchers replaced known drug terms with Pokemon names (e.g., replacing "fentanyl" with "Pikachu") to see if the LLM could identify the drug reference purely through the surrounding sentence structure and context.

The researchers used iterative prompting, where the model was first asked to "reason step-by-step" before providing a final "yes/no/unsure" label.

Datasets

  • September 2022 Spritzer: A random 1% sample of all tweets from that month (~100 million tweets).
  • Geolocated CA/NY Dataset: Approximately 3 million tweets from 1,628 users in California and New York, used to test "lexicon-free" performance in a real-world geographic monitoring scenario.
  • Pokemon Dataset: A curated set of 160 tweets (80 opioid-related, 80 not) where drug terms were replaced with fictional names to test reasoning on novel slang.

Key Insights and Ideas

  • Context is King: The "aha moment" of the paper is the LLMs' ability to handle the Pokemon task. Even when a drug is called a "Squirtle," the LLMs recognized the behavioral context (e.g., mentions of "kicking in," "dosage," or "withdrawal") to correctly identify the post as drug-related.
  • High Recall is Better for Filtering: In public health, it is often better to have a few "false alarms" (lower precision) if it means you don't miss any actual drug trends (higher recall). LLMs provided much higher recall than lexicons, making them superior "top-of-funnel" filters for human researchers.
  • Generalization: Performance was remarkably consistent across all four LLMs. This suggests that the ability to disambiguate slang is a general property of modern high-scale models, not a fluke of one specific architecture.

Key Results

The LLMs didn't just beat the lexicons; they blew them out of the water:

  • Lexicon-based Task: For the term "smack," the best lexicon had an F1 score of 0.009. The LLMs achieved F1 scores between 0.540 and 0.862.
  • Lexicon-free Task: LLMs achieved F1 scores up to 0.769, while the best lexicon managed only 0.540. More importantly, LLMs caught nearly all relevant posts (Recall: 0.69–0.96), whereas lexicons missed the vast majority (Recall: 0.05–0.38).
  • Emergent Slang: On the "Pokemon" data, LLMs maintained high precision (avg: 0.981), proving they don't need to know the specific "code word" to understand the underlying meaning of a conversation.

Limitations and Future Work

  • Cost and Scale: While LLMs are powerful, running them over the "Firehose" of all social media data is prohibitively expensive compared to simple keyword matching. The authors suggest using lexicons for initial broad filtering and LLMs for the second, more nuanced pass.
  • The "Unsure" Category: Models still struggle with some edge cases (like song lyrics about drugs), often labeling them as "unsure." Deciding how to handle these in a live pipeline remains a challenge.
  • Ethical Concerns: The authors explicitly warn against using these tools for individual-level surveillance or law enforcement, advocating instead for population-level health monitoring and harm reduction.
  • Prompt Sensitivity: Most prompt engineering was done on GPT-4; the authors note that performance on other models might improve further with model-specific tuning.

Summary updated

Abstract

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.
BibTeX
@misc{carpenter2026large,
  author = {Kristy A. Carpenter and Issah Abubakari Samori and Mathew V. Kiang and Keith Humphreys and Anna Lembke and Johannes C. Eichstaedt and Russ B. Altman},
  title = {{Large language models can disambiguate opioid slang on social media}},
  year = {2026},
  eprint = {2603.10313},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2603.10313},
}
Figure