Training

Training#

train_basis() trains one basis on one target image, the loop the Julia goldens are recorded with. train_basis_batched() is the port of upstream’s dataset trainer: several images, epochs, a cosine learning-rate schedule, validation and early stopping. train_basis_steps() is not in upstream: a fixed number of Adam steps, each on a fresh batch under a fresh observation mask, for training a basis through a solver. train_basis_exact() is not in upstream either: no gradient steps, but exact block-coordinate descent on the sparsity objective, each gate of a separable circuit set in closed form to its best given the others (the polar factor of its environment for a unitary gate, the environment’s phases for a phase tensor).

Training pipelines.

Four trainers:

  • train_basis — optimize on one target image, which is what the Julia goldens harness runs (upstream has no one-image trainer of its own).

  • train_basis_batched — upstream’s train_basis: several images, epochs, a cosine LR schedule, validation + early stopping, JIT’d Adam fast path.

  • train_basis_steps — not in upstream: a fixed number of Adam steps, each on a fresh batch under a fresh observation mask, for objectives that train a basis through a solver (pdft.tasks.completion_loss).

  • train_basis_exact — not in upstream: no gradient steps; the sparsity objective by exact block-coordinate descent, each gate set in closed form to its best given the others (a separable circuit only).

Contents

train_basis

Train basis to minimize loss(basis.tensors, target) over steps.

train_basis_batched

Multi-image, multi-epoch trainer with cosine LR schedule.

train_basis_exact

Train a separable circuit basis by exact block-coordinate descent on its sparsity.

train_basis_steps

Train basis for steps steps, each on a fresh batch under a fresh mask.

TrainingResult

cosine_with_warmup

Linear warmup followed by cosine decay.