Model Reuse in dpgen#
dpgen supports two related but distinct mechanisms for reusing previously trained models across active learning iterations:
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.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#
| Key | Type | Default |
|---|---|---|
training_init_model | bool | false |
training_iter0_model_path | list[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 .
| Key | Type | Default | Purpose |
|---|---|---|---|
training_reuse_iter | int | None | First iteration index at which reuse mode activates |
training_reuse_old_ratio | float or str | "auto" | Probability weight assigned to old-iteration data |
training_reuse_numb_steps | int | None | Overrides numb_steps/stop_batch for reuse iterations |
training_reuse_start_lr | float | None | Overrides learning_rate.start_lr |
training_reuse_start_pref_e | float | None | Overrides loss.start_pref_e |
training_reuse_start_pref_f | float | None | Overrides loss.start_pref_f |
Alias:
training_reuse_stop_batchis a legacy alias fortraining_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 isf; dpgen counts frames in all data systems and computesratio = 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#
| File | Relevance |
|---|---|
dpgen/generator/arginfo.py:89-229 | Argument definitions and docstrings for all reuse parameters |
dpgen/generator/run.py:270-551 | make_train_dp() — builds input JSON with reuse overrides |
dpgen/generator/run.py:729-822 | run_train_dp() — constructs the dp train command with --init-model |
tests/generator/test_make_train.py:324-366 | Integration test for training_reuse_* |
| dpgen param docs | Official user-facing parameter reference |