SciAgent: Tool-augmented Language Models for Scientific Reasoning

Yubo Ma, Zhibin Gou, Junheng Hao, Ruochen Xu, Shuohang Wang, Liangming Pan, Yujiu Yang, Yixin Cao, Aixin Sun, Hany Hassan Awadalla, Weizhu ChenarXiv 2024 · DOI

Introduction

Scientific reasoning represents a "boss level" challenge for artificial intelligence. Unlike general conversation, solving complex problems in physics, chemistry, or engineering requires a precise blend of deep domain knowledge and rigorous mathematical calculation. While Large Language Models (LLMs) like GPT-4 have shown remarkable capabilities, they often falter when faced with the multi-step logic and specific formulas required in STEM fields.

Conceptual shift from internal domain reasoning to tool-augmented reasoning.

The core issue is the attempt to build "omniscient" models that store all scientific knowledge within their weights. This approach is expensive, difficult to scale, and prone to hallucinations. SciAgent proposes a paradigm shift: instead of training a model to know everything, we should train it to be a proficient tool-user. By teaching models to plan, retrieve, and execute specialized Python functions, we can leverage existing scientific libraries (like SymPy or Matlab) just as human scientists do.

The SciAgent Framework

SciAgent operates through a modular pipeline designed to bridge the gap between natural language understanding and symbolic execution. The framework consists of four consecutive stages:

  1. Planning: Upon receiving a question, the model first generates a high-level, step-by-step strategy. This plan serves as a roadmap for the subsequent steps.
  2. Retrieval: Using the generated plan as a query, a fine-tuned dense retriever (based on RoBERTa) searches a massive toolset for relevant Python functions.
  3. Action: The model then writes a solution that interleaves natural language reasoning with specific calls to the retrieved functions.
  4. Execution: A Python executor runs the code, ensuring mathematical precision and producing the final answer.
The SciAgent workflow: Planning, Retrieval, Action, and Execution.

A critical component of this framework is the MATHFUNC corpus, a training set of approximately 31,000 samples. During training, the authors employed a cross-retrieval strategy. Rather than allowing the model to generate ad-hoc code for a specific problem, it was forced to use generalized, well-documented functions derived from a broader pool. This ensures the model learns to interact with a reusable toolkit rather than simply memorizing code snippets.

Benchmarking Scientific Proficiency

To evaluate SciAgent, the researchers introduced SCITOOLBENCH, a rigorous benchmark comprising 856 questions across five domains: Mathematics, Physics, Chemistry, Finance, and EECS. This benchmark includes a dedicated toolset of 2,446 functions.

The results demonstrate a significant performance leap. SciAgent-Mistral-7B achieved 34.1% accuracy on SCITOOLBENCH, outperforming its base model (9.5%) by nearly 25% and surpassing other 7B-parameter models by over 13% in absolute accuracy. The most advanced variant, SciAgent-DeepMath-7B, reached 46.3% accuracy, notably outperforming ChatGPT (35.4%) and rivaling the performance of GPT-4 in several specialized domains.

Key Insights

  • Planning as Retrieval Context: High-level planning does more than organize the model's thoughts; it provides essential context for the retriever. A plan often contains domain-specific keywords that a raw question might lack, leading to significantly more accurate tool selection.
  • Implicit Reasoning Benefits: Access to tool documentation appears to improve the model's internal reasoning. Even when a function isn't explicitly called, the logic embedded in the documentation helps the model "imitate" correct scientific procedures.
  • Scalability via Toolsets: SciAgent's modularity allows it to adapt to new fields without extensive retraining. By simply attaching a domain-specific "plug-in" toolset, a general-purpose tool-user can become an expert in a new area.

Limitations and Future Directions

While SciAgent excels in Mathematics and Finance, its performance in Physics and Chemistry remains slightly lower, likely due to the math-centric nature of the initial MATHFUNC training data. Additionally, creating high-quality, generalized toolsets remains a manual and challenging task. Future work will focus on expanding the diversity of the training corpus and automating the discovery of scientific tools to create a truly universal scientific agent.

Summary updated

BibTeX
@misc{ma2024sciagent,
  author = {Yubo Ma and Zhibin Gou and Junheng Hao and Ruochen Xu and Shuohang Wang and Liangming Pan and Yujiu Yang and Yixin Cao and Aixin Sun and Hany Hassan Awadalla and Weizhu Chen},
  title = {{SciAgent: Tool-augmented Language Models for Scientific Reasoning}},
  year = {2024},
  eprint = {2402.11451},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2402.11451},
}
Figure