This repository contains a proof-of-concept framework for machine-learning-assisted aberration correction in scanning transmission electron microscopy (STEM). The project develops a corrector digital twin that integrates LLM-based log parsing, symbolic regression, and reinforcement learning to enable faster, more stable, and reproducible aberration correction with reduced reliance on expert operators.
Achieving sub-ångström resolution in STEM requires precise tuning of lens aberrations. In practice, aberration correction is a nonlinear, strongly coupled, and operator-dependent process: adjusting one aberration coefficient often perturbs multiple others, leading to unstable convergence and repeated trial-and-error tuning.
This project introduces an interpretable digital twin framework that learns aberration–response relationships directly from real experimental logs and uses them to autonomously optimize correction strategies.
Figure 1: AI-based digital twin framework integrating LLM-based experimental log parsing, symbolic regression-derived coupling models, a corrector simulator, and reinforcement learning-based optimization in a closed loop with the physical microscope.
The framework consists of four tightly coupled modules:
-
LLM-Based Log Parsing
Human-generated STEM aberration correction logs are automatically parsed and standardized using a large language model. The parser extracts time-ordered aberration coefficients, correction actions, and convergence behavior into structured trajectories suitable for downstream learning. -
Symbolic Regression for Aberration Coupling
A sparsity-promoting symbolic regression method (SINDy-style) is applied to the parsed trajectories to identify nonlinear and cross-coupled response relationships between corrector settings and aberration evolution. The resulting analytical expressions provide interpretable models of corrector behavior. -
Corrector Digital Twin Simulator
A lightweight aberration corrector simulator embeds the learned symbolic response functions. Given an initial aberration state and a correction action, the simulator predicts the updated aberration coefficients, optionally incorporating noise and actuation constraints to mimic experimental conditions. -
Reinforcement Learning–Based Optimization
Aberration correction is formulated as a sequential decision-making problem and solved using a Proximal Policy Optimization (PPO) agent. The agent outputs multi-parameter correction actions simultaneously, learning a robust closed-loop policy under cross-coupled dynamics and stochastic disturbances.
