Table of Contents
Fetching ...

Tag-LLM: Repurposing General-Purpose LLMs for Specialized Domains

Junhong Shen, Neil Tenenholtz, James Brian Hall, David Alvarez-Melis, Nicolo Fusi

TL;DR

Tag-LLM demonstrates that general-purpose LLMs can be repurposed for specialized domains by learning modular input tags that disentangle domain knowledge from task functions. By inserting domain tags and function tags as continuous embeddings and employing a three-stage training protocol, Tag-LLM achieves zero-shot generalization to unseen domain-function combinations and delivers strong results in translation as well as protein descriptor, QED, drug combination, and binding affinity tasks. The method is parameter-efficient, retains core linguistic capabilities, and outperforms several expert and PEFT baselines across diverse tasks, illustrating a scalable path to broadening LLM applicability in science. The work highlights practical implications for rapid, cost-effective adaptation of LLMs to evolving scientific domains while noting future directions such as broader domains, larger models, and integration with in-context learning.

Abstract

Large Language Models (LLMs) have demonstrated remarkable proficiency in understanding and generating natural language. However, their capabilities wane in highly specialized domains underrepresented in the pretraining corpus, such as physical and biomedical sciences. This work explores how to repurpose general LLMs into effective task solvers for specialized domains. We introduce a novel, model-agnostic framework for learning custom input tags, which are parameterized as continuous vectors appended to the LLM's embedding layer, to condition the LLM. We design two types of input tags: domain tags are used to delimit specialized representations (e.g., chemical formulas) and provide domain-relevant context; function tags are used to represent specific functions (e.g., predicting molecular properties) and compress function-solving instructions. We develop a three-stage protocol to learn these tags using auxiliary data and domain knowledge. By explicitly disentangling task domains from task functions, our method enables zero-shot generalization to unseen problems through diverse combinations of the input tags. It also boosts LLM's performance in various specialized domains, such as predicting protein or chemical properties and modeling drug-target interactions, outperforming expert models tailored to these tasks.

Tag-LLM: Repurposing General-Purpose LLMs for Specialized Domains

TL;DR

Tag-LLM demonstrates that general-purpose LLMs can be repurposed for specialized domains by learning modular input tags that disentangle domain knowledge from task functions. By inserting domain tags and function tags as continuous embeddings and employing a three-stage training protocol, Tag-LLM achieves zero-shot generalization to unseen domain-function combinations and delivers strong results in translation as well as protein descriptor, QED, drug combination, and binding affinity tasks. The method is parameter-efficient, retains core linguistic capabilities, and outperforms several expert and PEFT baselines across diverse tasks, illustrating a scalable path to broadening LLM applicability in science. The work highlights practical implications for rapid, cost-effective adaptation of LLMs to evolving scientific domains while noting future directions such as broader domains, larger models, and integration with in-context learning.

Abstract

Large Language Models (LLMs) have demonstrated remarkable proficiency in understanding and generating natural language. However, their capabilities wane in highly specialized domains underrepresented in the pretraining corpus, such as physical and biomedical sciences. This work explores how to repurpose general LLMs into effective task solvers for specialized domains. We introduce a novel, model-agnostic framework for learning custom input tags, which are parameterized as continuous vectors appended to the LLM's embedding layer, to condition the LLM. We design two types of input tags: domain tags are used to delimit specialized representations (e.g., chemical formulas) and provide domain-relevant context; function tags are used to represent specific functions (e.g., predicting molecular properties) and compress function-solving instructions. We develop a three-stage protocol to learn these tags using auxiliary data and domain knowledge. By explicitly disentangling task domains from task functions, our method enables zero-shot generalization to unseen problems through diverse combinations of the input tags. It also boosts LLM's performance in various specialized domains, such as predicting protein or chemical properties and modeling drug-target interactions, outperforming expert models tailored to these tasks.
Paper Structure (33 sections, 1 equation, 3 figures, 6 tables)

This paper contains 33 sections, 1 equation, 3 figures, 6 tables.

Figures (3)

  • Figure 1: Using the task of protein-drug binding affinity prediction as an example, our method injects domain tags$\langle$Protein$\rangle$, $\langle$SMILES$\rangle$ and a function tag$\langle$Binding Affinity$\rangle$ to the input, which are mapped to specially trained embeddings. The model's last hidden state is passed to a task-specific head to generate predictions of the desired type (e.g., a scalar binding affinity value in this case).
  • Figure 2: Specialized data are not all created equal. We exploit different levels of data availability in our 3-stage training protocol.
  • Figure 3: Left: MAE for varying lengths of the $\langle$DC$\rangle$ tag. As $p$ increases, the test error first decreases and then rises. The empirical optimum is $p=10$. Right: visualizing ablation performance.