Domain Post-Training for Scientific LLMs and Self-Checking Simulation Results
General-purpose LLMs have broad public knowledge, but scientific tasks often expose gaps in domain conventions, experimental context, and traceable reasoning. This article covers domain post-training for scientific LLMs, including the data needed for effective training, layered evaluation with confidence intervals, and a molecular simulation case study on duplicate torsion terms. It also outlines how to integrate LLMs into troubleshooting workflows and practical recommendations for deployment.
1. Limitations of General Models in Scientific Tasks
General-purpose LLMs hold a large amount of public knowledge, but they often run into three types of problems in specific scientific tasks. First, domain conventions are unclear. For example, the same physical quantity may use different unit systems or symbols in different publications. Second, experimental conditions are missing. Conclusions from the model often ignore prerequisites such as temperature, pressure, and sample preparation methods. Third, the reasoning process is not traceable. The final answer may look reasonable, but the intermediate steps cannot be checked.
Domain post-training is a common way to address these problems. It continues training a general model on domain-specific data so that the model becomes familiar with terminology, calculation practices, and judgment criteria in that field. The effectiveness of post-training depends on both data quality and evaluation methods; neither can be omitted.
2. Data Composition for Domain Post-Training
Training data for scientific scenarios usually contains three parts.
1. Professional knowledge text. This includes textbooks, review articles, standards and specifications, and selected paper body text. Such data helps the model build a conceptual system, such as the physical meaning of force field parameters and the applicable scope of common approximations. Data sources and versions need to be recorded for later traceability and updates.
2. Expert feedback. Researchers’ corrections, ratings, and comparison results for model answers fall into this category. The value of feedback lies in identifying why an answer is wrong, not just providing the correct answer. For example, an expert can point out that “the model ignored the effect of the cutoff radius on long-range interactions.” Such annotations help the model learn the basis for judgment.
3. Complete experimental process records. Experimental records include parameter settings, failed attempts, intermediate results, and decision rationale. Taking materials screening as an example, records should cover the generation rules for candidate objects, reasons for elimination, and the rationale for the final choice. What the model learns from the process is the reasoning path; a bare answer cannot provide this information.
Two points need attention during data construction. First, multiple attempts of the same experiment should retain their complete relationships. Do not keep only the successful attempt, or the model will overestimate the success probability. Second, personal information, unpublished research results, and restricted data must go through de-identification and authorization checks before ingestion.
3. Designing Evaluation Methods
Whether post-training is effective needs to be verified with an independent evaluation set. The evaluation set should meet three conditions: the questions do not overlap with training data, the answers have been reviewed by experts, and the question types cover the main scenarios of the target task.
Evaluation metrics should be designed in layers:
- Final conclusion accuracy: Determine whether the answer is consistent with the reference result.
- Intermediate step validity: Check whether the derivation uses the correct formulas and units.
- Reproducibility: Run the same question multiple times and observe whether the conclusion is stable.
Success rates need confidence intervals; otherwise, fluctuations under small samples are easy to misread. The following code uses the Wilson interval to calculate the confidence range of a success rate.
import mathdef wilson_interval(successes: int, n: int, z: float = 1.96):"""Calculate the Wilson confidence interval for a binomial proportion (default ~95% confidence)."""if n <= 0:raise ValueError("The sample size n must be greater than 0")p = successes / ndenom = 1 + z**2 / ncenter = (p + z**2 / (2 * n)) / denomhalf = z * math.sqrt(p * (1 - p) / n + z**2 / (4 * n**2)) / denomreturn center - half, center + halflow, high = wilson_interval(successes=38, n=100)print(f"Confidence interval: [{low:.3f}, {high:.3f}]")
When comparing different models, use the same prompts, the same questions, and the same scoring rules. Only when these conditions are consistent does the difference between two success rates have comparative meaning.
4. Case Study: Duplicate Torsion Terms in Molecular Simulations
4.1 Symptom
While simulating a polyethylene system, researchers found a clear deviation between the calculated density and the experimental value. Other indicators of the simulation result, such as the radial distribution function, looked basically normal, so the problem was not easy to notice.
4.2 Background
Classical force fields decompose the potential energy of a system into bond stretching, angle bending, dihedral torsion, and nonbonded interactions. The dihedral torsion term is determined by four atoms together and describes the energy change when rotating around the middle bond. The polyethylene backbone contains many such four-atom combinations, and the torsion term has a strong influence on chain conformation and packing density.
If the same four-atom set appears twice in the topology file, the torsion energy is calculated twice. This changes the conformational distribution and, in turn, affects the density.
4.3 Troubleshooting Steps
The following order is recommended:
- Check topology definitions. Count all four-atom combinations for dihedrals. Note that forward and reverse orders represent the same set of atoms, so they need to be canonicalized before comparison.
- Decompose energy terms. Perform a single-point energy calculation for a single molecule, output bond, angle, torsion, and nonbonded energies term by term, and compare them with reference values.
- Distinguish legitimate multiple definitions. Some force fields allow the same four-atom combination to contain multiple torsion terms, such as multiple components of a Fourier series. This is not an error and needs to be judged against the force field file format.
- Revalidate after correction. Remove the erroneous entries, recalculate the density, and confirm that the energy decomposition results match the reference values.
The following code finds dihedrals that appear repeatedly after canonicalization.
from collections import Counterdef canonical_dihedral(atoms):"""Canonicalize a four-atom sequence so forward and reverse orders are treated as the same dihedral."""a, b, c, d = atomsreturn min((a, b, c, d), (d, c, b, a))def find_duplicate_dihedrals(dihedrals):"""Return dihedrals that appear more than once and their counts."""keys = [canonical_dihedral(tuple(x)) for x in dihedrals]counts = Counter(keys)return {k: n for k, n in counts.items() if n > 1}dihedrals = [(1, 2, 3, 4), (4, 3, 2, 1), (2, 3, 4, 5)]print(find_duplicate_dihedrals(dihedrals))# {(1, 2, 3, 4): 2}
This code can only find duplicates at the topology level. If the duplicate entries come from legitimate multiple definitions in the force field, they still need to be judged one by one against the force field file documentation.
4.4 Validation Methods
After correction, two types of checks can be used to confirm the result. The first is a local check: calculate the torsion energy curve for a small molecule such as butane and compare it with a published reference curve. The second is a global check: re-simulate the complete system, observe whether the density returns to a reasonable range, and check whether repeated simulation runs converge.
5. Integrating Models into Troubleshooting
LLMs can take on two tasks in troubleshooting: reading topology files and logs and proposing possible causes; and listing items to check based on energy decomposition results. These outputs are hypotheses, not conclusions. The model may provide explanations that look reasonable but do not match the specific force field, so every hypothesis needs a corresponding verification step.
A recommended collaboration workflow is as follows:
- The model lists candidate causes and marks the verification method for each cause.
- Researchers verify each item with scripts or manual checks.
- Verification results are written back into experimental records as material for later training and evaluation.
- All modifications keep version records for traceability.
6. Practical Recommendations
First, data governance should come first. Training data needs to record sources, authorization scope, and update time, and materials of unknown origin should be avoided.
Second, the evaluation set should be isolated from the training set. Once evaluation questions enter training data, the evaluation results lose their reference value.
Third, keep human review gates. Content involving experimental conclusions, safety-related parameters, and external publication must be confirmed by domain experts before use.
Fourth, record failure cases. Troubleshooting processes and error causes are as valuable for training as success cases and should be included in the data system.
Domain post-training and model-assisted troubleshooting cannot replace the judgment of researchers. Their role is to shorten the troubleshooting path, reduce omissions, and make every step of reasoning checkable.
