DocumentsDeePMD-kit
Model Reuse in dpgen
Model Reuse in dpgen
Type
Topic
Status
Published
Created
Jul 7, 2026
Updated
Jul 7, 2026
Created by
Dosu Bot
Updated by
Dosu Bot

Model Reuse in dpgen#

dpgen supports two related but distinct mechanisms for reusing previously trained models across active learning iterations:

  1. training_init_model — a transfer-learning / warm-start approach where model weights from the previous iteration are carried forward as the starting point for the next training run.
  2. training_reuse_* family — a set of parameters that tune how the reuse training proceeds (data sampling ratio, number of steps, learning rate, and loss prefactors).

All parameters live in param.json under the top-level training section and are documented in dpgen/generator/arginfo.py. The application logic is in make_train_dp() and run_train_dp().


training_init_model#

KeyTypeDefault
training_init_modelboolfalse
training_iter0_model_pathlist[str][]

When training_init_model: true, the model trained at iteration N−1 is passed to DeePMD-kit via --init-model old/model.ckpt, preserving all learned weights (embedding network, fitting network) instead of starting from random initialization . At iteration 0, it falls back to initializing from paths listed in training_iter0_model_path .

The actual --init-model flag injection happens in run_train_dp(). If a checkpoint already exists (e.g., a restarted run), dpgen uses --restart instead, so --init-model only fires on a fresh start .

Related options — for iteration 0 only:

  • training_init_frozen_model — initializes from a pre-existing frozen model (.pb / .pth) via --init-frz-model .
  • training_finetune_model — fine-tunes from a frozen model via --finetune .

All three (training_init_model, training_init_frozen_model, training_finetune_model) are mutually exclusive; dpgen raises a RuntimeError if more than one is set .


training_reuse_* — Reuse Mode#

These parameters are only active when training_reuse_iter is set and the current iteration index ≥ training_reuse_iter. At that point, training_init_model is also forced to true .

KeyTypeDefaultPurpose
training_reuse_iterintNoneFirst iteration index at which reuse mode activates
training_reuse_old_ratiofloat or str"auto"Probability weight assigned to old-iteration data
training_reuse_numb_stepsintNoneOverrides numb_steps/stop_batch for reuse iterations
training_reuse_start_lrfloatNoneOverrides learning_rate.start_lr
training_reuse_start_pref_efloatNoneOverrides loss.start_pref_e
training_reuse_start_pref_ffloatNoneOverrides loss.start_pref_f

Alias: training_reuse_stop_batch is a legacy alias for training_reuse_numb_steps .

training_reuse_old_ratio values#

dpgen uses this ratio to set a prob_sys_size sampling probability, splitting data directories into an "old" group (iterations 0 … N−2) and a "new" group (iteration N−1) :

  • float (e.g., 0.3) — 30% old data, 70% new data. Values of 0.3–0.5 are recommended when the new dataset is much smaller than the accumulated old data .
  • "auto:f" — automatic ratio where the new-to-old sampling ratio is f; dpgen counts frames in all data systems and computes ratio = n_old / (n_old + f × n_new) .
  • "auto" — equivalent to "auto:10" (10× preference for new data) .

Example configuration#

"training_init_model": true,
"training_reuse_iter": 5,
"training_reuse_old_ratio": 0.3,
"training_reuse_numb_steps": 400000,
"training_reuse_start_lr": 1e-4,
"training_reuse_start_pref_e": 0.1,
"training_reuse_start_pref_f": 100

This is representative of a scenario where a large initial dataset is supplemented by smaller per-iteration FP data .


Key source files#

FileRelevance
dpgen/generator/arginfo.py:89-229Argument definitions and docstrings for all reuse parameters
dpgen/generator/run.py:270-551make_train_dp() — builds input JSON with reuse overrides
dpgen/generator/run.py:729-822run_train_dp() — constructs the dp train command with --init-model
tests/generator/test_make_train.py:324-366Integration test for training_reuse_*
dpgen param docsOfficial user-facing parameter reference
Model Reuse in dpgen | Dosu