cs.CLMar 3, 2026

Tracing Pharmacological Knowledge In Large Language Models

Authors: Basil Hasan Khwaja, Dylan Chen, Guntas Toor, Anastasiya Kuznetsova

Organizations: School of Electrical and Computer Engineering, Purdue University, West Lafayette, IN, USA · Viterbi School of Engineering, University of Southern California, Los Angeles, CA, USA · Stephen J. R. Smith Faculty of Engineering and Applied Science, Queen’s University, Kingston, ON, Canada · Department of Molecular and Cellular Biology, Scripps Research, La Jolla, CA, USA

Abstract

Large language models (LLMs) have shown strong empirical performance across pharmacology and drug discovery tasks, yet the internal mechanisms by which they encode pharmacological knowledge remain poorly understood. In this work, we investigate how drug-group semantics are represented and retrieved within Llama-based biomedical language models using causal and probing-based interpretability methods. We apply activation patching to localize where drug-group information is stored across model layers and token positions, and complement this analysis with linear probes trained on token-level and sum-pooled activations. Our results demonstrate that early layers play a key role in encoding drug-group knowledge, with the strongest causal effects arising from intermediate tokens within the drug-group span rather than the final drug-group token. Linear probing further reveals that pharmacological semantics are distributed across tokens and are already present in the embedding space, with token-level probes performing near chance while sum-pooled representations achieve maximal accuracy. Together, these findings suggest that drug-group semantics in LLMs are not localized to single tokens but instead arise from distributed representations. This study provides the first systematic mechanistic analysis of pharmacological knowledge in LLMs, offering insights into how biomedical semantics are encoded in large language models.

Figures & tables

Appendix figures & tables8 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. What's in a Name? Morphological Shortcuts by LLMs in Pharmacology

    Jun 4, 2026Kaijie Mo, Thomas Yang, Chantal Shaib +6Shortcut Learning in Language ModelsHallucination in Language Models

  2. Do Language Models Encode Semantic Relations? Probing and Sparse Feature Analysis

    Mar 18, 2026Andor Diera, Ansgar ScherpLLM Interpretability

  3. Employing General-Purpose and Biomedical Large Language Models with Advanced Prompt Engineering for Pharmacoepidemiologic Study Design

    Apr 20, 2026Xinyao Zhang, Nicole Sonne Heckmann, Manuela Del Castillo Suero +2LLM EvaluationHealthcare