B io P lanner: Automatic Evaluation of LLM s on Protocol Planning in Biology (2023)

Abstract: The ability to automatically generate accurate protocols for scientific experiments would represent a major step towards the automation of science. Large Language Models (LLMs) have impressive capabilities on a wide range of tasks, such as question answering and the generation of coherent text and code. However, LLMs can struggle with multi-step problems and long-term planning, which are crucial for designing scientific experiments. Moreover, evaluation of the accuracy of scientific protocols is challenging, because experiments can be described correctly in many different ways, require expert knowledge to evaluate, and cannot usually be executed automatically. Here we present an automatic evaluation framework for the task of planning experimental protocols, and we introduce BioProt: a dataset of biology protocols with corresponding pseudocode representations. To measure performance on generating scientific protocols, we use an LLM to convert a natural language protocol into pseudocode, and then evaluate an LLM’s ability to reconstruct the pseudocode from a high-level description and a list of admissible pseudocode functions. We evaluate GPT-3 and GPT-4 on this task and explore their robustness. We externally validate the utility of pseudocode representations of text by generating accurate novel protocols using retrieved pseudocode, and we run a generated protocol successfully in our biological laboratory. Our framework is extensible to the evaluation and improvement of language model

## introduction traditional manual methods for research in biology are time-consuming, labour-intensive, and highly prone to human error. robotic laboratory automation has the potential to increase accuracy, reproducibility, and scalability, contributing to more scientific breakthroughs and a faster transition from research to real-world applications. one important step towards automation of biology research is the automated generation of a laboratory protocol (accurate step-by-step instructions on how to complete an experiment to accomplish a specific goal) which can subsequently be converted into robot code. llms have significant latent scientific knowledge and thus may be able to formulate accurate scientific protocols, which has been demonstrated for the field of chemistry @xcite . however, to-date there has not been any clear way to evaluate the accuracy of a generated scientific protocol, except by manual evaluation. without established evaluation metrics, progress in the field of automating science remains challenging. evaluating laboratory protocols is difficult for two reasons. firstly, protocols are very sensitive to tiny details, and slight variations in instructions can lead to significantly different outcomes. when comparing generated protocols against ground truths, metrics that rely on n-gram overlaps such as bleu @xcite or contextual embeddings such as bertscore @xcite might not capture small differences, such as the order of actions, or relation between substances @xcite . secondly, the same protocol can be described correctly at various levels of granularity. the same technique (e.g. sequencing library preparation) can be described by a single line or multiple paragraphs. this variability in granularity makes it difficult to evaluate the accuracy of llm-generated protocols. we here present an automated approach to evaluating the ability of a language model to write biological protocols. our approach is inspired by robotic planning, in which a closed set of admissible actions is provided to a controller agent @xcite @xcite . we use gpt-4 to automatically convert a written protocol into pseudocode using a protocolspecific set of pseudofunctions that is generated by the model (see figure 1 ). here, a "teacher" model generates the admissible action set and correct answer in terms of step-by-step pseudocode. having access to this privileged information, we can then evaluate the performance of a "student", that has to solve the task from scratch. in this way, we then evaluate the ability of language models to generate a protocol when presented only with the appropriate pseudocode functions and a short description of the protocol. in effect, our approach allows us to automatically convert the process of writing a scientific protocol into a series of multiple-choice questions (i.e., pick a pseudofunction from a provided set), which can be evaluated much more robustly than natural language generation. this paradigm allows us to rapidly measure the protocol knowledge of gpt-3.5 and gpt-4 with minimal human intervention, and can serve as a general approach for evaluating and improving long-horizon planning in open-ended tasks in the future. to this end, we also introduce a novel dataset, bioprot, of publicly available biology laboratory protocols, containing instructions in both free text and protocol-specific pseudocode. the dataset has been reviewed by domain experts and allows evaluation of model performance several different tasks, such as next-step prediction, or full protocol generation. we further show the utility of this dataset by automatically designing and successfully executing a lab experiment using gpt-4 and the action space defined using bioprot. in summary, we make the following contributions: ## related works llms for natural sciences using llm for scientific tasks such as entity extraction in biological documents @xcite or retrieval of chemical reaction procedures @xcite is a natural use case of such models. work such as scibert, biogpt, galactica and others have also shown the utility of pretraining an llm on a corpus of biomedical @xcite @xcite @xcite or general scientific text @xcite . more recently, pre-trained generalist llms such as gpt-3 @xcite and @xcite have shown to be capable of tasks such as searching for chemical compounds similar to a given one (openai, 2023) or drug editing @xcite . furthermore, a gpt-4 agent augmented with tools has been shown to be capable of synthesis planning and drug discovery @xcite or planning reactions and executing them on a robotic platform @xcite . task decomposition llms trained on nexttoken prediction can struggle with more complex logical reasoning in naïve setups @xcite . however, decomposing complex tasks into subtasks in frameworks such as chain-of-thought reasoning @xcite , and its variants such as least-to-most @xcite and tree of thought reasoning @xcite improves performance in multi-step reasoning problems. in addition to test-time improve-ments, llms also improve in performance when trained on step-by-step reasoning data generated by larger llms @xcite . task decomposition has also been combined with self-verification through deductive reasoning to improve step-by-step reasoning accuracy @xcite . here, we approach task decomposition from another angle -we first ask the model to define a discrete set of actions needed to complete a task, and then how to compose them. planning closely related to task decomposition is planning. llms have been successful at planning in simulated and real embodied space, both through the use of restricted action space @xcite , function/tool search @xcite @xcite @xcite and translation of plans into admissible action space @xcite . planning models have been explicitly combined with chain-of-thought reasoning for performance improvement @xcite . llm planners can also learn to create their own training curriculum and refine their function use @xcite . llm-based planning and reasoning can benefit from writing problems in a machinereadable language such as planning domain definition language (pddl) and symbolic logic @xcite . furthermore, interactions with simulators and debuggers can be used to improve both plans @xcite and value functions that determine the appropriateness of action calls @xcite @xcite . our work extends recent work in planning through the automated generation of admissible action spaces and consequent evaluation without the need for a simulation environment. evaluating llm scientists evaluating llms on scientific tasks is limited to qa benchmarks for measuring general science knowledge @xcite , or specialist knowledge such as chemistry @xcite , biomedical science @xcite or medicine @xcite . however, evaluating an llm's performance on more open-ended tasks, such as healthcare support @xcite or chemical synthesis planning @xcite is done manually. to the best of our knowledge, we are the first to approach automatic evaluation of llms on open-ended problems in science. automatic evaluation of llms while evaluation of the performance of an llm in games @xcite or planning in pddl domains @xcite can be done automatically, many works rely on self-evaluation, where gpt-4 is used as an evaluator @xcite @xcite @xcite . however, these have been found to contradict human evaluation @xcite or be systematically biased @xcite , where the order of the provided responses affects the predicted ranking. in comparison to these works, we use an llm to generate pseudo-ground truth data on an easy task, in which the model consistently performs well at, which we use to evaluate on a more difficult task with real-world implications. ## the bioprot dataset here we describe the bioprot dataset -a collection of publicly available protocols that are used to evaluate the performance of llms on protocol generation on a large range of topics in biology. we discuss the contents of the dataset (section 3.1), creating a set of admissible actions and translating the protocol steps (section 3.2), manual verification of the data (section 3.3), and the tasks that can be approached with it (section 4). the dataset can be found in the supplementary materials. this approach can be used to generate pseudocode datasets in any domain that has step-by-step instructional data. ## metrics and evaluation using the bioprot dataset, we evaluate an llm's capabilities to reason about and generate scientific protocols on several different tasks. ## conclusion we have introduced a method for automatic evaluation of llms on open-ended planning problems, such as those found in experimental sciences, and a dataset of such planning problems in biology laboratory protocols. we then defined a suite of tasks and evaluation metrics that can be used to measure performance and help drive progress in the field. we evaluate gpt-3.5 and gpt-4 on these tasks and find that there is more to be desired in terms of performance. finally, we show an application of our dataset and framework, where an llm generates a protocol that is successfully executed in a laboratory.