ParticleGAN integration
HyperGAN consumes ParticleGAN's released GAN recipe through
defaults = "particlegan". The train and all extras require ParticleGAN
>=0.12.0,<0.13; 0.12.0 is the current released compatibility baseline.
ParticleGAN owns the formulation and its selected
loss, learning rates, hyperparameters, normalization, regularizers and optimizer
implementations. HyperGAN owns networks and bindings, datasets, task objectives,
execution, checkpoints, sampling and metrics. Formulation research and technique
selection belong in ParticleGAN.
Generated projects inherit the installed public preset. Explicit configuration
values override the corresponding defaults. The resolved recipe table records
the dependency's complete settings, including settings HyperGAN does not
interpret. Preserve it as dependency-owned state when exporting a configuration;
do not hand-edit it to select internal techniques. Saved runs restore that
snapshot rather than selecting the latest preset again. Exact checkpoint
continuation still requires compatible runtime and source fingerprints.
hypergan.particlegan_integration is the adapter for preset resolution, scalar
configuration overrides and host feature checks. Configuration inspection reads
ParticleGAN's public recipe fields without importing Torch. Training delegates
loss, penalty, prior policy, regularization, schedules and optimizer construction
to the recipe's public factories. The Model tab identifies ParticleGAN as the
provider and shows host settings, loss metrics and networks.
ParticleGAN 0.12.0 selects unified_v12 (energy-optimal Unified 4-Law) by default. Select a specific preset with, for example, defaults = "particlegan:unified_v11", defaults = "particlegan:empf", or defaults = "particlegan:bispf_optimized". The packaged cifar10-tiny-transformer uses a frozen ResNet-18 critic and a 16,384-particle prior. Single-host replicated training synchronizes Unified-v12, Unified-v11, and EMPF state across ranks. The CIFAR guide identifies the ParticleGAN version and preset for each measured run. CIFAR results · Multi-GPU scope
Each distinct critic named by an adversarial loss gets its own recipe loss, optimizer, penalty and step record. Each optimizer steps once per critic phase. Repeated terms for the same critic share its optimizer and record. During the generator phase all critics are frozen. Their weighted objectives and the single shared prior regularizer feed one backward pass and one generator/prior optimizer step. The first critic supplies the recipe record read by that shared optimizer and regularizer.
Under multi-critic training with thermal step records (such as Unified-v11), each critic retains its own domain-specific residual EMAs while HyperGAN enforces the coupled_max thermal policy across all critics (MultiCriticThermalCoordinator): every critic holds a single synchronized effective thermal scale s_shared = max_i s_i throughout each step and advances together at the step boundary. This prevents a faster-cooling critic from silently drifting its relative gradient weight into the shared generator/prior or prematurely cooling the shared generator optimizer and prior regularizer while another critic is still unconverged. The synchronized scale and per-term raw/effective scales are published as critic/thermal_scale, critic/<term_id>/thermal_scale, and critic/<term_id>/raw_thermal_scale.
Critic penalties run inside critic_penalty_context(), which enables the math SDPA backend and a thread-local DualSafeSoftmaxMode (TorchFunctionMode) that computes exact analytic forward-mode AD JVPs for torch.softmax, F.softmax, F.log_softmax, F.softmin, F.scaled_dot_product_attention, and nn.MultiheadAttention whenever forward-AD dual tensors are present. This avoids PyTorch's inplace Exp version-counter failure during backward() through fwAD softmax ops (pytorch#162350) while preserving zero-autograd.grad single-pass forward-AD critic penalties.
For a MisGAN model, bind both generator networks to latent. Declare one as the primary generator and the other as an auxiliary network. The following losses assume batch.real contains the masked features concatenated with their mask, masked_pair builds that pair from the generator outputs, and gm generates the mask.
[[losses]]
type = "adversarial"
critic = "dx"
real = "batch.real"
fake = "masked_pair"
critic_weight = 1.0
generator_weight = 0.2
[[losses]]
type = "adversarial"
critic = "dm"
real = "batch.mask"
fake = "gm"
[[losses]]
type = "prior"Existing concrete configurations can still be loaded with their explicit
settings. Without a recipe snapshot, construction uses ParticleGAN's public
Recipe restoration defaults; HyperGAN no longer selects a named historical
formulation. Historical checkpoints require their recorded dependency and source
compatibility. The packaged gaussian-grid model is the concrete reference
fixture; fresh image projects use the released ParticleGAN preset.
The packaged cifar10-transgan model also inherits that complete preset. It
previously omitted defaults = "particlegan", so the Round 1 CIFAR runs
(amber-heron, marble-anchor, coral-crest) used KA2 despite installing
ParticleGAN 0.9.3/0.9.4. Their saved critic optimizer records explicitly contain
formulation = "ka2"; their results do not evaluate BISPF. See the
QA report. Fresh runs now inherit the dependency's
loss, optimizer, rates, penalty and prior regularization instead of the old
model-specific overrides. Architecture, reconstruction objective and prior
dimensions are still declared by the model. Use a new run directory to test
the corrected preset; installing a newer library does not migrate a saved run.
The learned CLS token uses a one-row position table on a zero token, preserving
its forward value and gradients while giving DualNorm a supported matrix
parameter instead of the cls_token operator's rank-three broadcast tensor.
ParticleGAN 0.9.5 adds Recipe.from_dict(saved_fields) and rejects partial
Recipe(...) construction. HyperGAN uses the restoration API when available
and retains the legacy restoration fallback for 0.9.4. Install the current
release from PyPI:
python -m pip install --upgrade 'particlegan>=0.12.0,<0.13'Fresh parameter initialization uses ParticleGAN's public initializer when
training.initialization = "deterministic_orthogonal". Loaded pretrained
subtrees retain their weights. Effective requires_grad determines optimizer
membership, and frozen networks remain differentiable with respect to inputs.
The bounded performance harness measures the released preset without selecting optimizer internals. Output directories must be new and bulk artifacts stay outside Git:
python scripts/benchmark_particlegan_cifar.py \
--config /path/to/cifar-model.toml \
--output /artifact-volume/cifar-particlegan --profile --resumeIt fixes seed 0, the public initializer, architecture, data, prior and batches; measures 20 complete updates with 5 warmups; profiles 3 updates; and verifies an exact 3-update checkpoint continuation. Frozen parameters and backbone buffers must remain unchanged. This is integration and performance evidence; image quality is measured separately.