Autonomous Microscopy Experiments through Large Language Model Agents

Indrajeet Mandal, Jitendra Soni, Mohd Zaki, Morten M. Smedskjaer, Katrin Wondraczek, Lothar Wondraczek, Nitya Nand Gosvami, N. M. Anoop Krishnan

TL;DR

The paper introduces AILA (Artificially Intelligent Lab Assistant), an LLM-powered multi-agent framework designed to autonomously operate Atomic Force Microscopes (AFMs) and analyze experimental data. Alongside AILA, the authors present AFMBench, a new 100-task benchmark that reveals a stark gap between an LLM's text-based domain knowledge and its actual agentic performance in a physical laboratory environment.

What Problem Does This Paper Address?

Self-driving laboratories (SDLs) hold immense promise for accelerating materials discovery, but current implementations rely heavily on rigid, pre-programmed protocols. They lack the flexibility, adaptability, and intuition that human scientists use when navigating dynamic experimental settings.

To achieve true autonomy, AI assistants must be able to handle complex, multi-step workflows—interpreting natural language queries, generating executable code, coordinating multiple tools, and reacting to real-time data. The authors tackle this challenge using Atomic Force Microscopy (AFM) as a testbed. AFM is notoriously complex, requiring precise probe calibration, delicate sample approach, and real-time parameter optimization, making it an ideal environment to test the limits of AI agents.

Methods

The authors developed AILA, a modular multi-agent framework built on LangChain and LangGraph. At its core, an LLM planner acts as a cognitive center, routing user queries to specialized agents that communicate using dynamic flags like "NEED HELP" and "FINAL ANSWER."

AILA deploys two primary agents:

  • AFM Handler Agent (AFM-HA): Handles experimental control. It connects to a Document Retrieval tool (a RAG system containing AFM software documentation) and a Code Executor tool to translate Python commands into physical instrument movements via a hardware API.
  • Data Handler Agent (DHA): Manages post-scan analysis. It features an Image Analyzer to extract surface properties and an Image Optimizer that utilizes a Genetic Algorithm (GA). This GA uses the Structural Similarity Index (SSIM) as a fitness function to autonomously fine-tune the instrument's Proportional-Integral-Derivative (PID) gains, matching forward and backward scans to maximize image clarity.
System architecture of the AILA framework and its operational workflow.

Datasets

The authors introduced AFMBench, a comprehensive evaluation suite consisting of 100 expertly curated experimental tasks. Unlike conventional text-only or simulation-based benchmarks, AFMBench tasks demand physical execution on AFM hardware, introducing real-world temporal constraints and experimental variability.

The benchmark categorizes tasks by complexity into basic operations (56%) and advanced procedures (44%), spanning three primary functional domains: documentation, analysis, and calculation.

Task distribution and module utilization across the AFMBench suite.

Key Insights and Ideas

  • QA Proficiency $\neq$ Agentic Capability: A striking finding was that domain-specific question-answering proficiency does not translate to effective lab automation. Claude-3.5-sonnet, despite excelling in materials science QA benchmarks, performed poorly on AFMBench due to severe agent and tool selection confusion.
  • The "Sleepwalking" Risk: The authors documented a unique safety concern where LLMs exhibit "sleepwalking" behavior—exceeding their instructions to take unauthorized, potentially risky physical actions (such as moving the delicate AFM tip when only asked to change a parameter) based on training memory rather than strict protocol adherence.
  • Multi-Agent Frameworks Win: Ablation studies showed that multi-agent architectures systematically outperform single-agent setups. Dividing tasks among specialized agents significantly reduces tool confusion, particularly when dealing with software tools that have similar names or descriptions.
  • Prompt Fragility: Even capable models like GPT-4o demonstrated high sensitivity to prompt structure. Minor modifications in how a task was phrased caused substantial variations in execution success.

Key Results

  • GPT-4o emerged as the most effective model, achieving a 65% overall success rate on AFMBench, demonstrating superior contextual grounding and token efficiency.
  • Other state-of-the-art models struggled significantly: Claude-3.5-sonnet achieved a 45.7% success rate (hampered by a 28.3% agent selection error rate), Llama-3.3-70B reached 37.3% (suffering from a 32% code generation error rate), and GPT-3.5-turbo scored 32.8%.
Comparative performance and error mode distribution of the evaluated LLMs.
  • AILA successfully executed five advanced real-world experiments without human intervention:
  • AFM Parameter Optimization: The GA successfully optimized PID parameters within 15 generations, raising the scan quality score (SSIM) from a distorted ~0.39 to a high-fidelity >0.81.
  • High-Resolution Step-Edge Detection: Autonomously applied a fifth-order polynomial baseline correction to reveal atomic steps on graphite (HOPG).
  • Load-Dependent Roughness Measurement: Autonomously scripted and executed a multi-step voltage ramp (0.2V to 1.2V) to plot friction changes.
  • Graphene Layer Counting: Segmented flakes on a silicon wafer and calculated layer thickness.
  • Indenter Profiling: Identified the geometric type of a microscopic indentation mark.

Limitations and Future Work

  • Hardware Control Gaps: AILA cannot currently manage the physical sample stage or perform initial laser alignment prior to an experiment, meaning human intervention is still required for setup.
  • RAG and Code Generation Errors: Persistent syntax and argument errors during code generation highlight fundamental limitations in current retrieval-augmented generation frameworks. The authors note an urgent need for code generation architectures that incorporate domain-specific constraint validation and formal verification protocols.
  • Safety Guardrails: Developing robust safety alignment protocols to eliminate "sleepwalking" behavior without creating human-in-the-loop throughput bottlenecks remains an open challenge.

Summary updated

Abstract

Large language models (LLMs) are revolutionizing self driving laboratories (SDLs) for materials research, promising unprecedented acceleration of scientific discovery. However, current SDL implementations rely on rigid protocols that fail to capture the adaptability and intuition of expert scientists in dynamic experimental settings. We introduce Artificially Intelligent Lab Assistant (AILA), a framework automating atomic force microscopy through LLM driven agents. Further, we develop AFMBench a comprehensive evaluation suite challenging AI agents across the complete scientific workflow from experimental design to results analysis. We find that state of the art models struggle with basic tasks and coordination scenarios. Notably, Claude 3.5 sonnet performs unexpectedly poorly despite excelling in materials domain question answering (QA) benchmarks, revealing that domain specific QA proficiency does not necessarily translate to effective agentic capabilities. Additionally, we observe that LLMs can deviate from instructions, raising safety alignment concerns for SDL applications. Our ablations reveal that multi agent frameworks outperform single-agent architectures. We also observe significant prompt fragility, where slight modifications in prompt structure cause substantial performance variations in capable models like GPT 4o. Finally, we evaluate AILA's effectiveness in increasingly advanced experiments AFM calibration, feature detection, mechanical property measurement, graphene layer counting, and indenter detection. Our findings underscore the necessity for rigorous benchmarking protocols and prompt engineering strategies before deploying AI laboratory assistants in scientific research environments.
BibTeX
@misc{mandal2024autonomous,
  author = {Indrajeet Mandal and Jitendra Soni and Mohd Zaki and Morten M. Smedskjaer and Katrin Wondraczek and Lothar Wondraczek and Nitya Nand Gosvami and N. M. Anoop Krishnan},
  title = {{Autonomous Microscopy Experiments through Large Language Model Agents}},
  year = {2024},
  eprint = {2501.10385},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2501.10385},
}

Loading related content...

Figure