June 28, 2026
A central premise of autonomous scientific imaging is that smarter navigation, whether Bayesian, RL-based, or otherwise adaptive, is the principal lever for sample-efficient acquisition. We present evidence to the contrary in scanning transmission electron microscopy (STEM), an atomic-resolution imaging modality whose every measurement deposits damaging electron dose. We introduce STEMGym, an open-source Gymnasium benchmark of 15 physics-simulated STEM worlds spanning five materials, three difficulty levels, and four characterisation tasks, scored by the Dose-Efficiency Curve area (), a single scalar capturing the information-vs-dose Pareto frontier. Across 33 agent configurations under realistic dose budgets, the dominant determinant of dose efficiency is the analyst (perception) pipeline, not the navigator: pairing a trained CNN analyst with naïve raster scanning raises by \(5.5\times\) over a CNN-free raster baseline (\(0.287\) vs.\(0.052\)), while substituting Bayesian or adaptive finite-state-machine navigation for raster yields no statistically significant further gain. Production-tier vision-language models further underperform task-specific CNNs by \({\sim}13\times\) on crystallographic defect analysis. By decoupling perception, navigation, and planning under a unified dose budget, STEMGym reframes where ML effort should be invested in autonomous electron microscopy and provides the measurement infrastructure to test it.
Scanning transmission electron microscopy (STEM) is among the most powerful techniques for characterising materials at the atomic scale. By focusing a sub-ångström electron probe and raster-scanning across a specimen, STEM produces high-angle annular dark-field (HAADF) images with contrast proportional to \(Z^{1.7}\), enabling direct visualisation of atomic columns, point defects, and phase boundaries [1]. However, the electron probe also damages the specimen: beam-induced knock-on displacement, radiolysis, and heating accumulate with total dose, progressively altering the structure being measured [2], [3]. For beam-sensitive materials such as 2D chalcogenides, where the beam itself creates the vacancies under study [4], dose efficiency is fundamental.
The natural response is autonomous agents that adaptively allocate dose, concentrating measurements where information density is highest. The field has converged on adaptive navigation as the principal lever. Yet systematic progress in this direction is hard to track. Agents are reported on incompatible specimens, instruments, dose budgets, and task definitions, with no shared protocol that isolates which component of the acquisition pipeline (perception, navigation, planning) is responsible for any observed gain. Cryo-EM has CryoBench [5] as a community reference for heterogeneity reconstruction; HAADF-STEM has no analogue, an absence the Microscopy Hackathon [6] flagged as a primary bottleneck for ML adoption.
We close this gap with STEMGym, a Gymnasium [7]-compatible benchmark (Figure 1) that holds dose budget, task definition, and evaluation protocol fixed across agents. This common ground exposes a result that, to our knowledge, has not previously been reported in autonomous STEM and is made visible by a factorial experimental design that has not been applied here before: the dominant determinant of dose efficiency is the analyst, not the navigator. Contrary to the community’s focus on adaptive acquisition strategies, equipping a trivial raster scan with a trained perception module already closes most of the achievable gap to a fully adaptive agent. Across approximately 8,000 episodes, Raster+Analyst achieves Dose-Efficiency Curve area (DEC-AUC) \(0.287\) on defect census versus \(0.052\) for Raster alone; adding open-loop Bayesian navigation or FSM planning on top of the same analyst yields no further statistically significant gain. The same pattern is independently corroborated by the PF GP-BO [8], [9] and persists across a \(50\times\) dose-budget range up to 50000 e Å−2. STEMGym provides:
15 annotated HAADF-STEM worlds generated via PRISM multislice simulation for five materials spanning four crystal structure families, at three difficulty levels.
Four characterisation tasks: defect census (F1), phase mapping (IoU), targeted characterisation (spatial F1), and particle census (composite score).
The DEC-AUC metric: captures both accuracy and convergence speed as a single scalar measuring the dose-accuracy trade-off.
33 agent configurations with causal decomposition: “equipped” baselines isolate perception from navigation contributions, plus VLM analysts and three RL baselines.
In autonomous microscopy, Bayesian optimisation has been applied to guide STEM acquisition toward relevant regions [8], [10], and sparse scanning strategies have shown that much of the specimen need not be irradiated [11]. Closer to closed-loop autonomous STEM, prior work has demonstrated active acquisition driven by deep-kernel-learning surrogates of the analyst [12] and material-specific active-learning loops [13]; both feed analyst output back into navigation, contrasting with the open-loop navigators evaluated here. More broadly, machine learning is increasingly integrated into STEM workflows for real-time analysis and automated orchestration [9], [14], and adjacent fields face analogous challenges in autonomous synchrotrons [15], scanning probe microscopy [16], and active materials discovery more broadly [17], with self-driving laboratories [18] and autonomous scientific experimentation [19] demonstrating the broader trend toward closed-loop instrument control.
Benchmarks for autonomous microscopy remain scarce, and microscopy has been argued to lack reproducible benchmarks more broadly [20]; the Microscopy Hackathon [6] identified this gap as a primary bottleneck for ML adoption. CryoBench recently addressed heterogeneity reconstruction in cryo-EM; no equivalent exists for STEM. MicroBench [21] evaluates vision-language models on microscopy image understanding, but targets classification rather than sequential acquisition, and broader scientific multimodal evaluation is anchored by MMMU [22]. State-of-the-art atom segmentation networks have been shown to perform poorly outside their training distribution [23], evidence that analyst robustness, not only navigation strategy, deserves systematic measurement.
Statistical methodology for paired benchmark comparisons across agents and tasks follows established practice [24]. The materials motivating dose-efficient STEM each present distinct characterisation challenges: perovskite oxides [25], semiconductor heterostructures [26], and catalytic nanoparticles [27]. These efforts target individual components of the microscopy pipeline; STEMGym evaluates the full acquisition loop end-to-end, from navigation through analysis to task scoring, under a unified dose budget.
We formalize STEMGym as active perception under a hard dose budget, with performance measured by an anytime dose-efficiency integral. The agent must decide where to look and how to interpret what it sees, subject to a fixed electron-dose budget that is consumed irreversibly by each acquisition. Symbol conventions used throughout are summarised in SI 7.
Environment. STEMGym is a budget-constrained sequential decision problem \[\mathcal{M} \;=\; \langle\,\mathcal{S},\,\mathcal{A},\,\mathcal{O},\,T,\,c,\,B,\,H\,\rangle, \label{eq:mdp-tuple}\tag{1}\] which we describe component by component. The hidden state \(\mathcal{S}\) encodes the tile grid and latent material labels of the specimen and is fixed for the duration of an episode. The action space is \(\mathcal{A} = \{\mathrm{\small Nav}(x,y),\,\mathrm{\small Acq}(z,d),\,\mathrm{\small Decl},\,\mathrm{\small Done}\}\), covering probe navigation, tile acquisition, finding declaration, and episode termination. The observation space \(\mathcal{O}\) comprises a Poisson-noisy \(128\!\times\!128\) HAADF tile together with the auxiliary scalars. Stage dynamics \(T\) are deterministic. Each episode runs under a dose budget \(B = \SI{5000}{\elementarycharge\per\angstrom\squared}\) and a horizon of \(H = 200\) steps. The acquisition cost function is \[c(a) \;=\; d_0\,d\,z^2 \cdot \mathbb{1}[a = \mathrm{\small Acq}], \label{eq:cost}\tag{2}\] where \(d_0 = \SI{100}{\elementarycharge\per\angstrom\squared}\) is a fixed reference dose constant that sets the physical scale, \(d\) is the requested dose multiplier, and \(z\) is the zoom factor; only Acq actions consume budget. The agent receives no per-step reward; the task score \(\rho\) enters only through the offline DEC-AUC integral.
We do not track an explicit belief over \(\mathcal{S}\); instead we operate directly on the tile history \(h_t = (o_1,\dots,o_t)\) produced by the agent’s actions. A decoupled analyst \(g\) is a function from tile histories to task predictions, \[g: \mathcal{O}^{\le H} \to \hat{\mathcal{Y}}, \label{eq:analyst-spec}\tag{3}\] implemented as either a U-Net plus CNN ensemble (trained), an intensity-thresholding heuristic (fixed \(\pm 1.5\) z-score on tile peak intensities), or a vision–language model. The instantaneous task score is \[\rho(h_t) \;=\; \mathrm{score}\bigl(g(h_t),\,y^\star\bigr) \;\in\; [0,1], \label{eq:rho}\tag{4}\] with \(y^\star\) the ground-truth specimen annotation. After the agent issues Done or exhausts \(B\), \(\rho\) is held constant at its final value through dose fraction \(f = 1\), so DEC-AUC is well defined for early-terminating policies.
Dose-efficiency curve. Let \(f_t = B^{-1}\sum_{\tau\le t} c(a_\tau)\) denote the consumed dose fraction and \(\tau(f) = \min\{t : f_t \ge f\}\). Adopting an anytime-performance view [28] and the area-under-learning-curve metric [29], the dose-efficiency curve is \(s(f;\pi,g) = \mathbb{E}_\pi\!\left[\rho(h_{\tau(f)})\right]\), and its area is \[\mathrm{DEC\text{-}AUC}(\pi,g) \;=\; \int_0^1 s(f;\pi,g)\,df \;\approx\; \sum_{k=1}^{K-1}\frac{s_{k+1}+s_k}{2}\,(f_{k+1}-f_k), \label{eq:decauc}\tag{5}\] with \(K{=}50\) uniformly spaced checkpoints at \(f_k = (k-1)/(K-1)\), so \(f_1 = 0\) and \(f_K = 1\). Score values between checkpoints are linearly interpolated.
The benchmark seeks policy–analyst pairs \((\pi,g)\) that jointly maximize dose efficiency: \[(\pi^\star,g^\star) \;=\; \arg\max_{\pi,\,g}\; \mathbb{E}_\pi\!\left[\mathrm{DEC\text{-}AUC}(\pi,g)\right]. \label{eq:objective}\tag{6}\] The dose budget \(B\) enters only through the cost function \(c\) and the support of \(f \in [0, 1]\) in Eq. 5 ; no separate constraint is needed. This formulation isolates the two levers a real microscopist controls, namely where to look (\(\pi\)) and how to interpret what was seen (\(g\)), and rewards both final accuracy and rapid convergence along the dose axis. In all experiments below \(g\) is held fixed per agent (the trained analyst, a heuristic, or a VLM); the optimisation is therefore primarily over \(\pi\).
STEMGym implements the Gymnasium Env interface with a dictionary action–observation space mirroring a real STEM session. The observation \(o_t \sim Z(\cdot\mid s_t,a_t)\)
comprises (i) the acquired \(128{\times}128\) HAADF tile, (ii) a \(64{\times}64\) low-resolution overview crop, (iii) current position, (iv) remaining dose fraction, (v) visited-tile mask,
and (vi) step fraction consumed. Episodes terminate at Done or upon budget exhaustion. World files follow the HDF5 layout described in SI 8.
Worlds are generated via PRISM multislice simulation [30] using abTEM [31], tiled into \(40{\times}40\) grids (1,600 tiles for , , Pt) or \(20{\times}20\) grids (400 tiles for SiGe, GaN). Five
material systems span four crystal structure families: (cubic perovskite, grain-boundary vacancies), (ferroelectric perovskite, phase-boundary vacancies), Si/Ge (diamond cubic, compositional gradient), GaN (wurtzite, InGaN quantum-well substitutions), and
Pt nanoparticles on amorphous carbon (aperiodic, three morphologies). All simulations use 200 keV beam energy, 21 mrad convergence, and 68 mrad–200 mrad HAADF detector angles with literature Debye–Waller factors (SI 9). Each material is generated at three difficulty levels (Table 1).
| Difficulty | Vacancy Rate | Phonon Configs | Intended Dose (e Å−2) |
|---|---|---|---|
| Easy | 5% | 4 | \(10^4\) |
| Medium | 3% | 8 | \(5 \times 10^3\) |
| Hard | 1% | 16 | \(10^3\) |
Each task instantiates the score function \(\mathrm{score}(g(b_t), y^\star) \in [0,1]\) of Eq. 4 (higher is better). For all except phase mapping, ground truth is filtered to explored tiles.
Defect census uses macro-averaged F1 on defect-type counts, with spatial F1 (within 5 nm) substituted when positions are provided and the maximum of the two reported. Phase mapping uses macro-averaged IoU across phases; reporting None on
single-phase materials yields a perfect score. Targeted characterisation uses spatial F1 via nearest-neighbour matching for locating specific defects. Particle census combines \(0.5 \cdot F_{1,\text{detect}} + 0.3 \cdot
S_\text{sizing} + 0.2 \cdot F_{1,\text{morph}}\). On Pt nanoparticle worlds, \({\sim}85\%\) of tiles contain no particle; a default “no-particle” prediction therefore scores high \(F_{1,\text{detect}}\) by correctly classifying these majority tiles, explaining the heuristic baseline of \(0.908\) in Table 2.
We operationalize Eq. 5 by recording the task score at regular acquisition intervals and interpolating to the \(K{=}50\) checkpoint grid. Agent rankings are robust to metric choice (Spearman \(\rho \geq 0.85\) vs four alternatives across \(17/20\) task–metric pairs (SI 10); discretisation error is bounded (\(0.016\) between \(K{=}20\) and \(K{=}50\), \(<0.001\) between \(K{=}50\) and \(K{=}100\)). As a secondary diagnostic we report time-to-threshold (dose fraction at which the score first reaches \(0.8\)); it is order-discontinuous when no agent crosses the threshold, motivating DEC-AUC as the primary metric.
Each agent instantiates either the navigation policy \(\pi\), the analyst \(g\), or both (Eq. 6 ). Three naı̈ve baselines provide reference points: Random performs uniform tile sampling with the heuristic analyst, Raster scans systematically left to right with the same heuristic, and GP-UCB uses a Gaussian process [32] over tile interestingness with UCB [33] acquisition and the heuristic analyst.
Equipped baselines (causal decomposition). We create equipped variants of each baseline by pairing their navigation \(\pi\) with the trained neural analyst \(g\). This \(2{\times}2\) factorial design (same analyst with different navigation vs.same navigation with different analyst) enables causal attribution of performance differences to the two factors of Eq. 6 .
STEMAgent is a multi-agent system coordinating (1) a GP-UCB Navigator with dynamically adjusted \(\beta\), (2) a neural Analyst (U-Net ensemble for atom finding, CNN for defect classification, ResNet for phase identification), and (3) an FSM Planner transitioning through SURVEY\(\to\)INVESTIGATE\(\to\)CHARACTERIZE\(\to\)CENSUS\(\to\)TERMINATE modes (SI 11).
Four ablation variants of STEMAgent quantify component contributions: No Planner (\(\beta{=}2.0\) constant), No Uncertainty (single model), Rule Planner (alternative thresholds), and LLM Planner (API-based mode decisions). Production-tier VLM agents (Claude Haiku 4.5, GPT-5 mini, Llama 4 Scout, Gemini 2.0 Flash) replace the CNN analyst via a hybrid approach combining traditional atom localisation with VLM-based classification from upscaled (\(256{\times}256\)) tiles.
Three RL baselines trained via Stable-Baselines3 [34] for 50,000 steps each round out the agent set: DQN [35] and PPO [36] use a discrete \(8{\times}8\) spatial grid \(\times\) 3 action types (192 actions), while SAC [37] uses a continuous \(\text{Box}(2)\) action space over normalised coordinates.
We evaluate all agents at dose budget 5000 e Å−2 with 10 seeds per configuration (\({\sim}8{,}000\) episodes total; per-experiment breakdown, analyst-training splits, and hyperparameters in SI 18, 9, 12). Rankings are robust to scoring cadence (Spearman \(\rho > 0.95\); Fig. 4a,b in SI 16). For atom-level tasks (defect census, targeted, particle census), ground truth is filtered to agent-explored tiles—applied uniformly to all agents—so agents are not penalised for regions unreached within budget; phase mapping uses the full-field ground truth since phase labels are spatially extensive.
| Agent | Defect Census | Phase Mapping | Targeted | Particle Census |
|---|---|---|---|---|
| Random | \(0.028 \pm 0.027\) | \(0.000 \pm 0.000\) | \(0.000 \pm 0.000\) | \(0.553 \pm 0.353\) |
| Raster | \(0.052 \pm 0.038\) | \(0.000 \pm 0.000\) | \(0.000 \pm 0.000\) | \(0.908 \pm 0.000\) |
| GP-UCB | \(0.034 \pm 0.037\) | \(0.000 \pm 0.000\) | \(0.000 \pm 0.000\) | \(0.562 \pm 0.375\) |
| Raster+Analyst | \(0.287^{a} \pm 0.129\) | \(0.168 \pm 0.023\) | \(0.112 \pm 0.033\) | \(0.000^{\dagger\dagger} \pm 0.000\) |
| GP-UCB+Analyst | \(0.283^{a} \pm 0.122\) | \(0.184 \pm 0.051\) | \(0.127 \pm 0.089\) | \(0.000^{\dagger\dagger} \pm 0.000\) |
| STEMAgent | \(0.278^{a} \pm 0.120\) | \(0.185 \pm 0.033\) | \(0.134 \pm 0.085\) | \(0.000^{\dagger\dagger} \pm 0.000\) |
| PF GP-BO\(\dagger\) | \(0.013 \pm 0.006\) | \(0.363 \pm 0.000\)\(\ddagger\) | \(0.000 \pm 0.000\) | — |
| PF GP-BO+Analyst\(\dagger\) | \(0.163 \pm 0.030\) | \(0.128 \pm 0.125\) | \(0.348 \pm 0.048\) | — |
| CS-20%+Analyst\(\ddagger\ddagger\) | \(0.175 \pm 0.055\) | \(0.305 \pm 0.185\) | — | — |
| DQN | \(0.112 \pm 0.089\) | \(0.000 \pm 0.000\) | \(0.000 \pm 0.000\) | \(0.481 \pm 0.388\) |
| DQN+Analyst | \(0.121 \pm 0.089\) | \(0.149 \pm 0.081\) | \(0.205 \pm 0.150\) | \(0.000 \pm 0.000\) |
| PPO | \(0.002 \pm 0.001\) | \(0.000 \pm 0.000\) | \(0.000 \pm 0.000\) | \(0.010 \pm 0.000\) |
| PPO+Analyst | \(0.001 \pm 0.002\) | \(0.000 \pm 0.000\) | \(0.009 \pm 0.002\) | \(0.000 \pm 0.000\) |
| SAC | \(0.041 \pm 0.049\) | \(0.000 \pm 0.000\) | \(0.000 \pm 0.000\) | \(0.690 \pm 0.378\) |
| SAC+Analyst | \(0.259 \pm 0.139\) | \(0.184 \pm 0.027\) | \(0.120 \pm 0.096\) | \(0.000 \pm 0.000\) |
Table 2 reports DEC-AUC across all agent-task combinations. On defect census, equipped agents outperform naı̈ve baselines by roughly \(5{.}5\times\) (Raster+Analyst \(0.287\) vs Raster \(0.052\); paired Wilcoxon \(p < 0.001\)). Within the equipped group, however, the three navigators are statistically indistinguishable at the tested coverage regime: their DEC-AUC values fall within \({\sim}0.01\) of each other, pairwise Wilcoxon yields \(p > 0.05\), bootstrap \(95\%\) CIs overlap, and TOST formally supports equivalence at \(\Delta = 0.05\) DEC-AUC under two one-sided Wilcoxon tests (entries marked \(^{a}\) in Table 2; full statistics in SI 14). The within-equipped numerical ordering is therefore not load-bearing; what is supported is that adding adaptive Bayesian navigation or FSM-based planning on top of a trained analyst yields no statistically significant gain over a raster scan with the same analyst. All three navigators are open-loop with respect to analyst output; closed-loop variants that condition acquisition on analyst predictions are not evaluated here.
Once a capable analyst is supplied, per-episode variance (\(\sigma \approx 0.12\) for all three equipped agents) is dominated by cross-world heterogeneity rather than agent stochasticity. The effect is sharpest at the per-world level: on , three navigators with markedly different exploration trajectories (Random+CNN \(0.301\), STEMAgent \(0.377\), GP-UCB+CNN \(0.394\)) cluster within \({\sim}0.09\) DEC-AUC, so distinct spatial strategies converge to nearly the same dose-efficiency outcome (trajectories in SI 19). This reinforces that navigation is not the load-bearing factor.
As an external check, the PF GP-BO baseline is competitive with our in-house equipped agents within perovskites but degrades to a \({\sim}14\times\) gap on non-perovskite defect census (SI 15). The same asymmetry on an independently-implemented prior-art method reinforces that cross-family generalisation, not navigation strategy, is the open problem.
On particle census, the perception ranking inverts: naı̈ve Raster achieves \(0.908\) via the no-particle prior (§3.4), while every equipped agent scores \(0.000\). The crystallography-oriented CNN classifies nanoparticle tiles as anomalous, demonstrating that a strong analyst for one task class can be counterproductive for another. Pt was additionally held out from analyst training (SI 9), so the \(0.000\) score reflects both held-out generalisation and architectural specialisation, two effects this benchmark does not separate.
Budget sensitivity. Across a \(50\times\) dose-budget sweep (1000 to 50000 e Å−2, reaching \({\sim}31\%\) coverage at the upper end), the within-equipped ranking is preserved with Raster+Analyst leading; its margin over GP-UCB+Analyst grows from \({\sim}0.005\) at the baseline budget to \({\sim}0.040\). SiGe stays at \(0.05\)–\(0.08\) across all budgets (Figure 2d), the cleanest illustration that material-specific analyst limits dominate over measurement strategy (SI 16).
Difficulty scaling. On across three difficulty levels (vacancy rate \(4\%\to3\%\to1.5\%\), \(1\to3\) wavy phase boundaries, \(4\to16\) frozen-phonon configurations), equipped agents stay within a narrow \(0.293\)–\(0.359\) band on defect census while naı̈ve baselines remain below \(0.10\) and naı̈ve phase mapping is exactly zero at every level (SI 17).
Compressed sensing. A sparse random mask with total-variation reconstruction [38], [39] feeding the trained analyst reaches \(0.149\)–\(0.175\) DEC-AUC across \(10\)/\(20\)/\(30\%\) mask coverage on the same crystalline worlds (Table 2). The comparison is diagnostic given the domain shift from raw HAADF to TV-inpainted tiles (SI 21).
Replay validation. A held-out synthetic specimen (the replay_world HDF5 file in our release) preserves the equipped-vs-naı̈ve family ordering (Raster \(>\) GP-UCB \(>\) Random; Figure 2h), with STEMAgent ranking below all three on this specimen (SI 26).
Sim-to-real anchor. On five real Sm-doped acquisitions (Sm \(\in \{0, 7, 10, 13, 20\}\%\)) [40], surfaced via the 2024 Mic-hackathon team 14 notebook, Raster+Analyst attains \(0.066\) and \(0.088\) DEC-AUC on the Sm \(0\%\) and \(13\%\) compositions and degenerates to \(0.000\) on the other three (zero-shot transfer of a perovskite-trained analyst to a chemically-different perovskite). The heuristic raster baseline scores \(0.000\) on every composition; the equipped-vs-naı̈ve direction is preserved or tied on all five and never inverts (SI 27).
Four production-tier VLMs (Claude Haiku 4.5, GPT-5 mini, Llama 4 Scout, Gemini 2.0 Flash) are paired with Raster and GP-UCB navigation and compared against heuristic and CNN baselines on three tasks across the five easy worlds (760 effective episodes after GPT-5 mini was excluded for \({\sim}100\%\) retry-exhausted empty-content failures). To test whether the perception gap is a tier-of-model artefact, we additionally ran a frontier-flagship sanity check with Claude Opus 4.7 on defect census (\(5\) worlds \(\times\) \(3\) seeds, raster navigation, no parse failures): mean DEC-AUC \(0.016\) on the four crystalline worlds, sitting inside the production-tier band and \({\sim}15\times\) below Raster+Analyst. Methodology, prompts, retry harness, and per-model diagnostics are in SI 22–23.
On crystallographic worlds (, , SiGe, GaN), the trained CNN dominates: Raster+Analyst averages \(0.247\) DEC-AUC on defect census versus the best VLM (Raster+Gemini) at \(0.019\), a \({\sim}13\times\) gap, with Raster+Claude at \(0.006\) and Raster+Llama at \(0.019\). On Pt nanoparticles the pattern inverts: Raster+Claude matches the trivially-correct naı̈ve Raster score (§3.4), Raster+Gemini reaches \(0.628\), and Raster+Llama reaches \(0.458\), while the CNN scores \(0.000\) (the particle-census inversion). The CNN was trained for atomic-column localisation and treats aperiodic features as anomalies, whereas production-tier VLMs encode general visual priors that recognise dispersed bright objects on textured substrates; the architectures are genuinely complementary, and the result motivates hybrid perception that routes to the appropriate analyst per specimen type rather than choosing a single one. This complementarity is symmetric in aggregate: across all five easy worlds, Raster+CNN (\(0.198\)) and Raster+Claude Haiku (\(0.186\)) tie within \({\sim}6\%\) overall (SI 24). The crystallographic gap is therefore a within-domain finding rather than a global verdict on perception architecture, and which family “wins” depends on the specimen-type weighting of the evaluation suite. On the targeted task the inversion does not appear: the CNN reaches \(0.490\) on crystalline worlds while every VLM stays below \(0.020\), and all approaches score \(0.000\) on Pt. VLMs are useful for coarse scene-level classification but not for the spatially precise localisation that targeted characterisation requires.
The working models had \({\le}3\) parse failures across the full run, so DEC-AUC reflects actual perception limits rather than I/O artefacts. Per-step wall-clock latency for all agent classes is tabulated in SI 18.
A \(4{\times}4\) cross-material transfer matrix (rows: training material; columns: evaluation material) reveals strong within-perovskite generalisation: -trained models reach \(0.723\) on and -trained models reach \(0.830\) on . Cross-family transfer is poor: SiGe in-domain \(0.039\), GaN \(0.018\) (Pt excluded; morphological labels are incompatible). The same asymmetry appears in the PF GP-BO baseline, corroborating that the gap is a property of cross-family transfer rather than our particular analyst. Full matrix in SI 16; PF GP-BO breakdown in SI 15.
Reinforcement learning offers a contrasting baseline. Three RL agents (DQN, PPO, SAC) trained for \(50{,}000\) steps on the easy worlds score near random without trained perception (DQN \(0.112\), SAC \(0.041\), PPO \(0.002\)). With the analyst, SAC+Analyst (\(0.259\)) approaches Raster+Analyst while PPO+Analyst (\(0.001\)) collapses entirely: algorithm class matters when perception is available, and the sparse terminal reward in a \(200\)-step horizon penalises on-policy methods most. Acquisition-function comparison (UCB vs.EI vs.TS) and STEMAgent ablations are statistically indistinguishable (max spread \(< 0.024\)). Full RL configurations and ablation tables are in SI 25 and 20.
Validation scope. STEMGym worlds use PRISM multislice with frozen-phonon Debye–Waller factors and Poisson detector noise; they omit inelastic scattering, specimen drift, surface contamination, beam-induced damage accumulation, and detector non-linearity. The five-composition Sm-doped sanity check (§4.2) anchors the equipped-vs-naı̈ve direction on real HAADF-STEM acquisitions but does not constitute multi-instrument cross-material validation. The trained analyst is fitted on four easy-difficulty worlds (, , SiGe, GaN) and evaluated on rollouts that traverse the full tile grid of every evaluated world, so equipped DEC-AUC reflects near-distribution generalisation within seen material families; strict cross-family transfer is reported separately (Pt-held-out particle census; SI 16).
Open-loop navigation caveat. All evaluated navigators are open-loop with respect to analyst output: acquisition decisions do not condition on the analyst’s predictions. Closed-loop variants such as analyst-uncertainty-guided GP-UCB would be the natural next test of the perception-dominance claim. Compressed sensing addresses how to reconstruct rather than where to look; the CS+Analyst row is diagnostic given the raw-HAADF-vs-TV-inpainted domain shift, and a retrained analyst on inpainted tiles would isolate the two effects (SI 21). Navigation is modelled as dose-free and latency-free; real-instrument repositioning costs would only reduce the advantage of adaptive strategies over raster scanning, reinforcing the second-order role of navigation (a movement-penalised extension is sketched in SI 13).
Coverage and training scale. Five material systems span four crystal-structure families (perovskite, diamond cubic, wurtzite, FCC metallic), but three are perovskite or perovskite-adjacent; MXenes, MOFs, 2D chalcogenides, organics, and amorphous solids are not yet included. The three RL agents are trained for \(50{,}000\) environment steps, near the lower end of typical RL budgets.
The dominant lever for dose efficiency is analysis: open-loop navigation strategies that do not condition on analyst output contribute negligibly once a competent analyst is supplied. Equipping raster scanning with trained perception yields a \(5.5\times\) improvement at the baseline budget and remains the primary determinant across the full 1000–50000 e Å−2 sweep, with navigation and planning second-order across all difficulty settings and dose budgets. The same direction is preserved on the five-composition Sm-doped real-data sanity check: zero-shot transfer of a perovskite-trained analyst to real acquisitions never inverts the equipped-vs-naı̈ve direction across a controlled doping gradient (SI 27).
The mechanism behind the flat navigation trend is straightforward: the GP-UCB navigator optimises intensity variance, a proxy that does not predict defect presence, and the FSM planner’s \(\beta\) transitions barely alter behaviour on a \(40{\times}40\) grid where broad exploration visits only \({\sim}50\) of \(1{,}600\) tiles. Closing the loop between perception and navigation is therefore the most promising direction for further gains, and the DEC-AUC of \(0.287\) on defect census reflects task difficulty in this regime rather than metric saturation: substantial headroom remains for closed-loop navigation and learned-embedding analysts.
Specialisation within the analyst is the next frontier. The particle-census inversion (CNN \(0.000\), heuristic \(0.908\)) and the VLM/CNN complementarity on aperiodic vs.crystalline specimens together motivate a learned perception router that dispatches to the appropriate analyst per specimen type. Within-family generalisation is supported by the \(\leftrightarrow\) pair (\(0.72\)–\(0.83\) DEC-AUC, corroborated by the PF GP-BO baseline; §4.3), and extending to a third perovskite or to non-perovskite crystal classes (MXenes, MOFs) is a natural follow-up enabled by the HDF5 world format.
Reproducibility Statement. All code, data generation scripts, trained model checkpoints, and experiment configurations are publicly available at https://github.com/KurbanIntelligenceLab/STEMGym, with pre-generated world files on Hugging Face as stem-gym-benchmark. Code and data are released under MIT/CC-BY-4.0; extended environment-setup, dependency, and re-run instructions are in SI 28.
| Symbol | Meaning |
|---|---|
| \(B\) | Per-episode dose budget in e Å−2 (default \(5{,}000\)). |
| \(H\) | Episode horizon in environment steps (default \(200\)). |
| \(d_0\) | Reference dose constant, \(\SI{100}{\elementarycharge\per\angstrom\squared}\). |
| \(d\) | Per-acquisition dose multiplier passed in the action; appears as \(d\) in Eq. [eq:cost] and SI [sec:app:nav95cost]. |
| \(c\) | Per-action dose cost (Eq. [eq:cost]); zero for \(\textsc{Nav}\), \(\textsc{Decl}\), \(\textsc{Done}\). |
| \(z\) | Zoom factor (per-acquisition action argument); distinct from atomic number \(Z\). |
| \(Z\) | Atomic number (Introduction; appears only in \(Z^{1.7}\) HAADF-contrast scaling). |
| \(f, f_t\) | Consumed dose fraction \(f_t = B^{-1}\sum_{\tau\le t} c(a_\tau)\). |
| \(\tau(f)\) | DEC hitting time, \(\min\{t : f_t \ge f\}\); not to be confused with the SAC Polyak coefficient \(\tau_\text{pol}\) in SI [sec:app:rl]. |
| \(K\) | Number of DEC-AUC checkpoints (default \(50\)). |
| \(y^\star\) | Ground-truth task target. |
| \(g\) | Analyst, \(g: \mathcal{O}^{\le H} \to \hat{\mathcal{Y}}\) (trained ensemble, heuristic, or VLM). |
| \(\rho\) | Task score \(\rho(h_t) \in[0,1]\). |
| \(\beta\) | GP-UCB exploration coefficient; the FSM mode-dependent value is documented in SI [sec:app:stemagent]. |
| \(\sigma\) | Standard deviation of DEC-AUC over seeds. We use \(\sigma_G\) for the Gaussian target width in the AtomFinderUNet (SI [sec:app:simulation]) and \(\sigma_\partial\) for grain-boundary sharpness in the world generators when those distinct meanings are needed. |
/metadata/ # Scalar attributes
pixel_size_nm float # Nanometers per pixel
tile_size_px int # Tile edge length (128)
overlap_px int # Overlap between tiles (4)
grid_shape (2,) # (rows, cols) tile grid
fov_nm (2,) # Field of view in nm
/overview (H, W) float32 # Low-res overview
/tiles/{row}_{col} (128, 128) float32 # Normalized HAADF
/ground_truth/
atom_positions (N, 2) float32 # nm coordinates
atom_types (N,) int32 # 0=pristine, 1=vac, 2=sub
defect_mask (N,) bool # True if defect
phase_map (H, W) int32 # Optional
/valid_region (H, W) bool
All simulations use 200 keV beam energy, 21 mrad convergence semi-angle, and HAADF detector angles of 68 mrad–200 mrad. Frozen-phonon thermal diffuse scattering uses literature RMS displacements: Sr 0.084 Å, Ti 0.060 Å, O 0.085 Å for [41]; Ba 0.080 Å, Ti 0.080 Å, O 0.090 Å for [42] (elevated Ti displacement from order–disorder ferroelectric transition); Si 0.078 Å, Ge 0.085 Å for SiGe [43]; Ga 0.059 Å, N 0.063 Å, In 0.065 Å for GaN [44]; Pt 0.070 Å, C 0.080 Å for Pt/C [43]. PRISM interpolation factor is 2, with 0.05 Å real-space sampling and 1.0 Å slice thickness. Large fields of view are simulated as 7 nm sub-tiles with 1 nm overlap, blended via linear ramps.
The ensemble is trained on tiles from four easy-difficulty worlds (, , SiGe, GaN; \({\sim}\)3,000 tiles total), with Pt excluded as held-out material. Within each of the four training worlds, tiles are split 80/20 (seed 42) at the tile level. There is no held-out evaluation world for the four training materials; agent rollouts at evaluation time traverse the full grid of all evaluated worlds, including both training-split and validation-split tiles. Equipped DEC-AUC therefore reflects near-distribution generalisation within seen material families. Strict cross-family generalisation is reported separately in the cross-material transfer matrix (Fig. 4d, SI 16) and the Pt-held-out particle census. AtomFinder targets are Gaussian probability maps (\(\sigma{=}2\) px) with BCE loss. DefectClassifier uses \(32{\times}32\) patches with class-balanced subsampling (max 50,000 patches) and weighted CE. PhaseIdentifier trains only on multi-phase worlds (, GaN). Augmentation: random 90° rotations, horizontal flips (\(p{=}0.5\)), additive Gaussian noise (\(\sigma \sim \mathcal{U}[0, 0.05]\)), and gamma jitter (\(\gamma \sim \mathcal{U}[0.8, 1.2]\)). All models use Adam (\(\text{lr}=10^{-3}\)) with early stopping (patience 7).
DEC-AUC summarises the full dose-score trajectory as a single scalar via trapezoidal integration. To check whether agent rankings are robust to this choice, we recomputed five alternative scoring metrics from the saved per-episode
dec_dose_fractions and dec_scores arrays and compared rankings across all reported configurations: (i) final accuracy \(s(f{=}1)\), the simplest possible metric; (ii)
time-to-threshold \(\min\{f : s(f) \geq 0.8\}\) with \(1.0\) for never-reached; (iii) early-weighted AUC \(\int_0^1 s(f)\cdot 2(1-f)\,df\)
privileging front-loaded acquisition; (iv) late-weighted AUC \(\int_0^1 s(f)\cdot 2f\,df\) privileging asymptotic accuracy; (v) half-budget AUC \(\frac{1}{0.5}\int_0^{0.5}
s(f)\,df\) truncating to the first half of dose. For each task we ranked agents under each metric and computed Spearman \(\rho\) between DEC-AUC and each alternative; time-to-threshold is internally
negated so the correlation measures ranking agreement rather than monotone direction. The analysis covers \(105\) unique (agent, task) pairs across the four tasks (defect census \(32\)
agents, phase mapping \(32\), targeted \(26\), particle census \(15\)).
| Alternative metric | Defect Census | Phase Mapping | Targeted | Particle Census |
|---|---|---|---|---|
| Final accuracy | \(0.880\) | \(0.900\) | \(0.931\) | \(0.917\) |
| Time-to-threshold | \(0.097\) | \(0.861\) | \(0.641\) | \(0.829\) |
| Early-weighted AUC | \(0.994\) | \(0.973\) | \(0.977\) | \(0.872\) |
| Late-weighted AUC | \(0.994\) | \(0.994\) | \(0.998\) | \(0.986\) |
| Half-budget AUC | \(0.984\) | \(0.961\) | \(0.974\) | \(0.854\) |
The three trajectory-integral alternatives (early-weighted, late-weighted, half-budget) all produce Spearman \(\rho \geq 0.85\) against DEC-AUC across every task, with late-weighted AUC almost indistinguishable from DEC-AUC (\(\rho \geq 0.986\) on all four tasks). The latter is a consequence of how DEC curves actually look in our setting: most agents spend the first half of their dose budget at low scores and only accumulate accuracy near the end, so weighting late fractions more heavily preserves the same ranking. Front-loading via the early-weighted alternative perturbs particle census slightly (\(\rho = 0.872\)) because the heuristic raster baseline that wins that task accumulates score gradually rather than late, but it remains in close agreement on the three crystallographic tasks (\(\rho \geq 0.97\)).
Final accuracy ranks agents the same way as DEC-AUC at \(\rho = 0.88\)–\(0.93\) depending on task. The disagreements concentrate on agents that converge slowly: an agent that reaches the same final score as another via a longer dose-fraction path is rated identically by final accuracy but lower by DEC-AUC. This is precisely the dose-efficiency information DEC-AUC is designed to retain.
The most striking disagreement is time-to-threshold on defect census (\(\rho = 0.097\)). The threshold of \(0.8\) is rarely crossed on this task: at the main-table dose
budget of \(5{,}000\) e/Å\(^2\) (\(\sim\)3% coverage), no agent’s mean DEC curve reaches \(0.8\) on the crystalline easy
worlds. Because the metric maps every never-reaching agent to the same value (\(1.0\) by convention), the resulting ranking degenerates to a near-constant vector and Spearman correlation with any other metric becomes noise.
On phase mapping and targeted the threshold is reached more often (single-phase worlds trivially saturate phase mapping; targeted has fewer false positives) and the correlation rises into the \(0.64\)–\(0.86\) range; on particle census the heuristic raster baseline reliably crosses \(0.8\) and the correlation reaches \(0.829\). The defect-census collapse is
itself the order-discontinuity signature that motivates DEC-AUC: a smooth trajectory integral preserves ranking information even when no agent crosses a threshold, whereas time-to-threshold loses all signal in that regime.
Across the four tasks and five alternatives, \(19\) of \(20\) Spearman \(\rho\) values lie above \(0.64\) and \(17\) lie above \(0.85\); the single outlier (time-to-threshold on defect census) is a known degenerate case explained above. DEC-AUC is therefore not the only sensible scalar summary for our setting, but it is the most robust: it ranks agents the same way as the smoother alternatives and avoids the threshold-degeneracy of time-to-threshold. The full per-(agent, task) metric values and per-task disagreement records are released alongside the benchmark in the supplementary archive.
Re-interpolating saved dec_dose_fractions and dec_scores arrays from \(n = 4340\) episodes to \(K \in \{20, 50, 100\}\) uniformly-spaced checkpoints and
recomputing DEC-AUC by trapezoidal integration produces the following maximum absolute deltas: \(\max_{K=20 \leftrightarrow 50} |\Delta| = 0.0161\), \(\max_{K=50 \leftrightarrow 100} |\Delta| =
0.0001\), \(\max_{K=20 \leftrightarrow 100} |\Delta| = 0.0161\). The 99th-percentile delta across all pairs is \(0.0161\). Discretisation error at the default \(K=50\) is therefore well below the inter-agent gaps (\({\sim}0.005\) vs.\({\sim}0.235\) for the Raster vs.Raster+Analyst perception gap), validating the
trapezoidal integration choice.
Defect census reports \(\max(\text{count-F1}, \text{spatial-F1})\) when agents provide positions (§3.4). A controlled sensitivity analysis that reports rankings under count-F1 only, spatial-F1 only, and the max requires re-running every episode with raw findings serialisation enabled (current logs save only the scalar DEC-AUC). We treat this as a low-cost extension for the next benchmark release; the rankings reported here use the max construction.
Figure 3 shows the full STEMAgent architecture and planner FSM.
GP-UCB with exploration parameter \(\beta\) dynamically set by the Planner (SURVEY: \(\beta{=}3.0\); CHARACTERIZE: \(\beta{=}0.5\)).
Neural ensemble: (1) AtomFinderUNet [45] (3-member ensemble for uncertainty), (2) DefectClassifierCNN, (3) PhaseIdentifierResNet [46].
When no trained ensemble is available, the analyst falls back to a fixed-threshold rule that flags a tile peak intensity as a candidate defect when its \(z\)-score (against the per-episode running mean and standard deviation of acquired-tile peak intensities) exceeds \(\pm 1.5\). Defect type is assigned by intensity sign relative to the local lattice mean: above-mean peaks are tagged as substitutions and below-mean peaks as vacancies. Phase identification under the heuristic is an adaptive intensity median split with a Cohen’s \(d\) test for bimodality; single-mode tiles return no phase prediction. The threshold is constant across worlds and difficulties and matches the value reported in the difficulty-scaling analysis (§17).
FSM with five modes: SURVEY (\(\beta{=}3.0\), until 15% coverage) \(\to\) INVESTIGATE (\(\beta{=}2.0\), until \(\geq 2\) defects) \(\to\) CHARACTERIZE (\(\beta{=}0.5\)) \(\to\) CENSUS (\(\beta{=}1.0\), \(< 20\%\) budget) \(\to\) TERMINATE (\(< 5\%\) budget).
Table 5 summarizes the operational hyperparameters of the agent, organized by component. The Navigator (GP-UCB) controls exploration using a Gaussian Process with an exploration parameter \(\beta \in [0.5, 3.0]\), starting from 4 random samples and refitting every 3 steps. The Planner (FSM) governs high-level behavior transitions based on coverage, defect detection, and remaining budget thresholds (e.g., 15% survey coverage, 5% termination threshold). The Analyst comprises neural models with a 3-member UNet ensemble for localization, a CNN with 3 defect classes, and a ResNet with 2 phase classes, operating under a spatial tolerance of 5 nm. The Environment parameters define acquisition constraints, including \(128\times128\) px tiles with 4 px overlap, a fixed dose per acquisition, and a maximum of 200 steps per episode.
Table 6 details the training configuration of the Analyst models. The AtomFinder (UNet) uses a 3-member ensemble trained with binary cross-entropy loss, batch size 8, and up to 30 epochs, with a target Gaussian spread of \(\sigma=2\) px. The DefectClassifier (CNN) operates on \(32\times32\) px patches with weighted cross-entropy to address class imbalance, using batch size 32 and up to 50,000 patches. The PhaseIdentifier (ResNet) is trained with standard cross-entropy, batch size 8, and 20 epochs. All models share the Adam optimizer with learning rate \(10^{-3}\), early stopping with patience of 7 epochs, an 80/20 train-validation split (seed 42), and training data drawn from four material systems (, , SiGe, GaN).
| Component | Parameter | Value |
|---|---|---|
| Navigator (GP-UCB) | Initial random samples | 4 |
| GP refit interval | 3 | |
| \(\beta\) range | \([0.5, 3.0]\) | |
| Planner (FSM) | Survey coverage threshold | 15% |
| Investigate defect threshold | 2 | |
| Census budget threshold | 20% | |
| Terminate budget threshold | 5% | |
| Analyst (Neural) | UNet ensemble members | 3 |
| CNN defect classes | 3 | |
| ResNet phase classes | 2 | |
| Spatial tolerance | 5 nm | |
| Environment | Tile size | \(128 \times 128\) px |
| Overlap | 4 px | |
| Dose per acquire | 100 e Å−2 | |
| Max steps | 200 |
| Model | Parameter | Value |
|---|---|---|
| AtomFinder (UNet) | Ensemble members | 3 |
| Target \(\sigma\) | 2 px | |
| Loss | BCE | |
| Batch size | 8 | |
| Max epochs | 30 | |
| DefectClassifier (CNN) | Patch size | \(32 \times 32\) px |
| Max patches | 50,000 | |
| Loss | Weighted CE (inv.freq.) | |
| Batch size | 32 | |
| Max epochs | 30 | |
| PhaseIdentifier (ResNet) | Loss | CE |
| Batch size | 8 | |
| Max epochs | 20 | |
| All models | Optimiser | Adam |
| Learning rate | \(10^{-3}\) | |
| Early stopping patience | 7 epochs | |
| Train/val split | 80/20 (seed 42) | |
| Training worlds | 4 easy (, , SiGe, GaN) |
The current environment models navigation as dose-free and latency-free. Real STEM instruments incur time-dependent costs during navigation (stage settling, beam blanking, hysteresis). Dose cost is \(c = d_0 \cdot d \cdot z^2\) where \(d_0\) is the base dose, \(d\) the dose multiplier (matching Eq. 2 in the main text), and \(z\) the zoom factor. Incorporating a movement penalty or time budget is a natural extension that would test whether path planning becomes beneficial when navigation is costly.
Table 7 reports bootstrap 95% confidence intervals for the mean DEC-AUC across agents, computed from 10,000 resamples over \(N=70\) episodes (10 seeds \(\times\) 7 (world, difficulty) cells). The results show that baseline strategies (Random, Raster, GP-UCB) achieve low performance, while adding the Analyst yields a substantial increase in DEC-AUC (e.g., \(\approx 0.28\) for Raster+Analyst, GP-UCB+Analyst, and STEMAgent). The Analyst-equipped agents have overlapping confidence intervals; we note that overlapping CIs are not equivalent to non-significance, so the formal claim of comparable performance rests on the paired Wilcoxon test (Table 8) and the TOST equivalence test below, not on CI overlap alone.
Table 8 presents paired Wilcoxon signed-rank tests on matched episodes to assess statistical significance of performance differences. The comparison between Raster and Raster+Analyst shows a large and statistically significant improvement (\(\Delta=+0.235\), \(p<0.001\)). In contrast, differences among Analyst-based agents (Raster+Analyst, GP-UCB+Analyst, STEMAgent) are small and not statistically significant at \(N=70\) (\(p>0.05\)); the formal equivalence claim is supported by the TOST analysis in Table 9. Ablation tests on STEMAgent (removing uncertainty or planner) also show negligible and non-significant changes, suggesting these components do not materially affect DEC-AUC under the tested conditions.
| Agent | \(N\) | Mean DEC-AUC | 95% CI |
|---|---|---|---|
| Random | 70 | \(0.028\) | \([0.022,\, 0.035]\) |
| Raster | 70 | \(0.052\) | \([0.043,\, 0.061]\) |
| GP-UCB | 70 | \(0.034\) | \([0.026,\, 0.043]\) |
| Raster+Analyst | 70 | \(0.287\) | \([0.257,\, 0.316]\) |
| GP-UCB+Analyst | 70 | \(0.283\) | \([0.253,\, 0.311]\) |
| STEMAgent | 70 | \(0.278\) | \([0.248,\, 0.305]\) |
| Comparison | \(N\) | \(\Delta\) DEC-AUC | \(p\)-value | Sig. |
|---|---|---|---|---|
| Raster vs Raster+Analyst | 70 | \(+0.235\) | \(< 0.001\) | *** |
| Raster+Analyst vs GP-UCB+Analyst | 70 | \(-0.004\) | \(0.549\) | |
| Raster+Analyst vs STEMAgent | 70 | \(-0.009\) | \(0.375\) | |
| STEMAgent vs No Uncertainty | 30 | \(+0.001\) | \(0.903\) | |
| STEMAgent vs No Planner | 30 | \(+0.000\) | \(0.855\) | |
To formally claim that the three Analyst-equipped agents are equivalent rather than merely non-distinguishable, we run two one-sided Wilcoxon signed-rank tests (TOST) with equivalence margin \(\Delta = 0.05\) DEC-AUC on the matched-seed N=70 paired arrays. A pair is declared equivalent if both one-sided \(p\)-values are below \(0.05\), ruling out true mean differences of magnitude \(\geq \Delta\). All three pairwise comparisons (Raster+Analyst vs.GP-UCB+Analyst, Raster+Analyst vs.STEMAgent, GP-UCB+Analyst vs.STEMAgent) pass equivalence at this margin.
| Agent A | Agent B | \(N\) | mean\((A{-}B)\) | std\((A{-}B)\) | \(p_{\text{low}}\) | \(p_{\text{up}}\) | Equiv.? |
|---|---|---|---|---|---|---|---|
| Raster+Analyst | GP-UCB+Analyst | \(70\) | \(+0.0041\) | \(0.0720\) | \(0.0000\) | \(0.0000\) | Yes |
| Raster+Analyst | STEMAgent | \(70\) | \(+0.0094\) | \(0.0863\) | \(0.0000\) | \(0.0001\) | Yes |
| GP-UCB+Analyst | STEMAgent | \(70\) | \(+0.0053\) | \(0.0774\) | \(0.0000\) | \(0.0000\) | Yes |
4pt
The PF GP-BO baseline re-implements the autonomous-STEM active-learning workflow [8], [9] using a BoTorch SingleTaskGP. The published pipeline uses learned tile embeddings or domain-specific descriptors; we substitute hand-crafted physics features (intensity
variance, atom density from analyst peak detection, atom-intensity dispersion) for transparency and reproducibility. Acquisition is UCB (\(\beta = 2.0\)); the GP fit uses the same scaffolding as the GP-UCB baseline (§3.6). Evaluation covers all five easy worlds at 5000 e Å−2 with 10 seeds per (agent, task, world) combination (300 episodes total). The substituted feature set is the most likely source of the \({\sim}14\times\) perovskite-vs-non-perovskite gap; results should be read as “GP-BO with hand-crafted features” rather than as a faithful reproduction of the published learned-embedding variant.
| Task / Variant | SiGe | GaN | Pt | ||
|---|---|---|---|---|---|
| Defect census, raw | \(0.017\) | \(0.042\) | \(0.001\) | \(0.005\) | \(0.000\) |
| Defect census, equipped | \(0.377\) | \(0.360\) | \(0.043\) | \(0.036\) | \(0.000\) |
| Phase mapping, raw | \(0.908\) | \(0.000\) | \(0.000\) | \(0.000\) | \(0.908\) |
| Phase mapping, equipped | \(0.151\) | \(0.157\) | \(0.196\) | \(0.137\) | \(0.000\) |
| Targeted, raw | \(0.000\) | \(0.000\) | \(0.000\) | \(0.000\) | \(0.000\) |
| Targeted, equipped | \(0.808\) | \(0.823\) | \(0.054\) | \(0.054\) | \(0.000\) |
The equipped variant’s defect-census and targeted scores show a \(\sim\)14\(\times\) perovskite-vs-non-perovskite gap that mirrors what the in-house Raster+Analyst baseline
shows (§4.2); the raw phase-mapping scores of \(0.908\) on and Pt reflect trivially-correct phase-0 predictions on single-phase worlds (no analyst means no phase prediction; default
class 0 matches ground truth on worlds with no phase boundaries).
Table 2 in the main text reports the primary results. Table 11 enumerates the 33 agent configurations by family; Table 12 below gives per-world breakdowns.
| Family | \(N\) | Members |
|---|---|---|
| Naı̈ve baselines | \(3\) | Random, Raster, GP-UCB |
| Equipped baselines | \(2\) | Raster+Analyst, GP-UCB+Analyst |
| STEMAgent and ablations | \(5\) | STEMAgent, No Planner, No Uncertainty, Rule Planner, LLM Planner |
| PF GP-BO | \(2\) | raw, +Analyst (SI [sec:app:kalinin]) |
| Compressed sensing | \(6\) | CS-10/20/30% \(\times\) |
| Reinforcement learning | \(6\) | DQN, PPO, SAC \(\times\) |
| Production-tier VLM analysts | \(8\) | {Claude Haiku 4.5, GPT-5 mini, Llama 4 Scout, Gemini 2.0 Flash} \(\times\) |
| Frontier-flagship VLM sanity check | \(1\) | Claude Opus 4.7 \(\times\) Raster (SI [sec:app:vlm95details]) |
| Total | 33 |
| Heuristic Analyst | Trained Analyst | |||||||
|---|---|---|---|---|---|---|---|---|
| 3-5 (lr)6-9 Material | Diff. | Random | Raster | GP-UCB | Rast.+A | GP+A | STEM | DQN+A |
| Easy | \(0.016\) | \(0.044\) | \(0.017\) | \(0.455\) | \(0.380\) | \(0.361\) | \(0.149\) | |
| Med. | \(0.030\) | \(0.109\) | \(0.031\) | \(0.306\) | \(0.372\) | \(0.367\) | \(0.096\) | |
| Easy | \(0.031\) | \(0.048\) | \(0.028\) | \(0.355\) | \(0.348\) | \(0.318\) | \(0.137\) | |
| Med. | \(0.042\) | \(0.059\) | \(0.073\) | \(0.359\) | \(0.325\) | \(0.349\) | \(0.127\) | |
| Hard | \(0.071\) | \(0.097\) | \(0.080\) | \(0.340\) | \(0.324\) | \(0.293\) | \(0.149\) | |
| SiGe | Easy | \(0.002\) | \(0.003\) | \(0.002\) | \(0.070\) | \(0.092\) | \(0.087\) | \(0.023\) |
| SiGe | Med. | \(0.005\) | \(0.005\) | \(0.005\) | \(0.126\) | \(0.140\) | \(0.171\) | \(0.168\) |
4pt
Table 13 reports the high-budget extension of the budget-sensitivity analysis discussed in §4.2 (three crystalline easy worlds, 10 seeds per cell). The within-equipped ranking is preserved across the \(50\times\) sweep and Raster+Analyst’s margin grows with budget. SiGe stays at \(0.05\)–\(0.08\) at every budget, exhibiting the cleanest material-specific perception ceiling.
| Agent | 1000 | 5000 (baseline) | 20000 | 50000 |
| (\(\sim\)0.6%) | (\(\sim\)3%) | (\(\sim\)12%) | (\(\sim\)31%) | |
| Raster (naı̈ve) | \(<0.04\) | \(0.052\) | \(<0.083\) | \(<0.083\) |
| Raster+Analyst | \(0.158\)–\(0.162\) | \(0.287\pm0.129\) | \(0.340\pm0.164\) | \(0.361\pm0.186\) |
| GP-UCB+Analyst | \(0.158\)–\(0.162\) | \(0.283\pm0.122\) | \(0.313\pm0.190\) | \(0.321\pm0.192\) |
| STEMAgent | \(0.158\)–\(0.162\) | \(0.278\pm0.120\) | \(0.286\pm0.177\) | \(0.314\pm0.183\) |
| Parameter | Easy | Medium | Hard |
|---|---|---|---|
| O-vacancy rate | \(4.0\%\) | \(3.0\%\) | \(1.5\%\) |
| # phase boundaries | \(1\) | \(2\) | \(3\) |
| Boundary sharpness \(\sigma\) (px) | \(80\) | \(50\) | \(25\) |
| Boundary waviness (frac.) | \(0.00\) | \(0.05\) | \(0.10\) |
| Cluster fraction | \(0.60\) | \(0.70\) | \(0.80\) |
| Phonon configurations | \(4\) | \(8\) | \(16\) |
The O-vacancy rate of \(4\%/3\%/1.5\%\) for easy/medium/hard differs from the canonical \(5\%/3\%/1\%\) in Table 1 of the main text because the phase-boundary structure already injects compositional variability that compounds with vacancies; equalising the resulting analyst-difficulty distributions across materials motivated the lower vacancy rates here.
| Task | Agent | Easy | Medium | Hard |
|---|---|---|---|---|
| Defect census | Raster (naı̈ve) | \(0.048\pm0.002\) | \(0.059\pm0.005\) | \(0.097\pm0.005\) |
| Raster+Analyst | \(0.355\pm0.002\) | \(0.359\pm0.002\) | \(0.340\pm0.004\) | |
| GP-UCB+Analyst | \(0.348\pm0.055\) | \(0.325\pm0.042\) | \(0.324\pm0.079\) | |
| STEMAgent | \(0.318\pm0.076\) | \(0.349\pm0.041\) | \(0.293\pm0.095\) | |
| Phase mapping | Raster (naı̈ve) | \(0.000\) | \(0.000\) | \(0.000\) |
| Raster+Analyst | \(0.149\pm0.004\) | \(0.197\pm0.005\) | \(0.159\pm0.016\) | |
| GP-UCB+Analyst | \(0.149\pm0.051\) | \(0.234\pm0.031\) | \(0.168\pm0.012\) | |
| STEMAgent | \(0.168\pm0.022\) | \(0.221\pm0.025\) | \(0.167\pm0.015\) |
The three interface worlds share substrate geometry (BaTiO\(_3\) [001] with mixed cubic/tetragonal domains) and differ only in parameters that control defect detectability and structural complexity (Table 14). O-vacancy density decreases from \(4.0\%\) to \(1.5\%\), the number of cubic/tetragonal phase boundaries rises from one to three, the Gaussian boundary sharpness \(\sigma\) drops from 80 to 25 px, and boundary waviness grows from \(0\) to \(10\%\) of scan width. The HAADF simulation ramps thermal-diffuse-scattering realism in parallel, from 4 to 16 frozen-phonon configurations. All other parameters are held fixed across difficulties: 200 keV beam energy, 21 mrad convergence semi-angle, a \(68\)–\(\SI{200} {\milli\radian}\) HAADF detector, 128 px tiles , a 5000 e Å−2 budget , and a 200 - step cap.
Table 15 reports DEC-AUC mean\(\pm\)std across ten seeds per (agent, world) pair. Two aggregate patterns emerge. On defect census, equipped agents span only \(0.293\)–\(0.359\) (a \(22\%\) relative range) while naı̈ve baselines stay below \(0.10\). On phase mapping, naı̈ve agents return exactly zero at every difficulty (none of random, raster, or GP-UCB exploration produces a phase map without the trained analyst), while all three equipped agents peak at the medium world (\(0.197\)–\(0.234\)) and decline at both endpoints.
The medium-peak pattern appears consistently in all three equipped agents, indicating it is driven by the shared phase identifier rather than by the navigation policy. Our phase-mapping metric is macro-averaged IoU across the two phase labels. We offer a plausible decomposition: in the easy world a single boundary makes the IoU dominated by one binary decision, so mislabeling either side degrades IoU sharply; the medium world introduces a second boundary, increasing within-scan contrast diversity and raising the plateau; the hard world re-introduces degradation as three wavy boundaries (with sharper \(\sigma\) and lower-SNR imaging conditions) outstrip what the phase identifier can resolve under the 5000 e Å−2 budget. A controlled ablation decoupling boundary count from imaging SNR would be needed to attribute the effect cleanly.
Naı̈ve Raster’s defect-census AUC rises from \(0.048\) (easy) to \(0.097\) (hard), and GP-UCB’s rises from \(0.028\) to \(0.080\), while their coverage policies are unchanged. The defect-census score is \(\max(\text{count-F1}, \text{spatial-F1})\), and the naı̈ve analyst uses a fixed \(\pm 1.5\) z-score threshold on tile peak intensities, so its reported defect count is approximately independent of ground-truth vacancy density. Sparser hard-world ground truth therefore brings the reported count incidentally closer to truth on the count-F1 branch. The perception gap on defect census consequently narrows from \(7.4\times\) (easy) to \(3.5\times\) (hard), while the gap on phase mapping remains undefined (naı̈ve \(\equiv 0\)). Equipped agents’ defect-census scores change by at most \(0.056\) across the sweep (STEMAgent easy-to-hard), so the narrowing is driven almost entirely by the rising naı̈ve floor, not by degrading perception.
At each difficulty, Raster+Analyst has the lowest seed-to-seed variance (\(\sigma \leq 0.004\) on defect census), followed by GP-UCB+Analyst (\(\sigma \leq 0.079\)), with STEMAgent highest (\(\sigma\) up to \(0.095\)). The ordering is stable across all three difficulty levels and reflects a coverage-versus-adaptation tradeoff: under a tight 5000 e Å−2 budget, deterministic sweeps inherit only the analyst’s aggregate variance, whereas adaptive agents additionally inherit variance from their own exploration policies.
Easy and medium worlds required \({\sim}\)2–6 hours on a single NVIDIA A100 (80 GB). Hard worlds require \(> \SI{100}{\giga\byte}\) GPU memory and were generated on H200 GPUs (141 GB); the largest worlds used four parallel H200 instances, requiring \({\sim}\)14–17 hours per world.
The main suite ran on two RTX 4090 instances (seed-sharded); VLM/LLM comparisons ran on an H200; expansion experiments ran on a second A100. The full episode budget is bounded by the configuration files released with the benchmark and the cross-material transfer programme (3 agents \(\times\) 5 train materials \(\times\) 5 eval materials \(\times\) 5 seeds \(=\) 375 episodes), summing to approximately 8,000 episodes. Per-experiment breakdown:
Main suite (\(2{,}820\)): defect census (\(1{,}120\)), phase mapping (\(480\)), targeted (\(320\)), particle census (\(450\)), trained ablation (\(450\)).
VLM & LLM (\(1{,}875\)): original VLM sweep (\(900\); GPT-5 mini chronic parse failures, see SI 23), retry-harness rerun (\(760\) effective episodes after exclusion), Claude Opus 4.7 frontier-flagship sanity check (\(15\); defect census only, see SI 22), LLM planner (\(200\)).
PF GP-BO and compressed sensing (\(660\)): PF GP-BO (\(300\)), CS-10/20/30% raw \(+\) equipped (\(360\)).
Budget and Pareto sweeps (\(360\)): 1k/3k/10k Pareto (\(180\)), 20k/50k budget (\(180\)).
Cross-material transfer (\(375\)).
Replay validation and trajectory capture (\(48\)).
Real-data sanity check (\(30\)): five Sm-doped compositions (Sm \(\in\{0, 7, 10, 13, 20\}\%\)) [40], surfaced via the 2024 Mic-hackathon team 14 notebook [6], 2 agents \(\times\) 5 worlds \(\times\) 3 seeds on phase mapping (SI 27).
Targeted ablations (\(1{,}822\)): defect-census 5-seed sweep (\(350\)), zoom/dwell ablation (\(225\)), acquisition-function comparison (\(150\)), composite task (\(75\)), adaptive transfer (\(60\)), declare ablation (\(60\)), random/single-BO equipped runs (\(500\)), trained difficulty scaling (\(120\)), trained targeted (\(200\)), RL baseline (\(50\)), preflight (\(32\)).
The bullets sum to \(7{,}990\) (rounded to \({\sim}8{,}000\) in the headline figure). Every count is bounded by a released configuration file or by the cross-material transfer programme.
No experiment required more than 80 GB; agent inference peaks at \({\sim}\)40 GB with 4 parallel workers.
Table 16 reports per-episode wall-clock time and median per-acquired-tile latency aggregated from elapsed_seconds across all readable result files. Per-tile latency on the trained-analyst agents is dominated
by U-Net inference and BoTorch GP fitting; PPO is an outlier because it spends additional wall-clock on per-step policy updates. VLM rows are dominated by OpenRouter call latency at max_tokens=1024; the GPT-5 mini rows additionally absorb
3-retry overhead per failed call (see SI 23), inflating per-tile latency to \(45\)–\(90\) s. Pareto-sweep wall-clock data are not yet included
pending recovery of those JSONs.
| Agent | \(N\) episodes | Mean episode (s) | Median episode (s) | Median per-tile (ms) |
|---|---|---|---|---|
| Random | \(156\) | \(123.6\) | \(81.2\) | \(1691.3\) |
| Raster | \(231\) | \(614.7\) | \(159.0\) | \(3179.6\) |
| GP-UCB | \(231\) | \(518.0\) | \(166.8\) | \(3336.2\) |
| Raster+Analyst | \(265\) | \(681.5\) | \(205.7\) | \(3505.4\) |
| GP-UCB+Analyst | \(255\) | \(561.8\) | \(250.9\) | \(3420.9\) |
| STEMAgent | \(276\) | \(200.1\) | \(116.2\) | \(2222.8\) |
| STEMAgent (No Planner) | \(240\) | \(137.4\) | \(116.1\) | \(2369.9\) |
| STEMAgent (No Uncertainty) | \(240\) | \(142.0\) | \(122.6\) | \(2554.6\) |
| STEMAgent (Rule Planner) | \(240\) | \(146.2\) | \(127.7\) | \(2659.7\) |
| STEMAgent (LLM Planner) | \(210\) | \(169.2\) | \(138.4\) | \(2883.7\) |
| PF GP-BO | \(150\) | \(38.6\) | \(38.2\) | \(763.9\) |
| PF GP-BO+Analyst | \(150\) | \(42.7\) | \(40.2\) | \(804.3\) |
| DQN | \(150\) | \(164.7\) | \(131.7\) | \(14631.1\) |
| DQN+Analyst | \(150\) | \(167.6\) | \(137.0\) | \(15412.1\) |
| PPO | \(150\) | \(169.6\) | \(139.9\) | \(69943.5\) |
| PPO+Analyst | \(150\) | \(171.8\) | \(143.5\) | \(71742.0\) |
| SAC | \(150\) | \(174.0\) | \(146.5\) | \(3021.6\) |
| SAC+Analyst | \(150\) | \(178.4\) | \(153.7\) | \(3202.4\) |
| Raster+Claude Haiku 4.5 | \(75\) | \(1715.9\) | \(1128.7\) | \(22574.6\) |
| Raster+Gemini 2.0 Flash | \(74\) | \(1353.1\) | \(1172.2\) | \(23443.8\) |
| Raster+Llama 4 Scout | \(64\) | \(1498.1\) | \(799.9\) | \(15998.7\) |
| Raster+GPT-5 mini | \(15\) | \(2770.8\) | \(2269.9\) | \(45398.5\) |
| Raster+Claude Opus 4.7 | \(15\) | \(353.1\) | \(365.9\) | \(7318.3\) |
| GP-UCB+Claude Haiku 4.5 | \(75\) | \(1504.2\) | \(1053.1\) | \(21062.2\) |
| GP-UCB+Gemini 2.0 Flash | \(75\) | \(1789.1\) | \(1246.1\) | \(24921.8\) |
| GP-UCB+Llama 4 Scout | \(67\) | \(1932.1\) | \(1073.0\) | \(21459.3\) |
| GP-UCB+GPT-5 mini | \(15\) | \(4456.4\) | \(4506.4\) | \(90128.7\) |
4pt
Random produces uniform coverage, Raster scans row-by-row, GP-UCB concentrates on high-variance regions. Despite distinct strategies, all three naı̈ve baselines achieve near-zero DEC-AUC, confirming that navigation without trained perception contributes negligibly. Equipped agents produce visually distinct trajectories but achieve similar scores (Random+CNN \(0.301\), STEMAgent \(0.377\), GP-UCB+CNN \(0.394\) on ), directly supporting the “navigation is noise” finding.
| Agent Variant | Defect Census | Phase Mapping | Targeted |
|---|---|---|---|
| STEMAgent (full) | \(0.283 \pm 0.122\) | \(0.374 \pm 0.363\) | \(0.654 \pm 0.341\) |
| w/o Planner | \(0.283 \pm 0.116\) | \(0.402 \pm 0.367\) | \(0.636 \pm 0.348\) |
| w/o Uncertainty | \(0.284 \pm 0.106\) | \(0.404 \pm 0.366\) | \(0.652 \pm 0.332\) |
| Rule Planner | \(0.304 \pm 0.106\) | \(0.400 \pm 0.370\) | \(0.634 \pm 0.361\) |
| LLM Planner | \(0.292 \pm 0.111\) | \(0.410 \pm 0.363\) | \(0.667 \pm 0.333\) |
No single component is clearly consequential: all variants score within \(0.021\) on defect census (\(0.283\)–\(0.304\)) and within \(0.036\) on phase mapping (\(0.374\)–\(0.410\)). Planner removal has zero impact on defect census (\(0.283 \to 0.283\)). High variance (\(\sigma/\mu > 0.4\)) means no variant is statistically distinguishable.
| Planner Variant | Defect Census | Phase Mapping |
|---|---|---|
| FSM (full) | \(0.255\) | \(0.168\) |
| LLM Planner | \(0.263\) | \(0.168\) |
| Rule Planner | \(0.273\) | \(0.161\) |
| No Planner | \(0.270\) | \(0.165\) |
Compressed sensing [38] is a complementary paradigm to active acquisition: rather than choosing where to measure, it acquires a
sparse random subset and reconstructs the rest via inpainting. We implemented this as three CompressedSensingAgent variants with random-uniform masks at 10%, 20%, and 30% nominal coverage. During the episode the agent acquires only unmasked
tiles. After the episode terminates, the unacquired tiles are reconstructed via total-variation inpainting (Chambolle’s algorithm [39]); the trained analyst is then run over the reconstructed tiles using a separate analyst instance to keep real-tile and reconstructed-tile intensity statistics from contaminating the median-split phase-bimodality
test.
Table 19 reports per-world DEC-AUC for the three equipped variants on defect census across three crystalline easy worlds (10 seeds each). Coverage fraction has minimal effect on aggregate score because the dose budget caps acquisitions at \(\sim\)50 tiles (\(\sim\)3% of the 40\(\times\)40 grid), so the 10/20/30% masks are equally budget-limited and the variable being tested is the spatial distribution of acquired tiles. Per-world, the perovskites (, ) tolerate inpainting at \(0.18\)–\(0.21\) DEC-AUC, while SiGe drops to \(0.06\)–\(0.10\) because Si and Ge atomic columns differ in HAADF intensity, and TV smoothing erases that signal.
| Coverage | SiGe | ||
|---|---|---|---|
| 10% (CS-10%+Analyst) | \(0.177 \pm 0.002\) | \(0.205 \pm 0.005\) | \(0.064 \pm 0.001\) |
| 20% (CS-20%+Analyst) | \(0.210 \pm 0.002\) | \(0.212 \pm 0.003\) | \(0.102 \pm 0.032\) |
| 30% (CS-30%+Analyst) | \(0.187 \pm 0.001\) | \(0.213 \pm 0.010\) | \(0.076 \pm 0.001\) |
The U-Net atom finder was trained on raw HAADF tiles. TV inpainting is a denoising operation that smooths high-frequency content by construction, including the atomic-column structure that the U-Net was trained to localise. The CS+Analyst rows therefore conflate two effects: budget-limited measurement and a domain shift in the analyst’s input distribution. A fair upper bound on the CS paradigm would require either retraining the analyst on TV-inpainted tiles or substituting a reconstruction algorithm that preserves atomic-column structure (e.g., dictionary learning on raw HAADF patches); both are natural extensions of the present implementation.
Phase-mapping numbers in Table 2 have wide confidence intervals (std \(0.18\)–\(0.26\)) because the trivial single-phase worlds (, SiGe with the chosen ground-truth labelling) score near \(1.0\) when the analyst defaults to “predict phase 0,” while with its real phase boundary scores near \(0\). Aggregate IoU therefore reflects the worlds-included composition rather than reconstruction quality and should not be over-interpreted.
| Parameter | Value |
|---|---|
| API provider | OpenRouter (openrouter.ai/api/v1) |
| Models | anthropic/claude-haiku-4.5, openai/gpt-5-mini, |
| meta-llama/llama-4-scout, google/gemini-2.0-flash-001, | |
| anthropic/claude-opus-4.7 (frontier-flagship sanity check) | |
| max_tokens | 1024 |
| Temperature | Provider default (not explicitly set) |
| image_detail | high |
| Image preprocessing | \(2\times\) nearest-neighbour upscale (\(128 \to 256\) px), |
| normalised to \([0, 255]\), PNG-encoded | |
| Retry policy | Up to 3 attempts wrapped around the OpenRouter call boundary; |
| retries on json.JSONDecodeError only, with 1 s sleep between attempts; | |
| non-retryable errors return empty findings | |
| JSON robustness | Strips markdown code fences (“‘json preferred, generic “‘ fallback), |
| extracts last balanced {...} substring; falls back to empty on parse error | |
| Empty content guard | Empty or null response content raises a JSON parse error |
| so the retry path catches it as a transient failure |
(verbatim):
You are an expert materials scientist analyzing HAADF-STEM (High-Angle Annular Dark-Field Scanning Transmission Electron Microscopy) images of crystalline materials.
In HAADF-STEM images: Bright spots are atomic columns (intensity \(\sim Z^{1.7}\), heavier atoms appear brighter). Vacancies appear as MISSING or abnormally DIM spots in the lattice. Substitutional defects appear as spots that are significantly BRIGHTER or DIMMER than their neighbors (different atomic number). The image is a \(128\times128\) pixel tile from a larger specimen.
Analyze the tile and respond with ONLY a JSON object (no markdown, no explanation).
(verbatim):
Analyze this HAADF-STEM tile image. Return a JSON object with:
{"n_atoms": <int>, "defects": [{"row": <0--127>, "col": <0--127>, "type": "vacancy"|"substitution"}], "phase": <int>, "mean_intensity": <float 0--1>, "confidence": <float 0--1>}If no defects are visible, return an empty defects array. Focus on clear, unambiguous defects only—do not over-report.
The LLM Planner uses Gemini 3 Flash Preview (google/gemini-3-flash-preview) via OpenRouter with temperature \(0.3\) and a LangGraph-based tool-calling agent (recursion limit \(=
7\)). The planner decides FSM mode transitions (SURVEY, INVESTIGATE, CHARACTERIZE, CENSUS, TERMINATE) based on the current experiment state. When the recursion limit is reached, the planner falls back to rule-based mode selection.
To address whether the production-tier perception gap reflects a model-tier limitation rather than VLM perception in general, we ran a single frontier-flagship configuration on the headline task: anthropic/claude-opus-4.7 via OpenRouter
with the same prompts, image preprocessing, retry harness, and max_tokens=1024 cap as the production-tier sweep, paired with raster navigation on defect census across the five easy worlds with three seeds each (15 episodes total, \(750\) underlying tile calls). Opus 4.7 returned cleanly fenced JSON on every call (zero parse failures, zero retries triggered). Per-world DEC-AUC was \(0.019\pm0.002\) (), \(0.037\pm0.002\) (), \(0.003\pm0.000\) (SiGe), \(0.005\pm0.001\) (GaN), and \(0.908\pm0.000\) (Pt nanoparticles), giving a
four-world crystalline mean of \(0.016\)—inside the \(0.006\)–\(0.019\) range observed for the production-tier set. The Pt result of \(0.908\) matches the trivially-correct naı̈ve raster baseline, consistent with the “default no-anomaly” explanation in §3.4 (\({\sim}85\%\) of Pt tiles contain no
particle, so an empty defects array scores high \(F_{1,\text{detect}}\) regardless of perception). The result is consistent with the production-tier sweep: the perception gap relative to the trained CNN is not closed by
switching to a frontier-tier model under API-default settings.
The CoT-with-retry implementation logs each attempt outcome (model, attempt index, success flag, parse-failure reason, response excerpt) in a per-instance diagnostics list cleared on every reset(). The aggregate failure counts across the
full run are summarised in Table 21.
| Model | Episodes | Retry-exhausted failures | Failure rate | Status in main results |
|---|---|---|---|---|
| Claude Haiku 4.5 | 150 | \(0\) | \(0\%\) | Included |
| Gemini 2.0 Flash | 149 | \(3\) | \({\sim}0\%\) | Included |
| Llama 4 Scout | 131 | \(0\) | \(0\%\) | Included |
| GPT-5 mini | 30 | \(123\) | \({\sim}100\%\) | Excluded (see below) |
GPT-5 mini consistently returned empty response content from OpenRouter under our \(\texttt{max\_tokens}=1024\) cap. Inspection of non-empty responses showed two distinct issues. The first is genuine API-side truncation:
the model spends its token budget on internal reasoning before emitting the structured output and is cut off mid-object, producing payloads such as {"n_atoms":186,"defects":[],"phase":0,"mean_intensity":0.11,"confidence":0.78 (no closing
brace). The second was a parser-side artefact in our JSON-extraction helper: when a non-empty response wrapped a nested defects:[{...}] array, the previous last-brace fallback latched onto the inner defect object’s brace and produced fragments
like {"row": 64, "col": 64, "type": "vacancy"}],"phase": 0,... that resembled API truncation but were actually parsing errors on cleanly-emitted JSON. We patched the helper to use a brace-matching scanner that returns the outermost balanced
object and re-ran a 30-combo gap-fill (2 navigators \(\times\) 3 tasks \(\times\) 5 worlds, 5 seeds each); the parse-failure rate remained near \(100\%\),
dominated by genuinely-empty content and genuinely-truncated payloads, so no GPT-5 mini episodes were recovered. The original API-side diagnosis therefore stands: under \(\texttt{max\_tokens}=1024\), GPT-5 mini cannot
reliably emit the structured payload on real material tiles, and the retry path catches this case (the empty-content guard in SI 22 converts an empty response into a JSON parse error) but every retry produced the
same outcome. After 30 episodes of the original sweep confirmed this was chronic API behaviour rather than transient noise we excluded GPT-5 mini from the headline analysis; the partial results are retained in the supplementary archive for completeness but
do not contribute to Tables 2, 22, or 23. Raising max_tokens above \(1024\) may resolve the truncation issue for
reasoning-heavy models; we leave this configuration sweep to future work since the goal of the present comparison is API-default production-tier-model behaviour rather than per-model tuning.
Gemini 2.0 Flash exhibited 3 retry-exhausted failures across all \(149\) evaluation episodes (\(\sim\)7,500 underlying VLM tile calls at one call per acquired tile), a per-episode failure
rate of \({\sim}0.02\%\). The 3 failures correlated with one OpenRouter INVALID_ARGUMENT response from Google’s API and two cases of malformed JSON output. Claude Haiku and Llama 4 Scout had zero
retry-exhausted failures, indicating that the JSON-extraction logic (fenced block preferred, generic-fence fallback, last-balanced-braces fallback) is sufficient for these providers’ typical output formats.
Table 22 compares DEC-AUC of vision-language model (VLM) agents on defect census across the four crystalline easy worlds (, , SiGe, GaN) and the Pt nanoparticles easy world, under raster navigation. The results show a strong domain dependence: the trained CNN performs well on crystalline worlds (\(0.247\)) but fails on nanoparticles (\(0.000\)), whereas the working production-tier VLMs (Claude Haiku, Gemini 2.0, Llama 4) achieve high performance on nanoparticles (up to \(0.908\)) but near-zero performance on crystallography. Aggregated over all five worlds these opposing strengths result in similar overall DEC-AUC values for the CNN (\(0.198\)) and the strongest VLM (\(0.186\) for Claude Haiku), with Raster+CNN slightly higher due to its stronger performance on the four crystalline worlds, while the heuristic raster baseline remains substantially lower. GPT-5 mini scored \(0.000\) on every world due to chronic empty-content responses (SI 23); we report it for completeness but exclude it from the headline comparison. Frontier-flagship Claude Opus 4.7 (15 episodes, no retries triggered) sits in the same crystalline range as the production tier (\(0.016\) averaged over the four worlds vs.\(0.006\)–\(0.019\) for the production-tier set) and matches the trivially-correct naı̈ve baseline of \(0.908\) on Pt nanoparticles, indicating the perception gap is not a tier-of-model artefact (SI 22).
Table 23 reports DEC-AUC on the targeted task across all five easy worlds. Here Raster+CNN clearly outperforms every VLM, achieving \(0.392\) compared to near-zero performance for all VLMs. The targeted task demands spatially precise localisation rather than scene-level classification, so the inversion that benefits VLMs on Pt nanoparticles in defect census does not transfer.
| Agent | Crystalline (4 worlds) | Pt Nanopart. | All Worlds |
|---|---|---|---|
| Raster+CNN | \(0.247\) | \(0.000\) | \(0.198\) |
| Raster+Claude Opus 4.7 | \(0.016\) | \(0.908\) | \(0.194\) |
| Raster+Claude Haiku | \(0.006\) | \(0.908\) | \(0.186\) |
| Raster+Gemini 2.0 | \(0.019\) | \(0.628\) | \(0.141\) |
| Raster+Llama 4 | \(0.019\) | \(0.458\) | \(0.041\) |
| Raster+GPT-5 mini | \(0.000\) | \(0.000\) | \(0.000\) |
| Raster (heuristic) | \(0.027\) | \(0.000\) | \(0.021\) |
| Agent | Crystalline (4 worlds) | Pt Nanopart. | All Worlds |
|---|---|---|---|
| Raster+CNN | \(0.490\) | \(0.000\) | \(0.392\) |
| Raster+Claude Haiku | \(0.004\) | \(0.000\) | \(0.004\) |
| Raster+Gemini 2.0 | \(0.019\) | \(0.000\) | \(0.016\) |
| Raster+Llama 4 | \(0.020\) | \(0.000\) | \(0.018\) |
| Raster+GPT-5 mini | \(0.000\) | — | \(0.000\) |
Three algorithms are trained via Stable-Baselines3 for 50,000 steps each across five easy worlds:
DQN [35]: Discrete \(8{\times}8\) spatial grid \(\times\) 3 action types (192 actions). Learning rate \(10^{-4}\), replay buffer 50,000, batch size 64, exploration fraction 0.3, \(\gamma{=}0.99\).
PPO [36]: Same discrete action space. Learning rate \(3{\times}10^{-4}\), rollout length 2,048, 10 epochs per update, clip range 0.2, entropy coefficient 0.01, GAE \(\lambda{=}0.95\).
SAC [37]: Continuous \(\text{Box}(2)\) action space (normalised \(x,y\) coordinates). Learning rate \(3{\times}10^{-4}\), replay buffer 50,000, batch size 64, soft-target Polyak coefficient \(\tau_\text{pol}{=}0.005\) (renamed from \(\tau\) to avoid collision with the DEC hitting time of §3.1), automatic entropy tuning.
| World | DQN | DQN+A | PPO | PPO+A | SAC | SAC+A |
|---|---|---|---|---|---|---|
| easy | \(0.064\) | \(0.149\) | \(0.003\) | \(0.001\) | \(0.022\) | \(0.381\) |
| easy | \(0.172\) | \(0.137\) | \(0.002\) | \(0.000\) | \(0.026\) | \(0.295\) |
| SiGe easy | \(0.005\) | \(0.023\) | \(0.001\) | \(0.004\) | \(0.002\) | \(0.046\) |
| Mean | \(\mathbf{0.080}\) | \(\mathbf{0.103}\) | \(\mathbf{0.002}\) | \(\mathbf{0.002}\) | \(\mathbf{0.017}\) | \(\mathbf{0.241}\) |
We follow the standard datasheets-for-datasets framework [47].
STEMGym is the first Gymnasium-compatible benchmark for evaluating dose-efficient autonomous scanning transmission electron microscopy agents. No prior benchmark combines physics-based STEM simulation with ground-truth annotations and a standardised agent interface. The dataset was created by the paper authors with no external dataset-specific funding.
The dataset comprises 15 benchmark worlds (five material systems at three difficulty levels) plus two ancillary HDF5 files used internally: a synthetic test world for unit testing and a synthetic replay world for cross-parameterisation consistency checks (Table 25). The abstract count of “15 annotated HAADF-STEM worlds” refers to the benchmark worlds only; the ancillary worlds are not used for any reported result. Each world contains: (i) a low-resolution overview image, (ii) a grid of \(128{\times}128\) pixel HAADF-STEM tiles with 4-pixel overlap (stride 124), (iii) ground-truth annotations, and (iv) a valid-region mask. Ground truth includes per-atom position (nm), type (0 = pristine, 1 = vacancy, 2 = substitution), defect mask, defect-type strings, and, where applicable, a pixel-wise phase map (, GaN). No confidential data or personally identifiable information is present; all content is computationally generated. Tiles within a world are not independent: they share a common crystal structure and exhibit spatial correlations.
The release also includes six model checkpoints (AtomFinderUNet ensemble, DefectClassifierCNN, PhaseIdentifierResNet, and DQN/PPO/SAC RL agents; \({\sim}\)107 MB total) and 16 material-specific transfer checkpoints (\({\sim}\)420 MB).
| Material | Zone Axis | FOV | Grid | Tiles | Defect Types |
|---|---|---|---|---|---|
| [001] | \({\sim}\)100 nm | 40\(\times\)40 | 1,600 | Vacancy | |
| [001] | \({\sim}\)100 nm | 40\(\times\)40 | 1,600 | Vacancy + phase boundary | |
| Si/Ge | [110] | \({\sim}\)50 nm | 20\(\times\)20 | 400 | Substitution |
| GaN | [11\(\bar{2}\)0] | \({\sim}\)80 nm | 20\(\times\)20 | 400 | Substitution |
| Pt nanoparticles | — | \({\sim}\)60 nm | 40\(\times\)40 | 1,600 | Nanoparticle morphology |
Crystal structures are built with pymatgen and ASE from Materials Project entries (SrTiO3 optionally fetches via the MP API; all others use built-in unit cells). Defects are introduced programmatically: oxygen
vacancies along grain boundaries (), vacancy clusters near phase boundaries (), compositional gradients (Si/Ge), quantum-well substitutions (GaN), or Wulff/icosahedral/decahedral nanoparticles (Pt). STEM-HAADF images are simulated via PRISM
multislice [30] using abTEM [31] (\(\geq\)1.0.0b30) at 200 keV, 21 mrad convergence, and 68 mrad–200 mrad detector angles with frozen-phonon thermal diffuse scattering (Debye–Waller factors in SI 9). Each field of view is simulated as 7 nm sub-tiles with 1 nm overlap, blended via linear ramps. Poisson noise is applied at dose levels corresponding to each difficulty (\(10^4\), \(5{\times}10^3\), or \(10^3\) e Å−2). No real experimental data or human subjects are involved. Worlds were generated between June 2025 and January 2026. The
replay_world is a held-out synthetic specimen (source: synthetic_replay in its HDF5 metadata) used as an internal consistency check across world parameterisations, not a sim-to-real validation. An optional py4DSTEM
replay loader is provided so users can substitute real experimental tiles into the same HDF5 schema. Absolute defect-census DEC-AUC values on replay_world are systematically higher than on the main-table worlds because the specimen has a lower
defect density and a smaller per-tile defect prior, which raises the macro-averaged F1 floor: tiles correctly reported as containing no defects contribute positively to the score, lifting all agents (including Random) above the near-zero band
they occupy on the defect-dense main-table specimens. The meaningful cross-specimen comparison is therefore the agent ranking, which is preserved (§4.2, “Replay-world consistency check”).
Tile intensities are normalised to \([0, 1]\). Ground truth is deterministic: atom positions, types, and defect labels are derived directly from the input crystal structures used for simulation. Phase maps are computed from known crystal-phase assignments per unit cell. No manual annotation or post-hoc cleaning is applied.
The intended use is benchmarking autonomous STEM acquisition agents, training RL navigation policies, and evaluating perception pipelines. The dataset may also be used for crystallographic image segmentation or dose–accuracy trade-off studies. It is not suitable for direct comparison with real STEM experiments without domain adaptation, nor for production microscopy control, due to the sim-to-real gap: the simulation omits sample drift, contamination, detector nonlinearity, and inelastic scattering.
The dataset is publicly available on Hugging Face under CC-BY-4.0 (data) and MIT (code). Croissant JSON-LD metadata (MLCommons 1.0 with RAI extension) is provided alongside the dataset files. No export controls or IP restrictions apply.
The dataset is maintained by the paper authors and versioned (current release: v1.0.0). Issues may be reported via the dataset repository. No scheduled updates are planned; future releases may add material systems or difficulty levels.
The dataset is entirely synthetic, so no human subjects, personally identifiable information, or consent issues arise. Autonomous dose-efficient STEM agents could reduce beam damage in real experiments, extending atomic-resolution study to beam-sensitive systems such as metal–organic frameworks, hybrid perovskites, and biological specimens. A potential concern is over-reliance on benchmark performance as a proxy for real-world readiness: agents excelling on simulated worlds may underperform under experimental conditions not captured by our simulation. These simulation gaps are documented in the Croissant RAI metadata fields and this datasheet.
To anchor the sim-only evaluation against real experimental acquisitions, we ran the perception-dominance comparison across a controlled doping gradient ( \(\in\{0, 7, 10, 13, 20\}\%\)) on real HAADF-STEM acquisitions of Sm-doped .
The five acquisitions are taken from a published Zenodo deposit titled “STEM images and associated parameters for Sm-doped BFO” [40] (DOI
10.5281/zenodo.4555979, CC-BY 4.0). They were acquired by Christopher Nelson (Oak Ridge National Laboratory) on Sm-doped samples synthesised by the Ichiro Takeuchi group (University of Maryland) as a combinatorial library, and were later
surfaced through team 14 of the 2024 Mic-hackathon dataset [6] (Zenodo 10.5281/zenodo.15579940, CC-BY 4.0). We
use the same five files selected by the team 14 notebook (Sm_0_1, Sm_7_2, Sm_10_1, Sm_13_0, Sm_20_0), each paired with its published *_UCParameterization.h5 containing
per-unit-cell physics-derived labels: \({\sim}21{,}000\text{--}24{,}000\) unit cells per acquisition with center-of-mass positions xy_COM, polarization vectors Pxy, and atomic-column intensities
I1–I5 obtained by physics-based atomic-column fitting. Each HAADF image is roughly \(4400\times4400\) pixels at \(0.0156\) nm/pixel (\({\sim}69\times69\) nm field of view) and tiles cleanly into a \(34\times34\)–\(36\times36\) grid at the standard \(128\)-pixel
tile size and stride-\(124\) overlap. Two of the five compositions (Sm_0_1, Sm_13_0) carry roughly \(16\%\) of pixels recorded as NaN by the original acquisition
pipeline (instrument scan-edge and beam-track artefacts); the other three are NaN-free. We did not collect any new microscopy data for this paper; the entire real-data sanity check uses the published Zenodo files unchanged.
A converter (released with the benchmark) maps the published HDF5 files into the STEMGym ReplayWorld format. NaN pixels are replaced by the source-image median to keep every \(128\times128\) tile finite, and
the original NaN locations are preserved in the /valid_region mask so downstream analyses can mask them out. Per-unit-cell positions in pixels are scaled to nm using the published Scale dataset and stored as
/ground_truth/atom_positions. The phase-mapping ground truth is derived from the sign(Px), sign(Py) quadrant of each unit cell’s polarization vector (four classes), painted into the image grid via nearest-cell assignment over a
\(\mathrm{cKDTree}\) on the xy_COM coordinates. Defects are marked as “pristine” for every unit cell because the per-cell substitution labels are not provided in the source dataset (intensity-based inference
would be circular against our analyst). The conversion is reproducible from the public files in under one minute on a laptop.
Two agents are run with the standard configuration (dose budget 5000 e Å−2, 200 max steps, scoring every 5 acquired tiles): (i) Raster — heuristic baseline that does not produce a phase prediction; (ii) Raster+Analyst — the same
trained ensemble used in the main results, evaluated zero-shot on the real tiles (no fine-tuning, no domain adaptation). Three seeds are run for each agent on the phase-mapping task across all five compositions (30 episodes total). Performance is scored
against the polarization-derived four-class phase map using macro-IoU integrated over the dose-efficiency curve. Native experimental noise in the HAADF acquisitions is preserved end-to-end: ReplayWorld disables synthetic Poisson noise
injection, ensuring no synthetic noise is layered on top of real instrument noise.
Table 26 reports per-composition DEC-AUC. The heuristic Raster baseline scores exactly \(0.000\) on every composition because it has no phase-identification module and the four-class polarization-quadrant ground truth penalises a default “no prediction” identically across all worlds. Raster+Analyst contributes a non-zero phase signal on two compositions (\(0.066\) on Sm \(0\%\) and \(0.088\) on Sm \(13\%\)) and degenerates to \(0.000\) on the other three (Sm \(7\%\), \(10\%\), \(20\%\)). On the latter three, the trained ResNet phase identifier emits a constant single-class prediction on the first five tiles of each episode and falls back internally to the analyst’s intensity-based heuristic; the heuristic produces a binary \(\{0, 1\}\) split that does not align with the four-class ground truth, yielding zero IoU. The headline observation is that the equipped-vs-naı̈ve direction is preserved on the two compositions where either agent contributes signal and tied on the other three; on no composition does the equipped variant score below the heuristic baseline. The absolute non-zero levels (\(0.066\), \(0.088\)) are below the analyst’s typical simulated-world phase-mapping range (\(0.10\)–\(0.20\)), consistent with a residual sim-to-real domain gap: the analyst was trained on simulated and tiles, not on , and the real acquisition has substantially finer pixel pitch (\(0.0156\) nm/pixel vs.\({\sim}0.05\) nm/pixel in simulation), denser per-tile atom counts, and instrument-specific noise statistics. Deterministic raster trajectories and deterministic analyst inference yield zero seed variance throughout.
| Agent | Sm \(0\%\) | Sm \(7\%\) | Sm \(10\%\) | Sm \(13\%\) | Sm \(20\%\) |
| Sm_0_1 | Sm_7_2 | Sm_10_1 | Sm_13_0 | Sm_20_0 | |
| Raster (heuristic) | \(0.000{\scriptstyle\pm0.000}\) | \(0.000{\scriptstyle\pm0.000}\) | \(0.000{\scriptstyle\pm0.000}\) | \(0.000{\scriptstyle\pm0.000}\) | \(0.000{\scriptstyle\pm0.000}\) |
| Raster+Analyst | \(0.066{\scriptstyle\pm0.000}\) | \(0.000{\scriptstyle\pm0.000}\) | \(0.000{\scriptstyle\pm0.000}\) | \(0.088{\scriptstyle\pm0.000}\) | \(0.000{\scriptstyle\pm0.000}\) |
4pt
This is a sanity-check, not a sim-to-real validation. The five compositions are drawn from a single combinatorial library on a single instrument; cross-instrument generalisation is unaddressed. The polarization-quadrant phase map we use as ground truth
is itself a physics-based reconstruction from atomic-column fitting (the published xy_COM and Pxy datasets [40]), not a
directly measured label, and the four-class scheme we derive from polarization-vector signs is one of several plausible binnings of the underlying continuous polarization field. We deliberately did not retrain the analyst on tiles to keep the test honest:
the result reports zero-shot transfer of a perovskite-trained perception module to a chemically-different perovskite ( \(\neq\) or ), and the analyst’s degeneration on Sm \(7\%\), \(10\%\), \(20\%\) likely reflects this transfer limitation rather than a fundamental benchmark issue. A multi-material analyst training corpus, additional task definitions on this dataset (e.g.,
Sm-substitution detection from the published intensity arrays), and additional real specimens beyond are identified as primary directions for future work in §6.
Pre-generated worlds (\({\sim}\)8 GB) and model checkpoints (\({\sim}\)530 MB) are hosted on Hugging Face as stem-gym-benchmark. A download utility with selective flags for worlds, checkpoints, the transfer-set, and a smoke-test subset is provided in the repository. Croissant JSON-LD metadata is available at the Hugging Face API endpoint for the dataset.
Per-material generation utilities are released with the repository; a Materials Project API key is required for the generator, and all other materials use built-in unit cells. The simulation extras (pip install -e ".[sim]") provide abTEM,
pymatgen, ASE, and CuPy. Easy and medium worlds can be generated on an A100 (80 GB); hard worlds require H200 (141 GB). See SI 18 for full requirements. Because frozen-phonon configurations use random seeds, regenerated
worlds will differ at the individual-tile level but preserve statistical properties (defect density, spatial distributions, noise characteristics).
All experiments are launched from configuration files released with the repository; the runner supports parallel execution and incremental save with auto-resume so re-running a configuration skips completed (agent, task, world, seed) combinations. The repository contains 29 configuration files covering all reported experiments. Seeds are consecutive integers starting from 0.
The analyst ensemble is trained on four easy-difficulty worlds (, , SiGe, GaN) with Pt nanoparticles held out as an unseen material family; an 80/20 random tile split (seed 42), Adam optimiser (\(\text{lr} = 10^{-3}\)), and early stopping (patience 7) are used. The phase identifier auto-detects worlds containing multi-valued phase maps (, GaN). RL baselines (DQN, PPO, SAC) are trained for \(50{,}000\) steps. Transfer checkpoints are produced by re-training the analyst on a single material at a time. Training utilities and the exact invocations used to reproduce all reported checkpoints are released with the repository; training from scratch takes approximately two hours on a single GPU.
Table 27 lists key dependency versions. VLM experiments use commercial APIs; their outputs are inherently non-deterministic.
| Package | Version | Role |
|---|---|---|
| Python | \(\geq\)3.10 | Runtime |
| PyTorch | \(\geq\)2.0 | Neural models, RL |
| Gymnasium | \(\geq\)0.29 | Environment interface |
| BoTorch | \(\geq\)0.9 | GP-UCB navigation |
| abTEM | \(\geq\)1.0.0b30 | Multislice STEM simulation |
| Stable-Baselines3 | \(\geq\)2.0 | DQN/PPO/SAC training |
| h5py | \(\geq\)3.8 | HDF5 world I/O |
(i) Frozen-phonon thermal diffuse scattering uses random seeds: regenerated worlds differ at the tile level but preserve ensemble statistics. (ii) VLM API responses are non-deterministic; exact scores will vary across runs. (iii) GP-UCB acquisition-function fitting via BoTorch exhibits minor numerical variation across hardware and CUDA versions.
Corresponding author.↩︎