Skip to content

Configuration

NeuralPOM uses JSON configuration files for both training and inference. All parameters are specified in a single JSON file, making experiments self-documenting and reproducible.

Training Configuration

Example: configs/train_decoder_only.json

json
{
  "lr": 0.001,
  "epochs": 100,
  "start_day": 50,
  "end_day": 800,
  "test_start_day": 700,
  "test_end_day": 800,
  "batch_size": 1,
  "sample_freq": 1,
  "train_sample_freq": 1,
  "val_sample_freq": 1,
  "target_idx": 0,
  "reuse_core_pool": true,
  "use_encoder": false,
  "use_decoder": true,
  "use_pretrain": false,
  "grad_clip_norm": 1.0,
  "core_name": "implicit",
  "core_im": 90,
  "core_jm": 82,
  "correction_scale": 0.001,
  "mean_path": "/path/to/mean_field/checkpoints/initial_state.npz",
  "supervision_mode": "pointwise_baseline",
  "multiscale_sigmas": [1.0, 2.0],
  "multiscale_weights": [0.5, 1.0],
  "multiscale_eps": 1e-6,
  "horizon_decay": 0.8,
  "loss_display_scale": 100000.0,
  "loss_weights": {
    "u": 12.0, "ub": 18.0, "v": 10.0, "vb": 12.0,
    "t": 1.0, "s": 6.0, "el": 30.0,
    "ua": 60.0, "uab": 60.0, "va": 60.0, "vab": 60.0
  }
}

Core Parameters

ParameterTypeDescription
core_namestrDynamic core: "explicit" or "implicit"
core_imintGrid size in the i-direction (east-west)
core_jmintGrid size in the j-direction (north-south)
correction_scalefloatScaling factor for CorrectorNet output applied to physics state

Training Parameters

ParameterTypeDescription
lrfloatLearning rate for Adam optimizer
epochsintNumber of training epochs
batch_sizeintPer-GPU batch size (total = batch_size × world_size)
grad_clip_normfloatGradient clipping norm threshold
loss_display_scalefloatGlobal scaling factor for displayed loss values

Data Parameters

ParameterTypeDescription
start_dayintFirst day of training data (simulation day index)
end_dayintLast day of training data
test_start_dayintFirst day of validation data
test_end_dayintLast day of validation data
target_idxintTarget segment index in the NPZ data files
train_sample_freqintSampling frequency for training (1 = every day)
val_sample_freqintSampling frequency for validation
mean_pathstrPath to NPZ file with mean fields for normalization

Supervision Parameters

ParameterTypeDescription
supervision_modestrLoss mode: "pointwise_baseline", "multiscale_lowpass", or "horizon_decay"
multiscale_sigmaslist[float]Gaussian filter sigmas for multiscale supervision
multiscale_weightslist[float]Weights for each scale in multiscale loss
multiscale_epsfloatEpsilon for numerical stability in multiscale normalization
horizon_decayfloatDecay factor (γ(0,1]) for horizon-weighted supervision

Network Parameters

ParameterTypeDescription
use_encoderboolEnable encoder CorrectorNet (pre-physics)
use_decoderboolEnable decoder CorrectorNet (post-physics)
use_pretrainboolLoad pretrained weights
reuse_core_poolboolReuse a pool of core instances across batches (memory optimization)

Loss Weights

Loss weights balance the 12 prognostic fields. Higher weights emphasize fields with smaller magnitude or higher dynamical importance:

L=wuLu+wubLub+wvLv+wvbLvb+wTLT+wSLS+wηLη+wuaLua+wuabLuab+wvaLva+wvabLvab

For an explanation of each field, see CorrectorNet Architecture.

Inference Configuration

Example: configs/inference_default.json

json
{
  "model_path": "./checkpoints_model/corrector_best.pth",
  "mean_path": "/path/to/mean_field/checkpoints/initial_state.npz",
  "start_day": 700,
  "end_day": 701,
  "target_idx": 0,
  "use_encoder": true,
  "use_decoder": true,
  "core_name": "implicit",
  "core_im": 90,
  "core_jm": 82,
  "correction_scale": 0.001,
  "output_dir": "inference_results"
}
ParameterDescription
model_pathPath to the trained CorrectorNet checkpoint (.pth)
start_day / end_daySimulation day range for inference
output_dirDirectory for saving inference outputs
use_encoder / use_decoderEnable/disable encoder and decoder correction stages

Overriding Config via Command Line

Configuration values can be overridden from the command line:

bash
torchrun --nproc_per_node=8 scripts/training/train_npom.py \
  --config configs/train_decoder_only.json \
  --lr 0.0005 \
  --epochs 200 \
  --supervision_mode multiscale_lowpass

Any JSON key can be passed as --key value to override the file-based configuration.

Released under the MIT License.