Integrating Chemistry Knowledge in Large Language Models via Prompt Engineering

Hongxuan Liu, Haoyu Yin, Zhiyao Luo, Xiaonan Wang

TL;DR

This paper introduces a novel "domain-knowledge embedded prompt engineering" method to significantly improve the performance of Large Language Models (LLMs) in scientific domains like chemistry and materials science. By integrating expert knowledge directly into prompts, the LLM's accuracy and capability are boosted, while hallucinations are reduced, making LLMs more reliable tools for scientific discovery.

What Problem Does This Paper Address?

The rapid advancement of AI has led to its increasing integration into scientific fields such as biology, chemistry, and materials science. While LLMs show immense potential for tasks like virtual screening and data analysis, their application in specialized scientific domains is hampered by a lack of domain-specific knowledge. Traditional prompt engineering, while effective for general tasks, often falls short when dealing with the intricate nuances of scientific disciplines. This gap means that LLMs, despite their impressive capabilities, struggle to provide accurate and reliable answers for complex scientific questions, limiting their utility for researchers. The authors aim to bridge this gap by developing a method that imbues LLMs with domain expertise through carefully crafted prompts.

Methods

The core contribution of this paper is the development of "domain-knowledge embedded prompt engineering." This method goes beyond standard prompt engineering techniques like zero-shot, few-shot, expert, and chain-of-thought (CoT) prompting. Instead, it integrates domain-specific knowledge directly into the prompt design. This is achieved through a multi-expert approach where each "expert" (representing a domain specialist) is guided by role-playing instructions and provided with few-shot CoT demonstrations that are enriched with specific domain knowledge. This approach aims to mimic human expert reasoning more closely, leading to more accurate and contextually relevant outputs. The authors also developed a comprehensive evaluation framework using four key metrics: Capability, Accuracy, F1 Score, and Hallucination Drop, to rigorously assess the performance of different prompting strategies.

Datasets

The authors curated a new benchmark dataset consisting of 1280 questions and corresponding solutions across three material categories:

  • Organic Small Molecules: 40 molecules with significant drug properties, each with 9 structural and physical-chemical properties.
  • Enzymes: 40 enzymes from important metabolic pathways, each with 7 crucial sequence and functional information.
  • Crystal Materials: 40 representative crystals, each with 16 crucial structural and energy properties.

This dataset was designed to provide a more comprehensive evaluation of LLM performance in specific chemistry domains compared to generic benchmarks.

Key Insights and Ideas

  • Domain knowledge is crucial for scientific LLMs: The study unequivocally demonstrates that integrating domain-specific knowledge into prompts significantly enhances LLM performance in scientific tasks, leading to substantial improvements in capability and accuracy.
  • LLMs excel at logical deduction over data retrieval: While LLMs can perform complex reasoning, they struggle with precisely replicating exact data values. Their strength lies in processing and reasoning through information rather than acting as direct data retrieval conduits.
  • Verbal tasks are easier for LLMs than numerical tasks: LLMs perform better on verbal reasoning tasks. For numerical tasks, especially those involving experimental data, accuracy suffers due to hallucinations, even with advanced prompting.
  • Domain-knowledge prompts reduce hallucinations: The proposed method effectively curtails hallucinations across most task types, significantly improving the reliability and accuracy of LLM responses.
  • Complexity matters: The effectiveness of domain-knowledge prompts is tied to the complexity of the analytical subject matter and the depth of academic research available on the topic.

Key Results

The "domain-knowledge embedded prompt engineering" method consistently outperformed traditional prompt engineering strategies across various metrics. Specifically:

  • The method achieved a performance boost exceeding 100% in capability and accuracy on many tasks involving small molecules and crystal materials.
  • On average, the proposed method showed significant improvements in Capability, Accuracy, and F1 Score compared to zero-shot, few-shot, expert, and zero-shot CoT prompting.
  • Hallucination Drop was significantly reduced by the domain-knowledge embedded method, particularly for numerical and verbal tasks based on logic.
  • Case studies on MacMillan's catalyst, paclitaxel, and lithium cobalt oxide demonstrated the LLM's ability to analyze intricate details, predict reaction products, and determine crystal properties with high accuracy when guided by domain-specific prompts.

Limitations and Future Work

The authors acknowledge several limitations and suggest future directions:

  • Expansion of Domain Coverage: The current study focuses on chemistry, materials science, and biology. Future work could extend this approach to other scientific domains like physics, geology, and medicine.
  • Integration of Datasets and Tools: Enhancing LLM reasoning capabilities could be achieved by integrating external datasets and domain-specific tools, such as chemical databases or computational chemistry software.
  • Multi-Modal Prompting: Incorporating visual information (e.g., molecular structures, crystal images) into prompts could provide a more intuitive understanding for LLMs and lead to stronger performance.
  • Human-in-the-Loop Refinement: Iteratively refining prompts with input from domain experts can uncover more effective prompting strategies, leveraging the complementary strengths of LLMs and human experts.
  • Addressing Novel/Rare Molecules: Future research should focus on challenges related to leveraging LLMs for scientific inquiries into complex and novel molecules that are rarely encountered or underrepresented in the literature.

Summary updated

BibTeX
@inproceedings{liu2024integrating,
  author = {Hongxuan Liu and Haoyu Yin and Zhiyao Luo and Xiaonan Wang},
  title = {{Integrating Chemistry Knowledge in Large Language Models via Prompt Engineering}},
  booktitle = {AI4Science @ ICML},
  year = {2024},
  url = {https://openreview.net/forum?id=X3xDDoN0Gx},
}
Figure