The Model Stays, Only the Procedure Changes: Gan Jiang, an X-ray Analysis Agent

An X-ray diffraction agent that never retrains its language model—instead it turns each analysis failure into a reusable "procedure" to run on the next sample. Even without composition information, it beat the previous state-of-the-art method by a wide margin.
← 목록으로
온
온틀 리서치
2026년 10월 10일 Updated 2026.10.16 31 min read views 2

Sometimes the job is to name the atomic arrangement of a material from a single pattern. Enter Gan Jiang, a new agent that—without even being told which elements make up the material (its composition)—beat the previous best method by roughly 38 percentage points on simulated data. On real mineral data it won by a double-digit margin too. And yet the same agent, faced with data measured in an actual lab, got its very first answer right only 40.83% of the time. More than half the time, the first answer was wrong. A crushing win and a sober limitation, written on the same report card.

What's interesting is how those marks were earned. Usually, to make an AI smarter, you retrain the model. Gan Jiang didn't. It left both the language model that reads instructions and lays out plans, and the underlying physics models, untouched. Instead, every time an analysis failed, it turned that failure into "a procedure you can run verbatim on the next sample" and stacked those up. It's like leaving the brain alone and only rewriting the working manual in your hands.

Why This Is Hard

X-ray diffraction (XRD) fires X-rays at a material and reads the atomic arrangement inside from the pattern that bounces back. The trouble is that reading this pattern backward to reconstruct the structure doesn't give one clean answer. Peaks overlap, and when the atomic arrangement is slightly disordered or the crystals are oriented along one direction, different structures end up looking equally plausible. Mathematicians call this an "ill-posed inverse problem"—shorthand for the fact that there can be many answers.

So a trustworthy interpretation doesn't appear in one shot. You have to go through a chain of decisions: which candidate structure to use, which values to fine-tune, how to read the residual error. Each choice reshapes the next. That chain is exactly where a human expert's hand matters most, and where automation most often slips.

For the record, this paper deals with powder XRD (PXRD). It compresses the scattering from countless tiny crystals, each oriented differently, into a single one-dimensional pattern—so the information piles up and makes things trickier. Peak positions carry the spacing of the crystal lattice, intensities carry the atomic arrangement and the ratio of phases (a phase being a state in which the same elements are arranged differently), and widths carry the influence of crystallite size and the measuring instrument.

Using machine learning to look at a pattern and classify a phase or search for a structure already works. Programs that validate predictions numerically already exist. The gap was elsewhere: finishing the analysis of one sample never made the "procedure for handling the next sample" any better. A failed adjustment, an expert's correction, a recovery trick that happened to work—these have to turn into reusable knowledge, and that knowledge has to be tested to see whether it holds beyond the single event that produced it, on other samples too. Gan Jiang is what you get when that transition is built explicitly into the system.

The Moment a Failure Becomes a Procedure

One example from the authors shows the system's workings most vividly. While analyzing with GSAS-II—a refinement tool (the process of fine-tuning a candidate structure's numbers to match the actual measurement)—changing several values at once actually worsened the fit to the measurement. The agent didn't let that failure slide. It traced back the execution log to find the cause and carved a rule into its procedure: "start from the defaults and adjust only one group at a time." That rule stays with every subsequent analysis, without retraining the model. A single failure changed the order of operations for the next sample.

For this to work, two layers have to mesh: the hand that does the analysis, and the method for fixing that hand.

The analyzing hand is a set of engines with divided roles, like a team of specialists. There's an engine that matches the measured pattern against existing records to narrow down candidates, an engine that—given element information—searches for a structure with a trained model, an engine that decomposes a multi-component sample phase by phase, and an engine that models the whole pattern at once while staying within the bounds of physical law. Two long-trusted refinement tools are attached as well. Finally, an inspector layer stands at the gate, checking every result back against the measurement. No matter which engine produces which answer, only what passes this gate goes out.

The method for fixing the hand is the heart of the paper. The memory Gan Jiang accumulates isn't an abstract lesson but an immediately executable "skill." Each skill bundles together what to do (the command), when to reach for it (the context), and how to evaluate the result (the inspection code). A selector (a router) picks the skill that fits the current situation, runs the one suited to the task, then traces back the execution log and proposes, on its own, how to revise the skill. A validation check guards against regressions where "fixing it made things worse."

Here the authors draw a firm line between two things. One is "model tuning," which just aims to fit this one sample well—refining a single lattice constant to match this specimen. That's over and done in one go. The other is skill learning, which "changes the procedure itself" to handle the next sample better—changing when a lattice constant should be freed, which diagnostics must always be checked. That carries forward to the next sample. In the earlier metaphor, it's the difference between a junior analyst solving this sample well and leaving behind "a checklist the next person can follow exactly."

How Much It Won, and How

Performance was measured on the authors' own benchmark, DeltaXRDbench. It holds 62,044 patterns—single-phase samples with one phase, and mixtures of two or three. The data comes in three strands: ones simulated by calculation (MP500), ones measured from real minerals (RRUFF), and ones obtained experimentally (opXRD). Treat each as harder than the last.

One decision in the scoring matters. It doesn't check whether the database ID was matched; it directly compares the crystal structure file the agent submits against the ground-truth structure. It's the structure itself, not the ID number, that has to be right.

Here is the rate of naming the single most likely candidate (top-1) from the pattern alone (no composition information):

Dataset Gan Jiang AutoXRD (previous best) Gap
MP500 (simulated) 96.30% 58.00% +38.30pp
RRUFF (real minerals) 81.78% 58.47% +23.31pp
opXRD (experimental) 40.83% 26.45% +14.38pp

The ranking tells the same story. On MRR@5—which scores how high up the correct answer lands among the top five candidates—Gan Jiang beat AutoXRD across all three datasets. Feed in a reference composition as well and top-1 climbs higher still, reaching 99.90% on the easiest set, MP500.

This gap says something. The generation-based comparison methods lean heavily on element information. Strip out the composition and their performance essentially collapses (see the FAQ below for details). Gan Jiang led by a wide margin even without composition. What's more, it opens this gap against AutoXRD even though the two share the same starting line for assembling candidates. That said, you can't attribute this identification-accuracy gap specifically to the inspector gate or to skill learning. The shared starting line only lets us say the gap arises somewhere in the full pipeline built on top of it; which part contributed how much is not something this table can separate. The effect of skill learning is measured separately in the refinement-score experiment below, which is a different experiment from this identification-accuracy comparison.

The procedure's self-improvement showed up on held-out data (data never used to learn procedures and reserved purely for evaluation) like this:

Refinement engine Before learning After learning
FullProf 46.90 72.38
GSAS-II 39.01 60.02
PyWPEM 31.74 38.33

Read these scores carefully. They summarize how well the result matches the measured pattern—not "the rate of correctly identifying the structure"—and they fold in failed or timed-out runs as zeros. On top of that, the three engines are fixed in different ways. One has its workflow touched, one its skills and settings, one only its skills. So you shouldn't line up the three numbers as "the effect of the same intervention." PyWPEM's smaller gain is a sign that the improvement's effect depends on the conditions.

Beyond the tables, four real analyses show the payoff.

  • In an orthorhombic (a block-shaped crystal with all three edge lengths different) compound with severely overlapping peaks, 383 pairs of overlapping diffraction lines were untangled by modeling the entire pattern as a whole.
  • In a sample of ancient Egyptian cosmetic powder, it decomposed five phases and even estimated each mass fraction: gypsum 12.53%, phosgenite 18.53%, cerussite 32.02%, galena 9.69%, laurionite 27.23%. The substantial lead-chloride content lined up with prior work suggesting "deliberate chemical processing."
  • Patterns captured continuously from an operando (measured while the battery is actually charged and discharged) cathode were treated as "a connected trajectory." The analysis result of one state was handed to the next analysis as its starting value, so that experience carried forward as analyses piled up. It's this article's theme, reproduced right there in the data.
  • For a Ru-Mn oxide catalyst, it compared candidate atomic-site arrangements within a superlattice (a structure in which the base crystal lattice stacks regularly at a larger period) and picked one. The model the agent chose was registered in a crystal structure database as a public structural hypothesis for follow-up work to reference (CCDC 2530452).

The Distance Still Left

The authors are candid about their own limits. This experiment demonstrated transfer after a "controlled revision and freeze"—not a sustained watch to confirm that it keeps improving over long real-world use. It showed the footing for a possibility, not a proof of the whole process. They also pin the performance advantage to being the best "among the methods evaluated under the benchmark conditions this paper set." And they note explicitly that the mixtures synthesized from experimental patterns don't reproduce every effect of a sample where powders were actually mixed.

I'd add one observation of my own. The baseline skills themselves were procedures "designed by experts." So much of this system's achievement rests on human expertise baked into the inspector and the policy design. It reads more accurately to say the self-learning amplifies that foundation than replaces it. On the measured data where the human-laid foundation hasn't yet reached—opXRD is where that stands—the absolute scores were modest even while the lead held. Which means this field is fundamentally hard, and there's a long way to go.

What It Means for ONTLE

ONTLE assigns an AI PM to each customer project. Say that PM keeps getting stuck at the same point while handling one customer's deployment request. The common response is to patch that one case in a hurry and move on. Then the same failure repeats with the next customer.

Port Gan Jiang's discipline and it goes like this. From customer A's deployment-failure log, you extract a single procedure—"generate a preview before deploying." You don't put it straight into the official playbook. First you test whether the procedure actually holds, not on customer A who produced the failure, but in the separate situations of customers B and C. Only if it beats the old way there do you adopt it. Fix the procedure, not the model—that's the core.

Why does it matter what you fix? Because you're editing the external procedures, instructions, and code rather than the language model's weights, you can version the changes, audit who changed what, when, and why, and roll back if something breaks. Change the numbers inside the model directly and all three of those get hard.

Of course, solving X-ray patterns and managing customer deployments are different jobs. What's the same isn't the implementation but the principle: don't end a failure with a one-off patch—turn it into a validated procedure and stack it, and keep the axis along which those improvements accumulate outside the model. This is the very direction ONTLE actually chose when it redesigned its PM. The way to fix a PM whose words and actions diverged wasn't to beg the model to "do better"—it was to peel execution off into a separate service that runs on rules, and to lock the pass/fail judgment behind policy.

One small detail is especially useful. Gan Jiang doesn't conclude "this sample is a mixture of several phases" from the mere fact that a tool call failed. It distinguishes a computation that failed from evidence that a hypothesis is wrong. An AI PM, likewise, shouldn't turn a single execution error straight into the trigger for a misdirected escalation. Pin down the cause of the failure first. Then choose the path. And let the pass/fail verdict be rendered mechanically by a rule set in advance—not by whether the model says "this looks good."

FAQ

Can I try Gan Jiang myself?

The paper's appendix describes Gan Jiang's API. It covers an agent mode and direct CLI access, the way data is exchanged via artifacts, and examples of structure-based diffraction calculation and refinement. That said, this excerpt doesn't give a public repository address as a URL. For the concrete way in, it's more accurate to check the original paper and its supplementary materials.

Why can the generation-based comparison methods barely get anything right without composition information?

They were evaluated with their publicly available pre-trained versions, and they depend heavily on the element information the downstream model requires. Under a pattern-only condition, Uni3DAR is set up to predict the elements first and then feed that into the other methods' inputs as well—so if this prediction wobbles, the whole thing essentially collapses. Supplying a reference composition recovers much of it, but that's precisely the contrast with Gan Jiang, which led by a wide margin even without composition.

Can this self-learning approach be used as-is in scientific fields other than XRD?

This paper's experiments and evaluation are specialized to powder XRD. The improvement is tailored to the field too—tying skill revisions to diffraction error, execution results, and the physical validity of the refinement model. The skeleton of read-fix-retrace learning is general in itself, but transfer to other fields is outside what this excerpt demonstrates. It's too early to assume the same performance.

References

  • Paper: Gan Jiang: A self-learning scientific agent for X-ray diffraction
  • Authors: Bin Cao, Huichi Zhou, Runyu Yang, Jingsong Li, Shuchen Sun, Yan Song, Hanyu Gao, Zhongwei Yu, Tong-Yi Zhang, Jun Wang (HKUST-Guangzhou, UCL, AI Lab of the Yangtze River Delta, Institute of Automation CAS)
  • arXiv: https://arxiv.org/abs/2610.07862
  • HuggingFace: https://huggingface.co/papers/2610.07862