# lightning { #aria_nbv.lightning }
`lightning`
Lightning orchestration for VIN candidate-scorer training.
This package provides the config-as-factory experiment, data-module, training
module, trainer, callback, and optimizer surfaces used by the runnable
one-step CORAL scorer. Its finite-horizon leaf modules additionally own QH
stage admission, masked Double-Q optimization, exact-``Q_2`` certification,
and immutable experiment/bundle publication. Actor-visible feature
construction belongs to :mod:`aria_nbv.vin`; oracle labels belong to
:mod:`aria_nbv.rri_metrics` and :mod:`aria_nbv.oracle`.
The package root intentionally retains the established eight-name one-step
interface. Import task-specific leaves from :mod:`.one_step`,
:mod:`.finite_horizon`, or :mod:`.training`.
<!-- quartodoc-package-readme: aria_nbv.lightning -->
## Package guide
`aria_nbv.lightning` owns training-stage admission, optimization, metric lifecycle,
checkpoint selection and experiment publication. Scorer architecture belongs to
`aria_nbv.vin`; actor/supervision DTOs belong to `aria_nbv.data_handling`; factual
replay and stored masks belong to `aria_nbv.rollouts`. Lightning composes those
interfaces and preserves their scientific contracts.
## Responsibility map
| Package | Conceptual owner and caller interface |
| --- | --- |
| [one_step](lightning.one_step.qmd) | One-step CORAL training and checkpoint recovery through `AriaNBVExperimentConfig` |
| [finite_horizon](lightning.finite_horizon.qmd) | QH admission, fitting, evaluation and immutable publication through `QhExperiment` |
| [finite_horizon/studies](lightning.finite_horizon.studies.qmd) | Frozen study protocols, schema-specific receipt admission and scientific reductions |
| [training](lightning.training.qmd) | Shared trainer, callback, optimizer and gradient-observation machinery |
Task packages expose composition interfaces and retain their data/objective
semantics. Shared training machinery handles framework construction and
observation. Study readers preserve historical scientific identities;
[reporting](reporting.qmd) presents admitted results. Configuration,
receipts, tests and logs provide cross-cutting evidence of those owners' behavior.
```{mermaid}
flowchart LR
D["data_handling DTOs"] --> O["one_step lifecycle"]
D --> Q["finite_horizon lifecycle"]
F["rollouts replay contracts"] --> Q
V["vin scorer interfaces"] --> O
V --> Q
T["training machinery"] --> O
T --> Q
Q --> E["Receipts and immutable artifacts"]
E --> S["studies admission and reductions"]
S --> R["reporting snapshots and figures"]
```
## Entry points and retained contracts
The package root retains the established eight one-step names. QH callers use
`aria_nbv.lightning.finite_horizon.*`; study callers import their owning module
under `finite_horizon.studies.*`. The package-owned CLI adapters dispatch through
their corresponding experiment lifecycle:
```sh
nbv-train --help
nbv-summary --help
nbv-qh --help
```
One-step supports online/offline VIN data, binner fitting, Lightning resume and
Optuna. QH distinguishes diagnostic fitting from deployment-bundle publication;
verified inference weights are different from resumed training state. The task
READMEs describe admission, support, ordering, failure and verification contracts.
The legacy `qh_datamodule`, `qh_experiment` and `qh_module` import paths are retired;
`qh_q2_certification` remains available. Public tensor/callable contracts are
documented with their source and tests.
<!-- /quartodoc-package-readme -->
## Classes
| Name | Description |
| --- | --- |
| [AdamWConfig](#aria_nbv.lightning.AdamWConfig) | Configure AdamW for a Lightning module's trainable parameters. |
| [AriaNBVExperimentConfig](#aria_nbv.lightning.AriaNBVExperimentConfig) | Own one reproducible VIN Lightning run and its nested factories. |
| [TrainerCallbacksConfig](#aria_nbv.lightning.TrainerCallbacksConfig) | Configure one mutually compatible Lightning callback collection. |
| [TrainerFactoryConfig](#aria_nbv.lightning.TrainerFactoryConfig) | Configure one external Lightning trainer and its attached services. |
| [VinDataModule](#aria_nbv.lightning.VinDataModule) | Own stage datasets and loaders for oracle-labelled VIN batches. |
| [VinDataModuleConfig](#aria_nbv.lightning.VinDataModuleConfig) | Configure stage datasets and candidate-table collation. |
| [VinLightningModule](#aria_nbv.lightning.VinLightningModule) | Own one-step CORAL training state for a VIN candidate scorer. |
| [VinLightningModuleConfig](#aria_nbv.lightning.VinLightningModuleConfig) | Configure one-step ordinal candidate scoring and optimization. |
### AdamWConfig { #aria_nbv.lightning.AdamWConfig }
```python
lightning.AdamWConfig()
```
Configure AdamW for a Lightning module's trainable parameters.
#### Attributes
| Name | Description |
| --- | --- |
| [target_type](#aria_nbv.lightning.AdamWConfig.target_type) | Factory target for `aria_nbv.configs.base.BaseConfig.setup_target`. |
| [learning_rate](#aria_nbv.lightning.AdamWConfig.learning_rate) | Learning rate for AdamW. |
| [weight_decay](#aria_nbv.lightning.AdamWConfig.weight_decay) | Weight decay for AdamW. |
| [foreach](#aria_nbv.lightning.AdamWConfig.foreach) | Explicit foreach policy; ``None`` preserves PyTorch's historical backend selection. |
| [fused](#aria_nbv.lightning.AdamWConfig.fused) | Explicit fused policy; ``None`` preserves PyTorch's historical backend selection. |
#### Methods
| Name | Description |
| --- | --- |
| [setup_target](#aria_nbv.lightning.AdamWConfig.setup_target) | Create AdamW over the exact trainable parameter list. |
##### setup_target { #aria_nbv.lightning.AdamWConfig.setup_target }
```python
lightning.AdamWConfig.setup_target(params)
```
Create AdamW over the exact trainable parameter list.
###### Parameters {.doc-section .doc-section-parameters}
| Name | Type | Description | Default |
|--------|--------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------|
| params | [list](`list`)\[[Tensor](`torch.Tensor`)\] | Materialized parameters selected by the consuming :meth:`aria_nbv.lightning.VinLightningModule.configure_optimizers` or :meth:`aria_nbv.lightning.finite_horizon.module.QhLightningModule.configure_optimizers`. | _required_ |
###### Returns {.doc-section .doc-section-returns}
| Name | Type | Description |
|--------|--------------------------------------|-------------------------------------------|
| | [Optimizer](`torch.optim.Optimizer`) | Optimizer owned and stepped by Lightning. |
### AriaNBVExperimentConfig { #aria_nbv.lightning.AriaNBVExperimentConfig }
```python
lightning.AriaNBVExperimentConfig()
```
Own one reproducible VIN Lightning run and its nested factories.
Calling :meth:`setup_target` constructs but does not execute the three
runtime owners. :meth:`setup_target_and_run` then delegates loop ownership
to Lightning. Run artifacts, checkpoint paths, and fitted binner state are
resolved through :class:`PathConfig` before construction.
#### Attributes
| Name | Description |
| --- | --- |
| [run_mode](#aria_nbv.lightning.AriaNBVExperimentConfig.run_mode) | Requested experiment action, normalized from kebab or snake case. |
| [run_name](#aria_nbv.lightning.AriaNBVExperimentConfig.run_name) | Human-readable identifier used by loggers, checkpoints, and snapshots. |
| [stage](#aria_nbv.lightning.AriaNBVExperimentConfig.stage) | Lightning stage constructed and executed by :meth:`setup_target_and_run`. |
| [summary_stage](#aria_nbv.lightning.AriaNBVExperimentConfig.summary_stage) | Dataset stage sampled by the non-training VIN summary action. |
| [summary_num_batches](#aria_nbv.lightning.AriaNBVExperimentConfig.summary_num_batches) | Positive number of real oracle-labelled batches included in a summary. |
| [summary_include_torchsummary](#aria_nbv.lightning.AriaNBVExperimentConfig.summary_include_torchsummary) | Append external torchsummary module traversal to scorer diagnostics. |
| [summary_torchsummary_depth](#aria_nbv.lightning.AriaNBVExperimentConfig.summary_torchsummary_depth) | Positive maximum module-tree depth for optional torchsummary output. |
| [plot_out_dir](#aria_nbv.lightning.AriaNBVExperimentConfig.plot_out_dir) | Path for non-training VIN encoding figures, resolved by the plot action. |
| [ckpt_path](#aria_nbv.lightning.AriaNBVExperimentConfig.ckpt_path) | Optional checkpoint for strict validation/test loading or training resume. |
| [seed](#aria_nbv.lightning.AriaNBVExperimentConfig.seed) | Torch CPU/CUDA seed set before dataset, scorer, and trainer construction. |
| [out_dir](#aria_nbv.lightning.AriaNBVExperimentConfig.out_dir) | Run-artifact root for config snapshots, logs, checkpoints, and binner state. |
| [fit_binner_only](#aria_nbv.lightning.AriaNBVExperimentConfig.fit_binner_only) | Compatibility flag that rewrites `run_mode` to ``"fit_binner"``. |
| [fit_binner_overwrite](#aria_nbv.lightning.AriaNBVExperimentConfig.fit_binner_overwrite) | Overwrite ``module_config.binner_path`` when ``run_mode="fit_binner"``. |
| [inspect_config](#aria_nbv.lightning.AriaNBVExperimentConfig.inspect_config) | Print rich datamodule and LightningModule config summaries before running. |
| [paths](#aria_nbv.lightning.AriaNBVExperimentConfig.paths) | Repository-aware resolver for configs, run roots, checkpoints, and artifacts. |
| [trainer_config](#aria_nbv.lightning.AriaNBVExperimentConfig.trainer_config) | Trainer factory including callback ownership, logger, devices, and loop limits. |
| [datamodule_config](#aria_nbv.lightning.AriaNBVExperimentConfig.datamodule_config) | VIN source, stage-reuse, worker, and candidate-collation configuration. |
| [module_config](#aria_nbv.lightning.AriaNBVExperimentConfig.module_config) | One-step scorer, CORAL loss, binner, optimizer, scheduler, and metric config. |
| [optuna_config](#aria_nbv.lightning.AriaNBVExperimentConfig.optuna_config) | Optional study and search-space config used only by the Optuna action. |
| [verbosity](#aria_nbv.lightning.AriaNBVExperimentConfig.verbosity) | Experiment-orchestration logging verbosity. |
| [verbose](#aria_nbv.lightning.AriaNBVExperimentConfig.verbose) | Legacy Optuna-facing verbosity value retained for config compatibility. |
| [resolved_out_dir](#aria_nbv.lightning.AriaNBVExperimentConfig.resolved_out_dir) | Return `out_dir` resolved under the configured repository run root. |
| [default_config_path](#aria_nbv.lightning.AriaNBVExperimentConfig.default_config_path) | Default path for saving the experiment TOML. |
#### Methods
| Name | Description |
| --- | --- |
| [save_config](#aria_nbv.lightning.AriaNBVExperimentConfig.save_config) | Save this config (and nested configs) as TOML. |
| [setup_target](#aria_nbv.lightning.AriaNBVExperimentConfig.setup_target) | Construct the trainer, scorer module, and stage-aware datamodule. |
| [setup_target_and_run](#aria_nbv.lightning.AriaNBVExperimentConfig.setup_target_and_run) | Construct runtime owners and delegate one stage loop to Lightning. |
| [run_optuna_study](#aria_nbv.lightning.AriaNBVExperimentConfig.run_optuna_study) | Run an Optuna hyperparameter sweep for this experiment config. |
| [summarize_vin](#aria_nbv.lightning.AriaNBVExperimentConfig.summarize_vin) | Run VIN summary on a real oracle batch from the datamodule. |
| [fit_binner_and_save](#aria_nbv.lightning.AriaNBVExperimentConfig.fit_binner_and_save) | Fit `RriOrdinalBinner` from oracle batches and persist it. |
| [run](#aria_nbv.lightning.AriaNBVExperimentConfig.run) | Execute the configured action. |
##### save_config { #aria_nbv.lightning.AriaNBVExperimentConfig.save_config }
```python
lightning.AriaNBVExperimentConfig.save_config(
path=None,
*,
include_comments=True,
include_type_hints=True,
)
```
Save this config (and nested configs) as TOML.
###### Parameters {.doc-section .doc-section-parameters}
| Name | Type | Description | Default |
|--------------------|------------------------------------------------|-------------------------------------------------------------|-----------|
| path | [Path](`pathlib.Path`) \| [str](`str`) \| None | Destination TOML path. If None, uses `default_config_path`. | `None` |
| include_comments | [bool](`bool`) | Include docstring comments in the TOML. | `True` |
| include_type_hints | [bool](`bool`) | Include type hints in the TOML comments. | `True` |
###### Returns {.doc-section .doc-section-returns}
| Name | Type | Description |
|--------|------------------------|---------------------------------|
| | [Path](`pathlib.Path`) | Resolved path that was written. |
##### setup_target { #aria_nbv.lightning.AriaNBVExperimentConfig.setup_target }
```python
lightning.AriaNBVExperimentConfig.setup_target(setup_stage=None, *, trial=None)
```
Construct the trainer, scorer module, and stage-aware datamodule.
###### Parameters {.doc-section .doc-section-parameters}
| Name | Type | Description | Default |
|-------------|---------------------------------------------------------|------------------------------------------------------------|-----------|
| setup_stage | [Stage](`aria_nbv.utils.Stage`) \| [str](`str`) \| None | Dataset stage to initialize; defaults to `stage`. | `None` |
| trial | \'optuna.Trial \| None\' | Optional Optuna trial forwarded to trainer callback setup. | `None` |
###### Returns {.doc-section .doc-section-returns}
| Name | Type | Description |
|--------|-------------------------------------------------------------------------------|-------------------------------------------------------------------|
| | [pl](`pytorch_lightning`).[Trainer](`pytorch_lightning.Trainer`) | Tuple of external Lightning trainer, :class:`VinLightningModule`, |
| and | [VinLightningModule](`aria_nbv.lightning.one_step.module.VinLightningModule`) | class:`VinDataModule`. No fit/validation/test loop has run. |
###### Notes {.doc-section .doc-section-notes}
Torch seeds and artifact directories are established before any
runtime owner is constructed. Checkpoint weights remain Lightning's
responsibility when the returned trainer starts its loop.
##### setup_target_and_run { #aria_nbv.lightning.AriaNBVExperimentConfig.setup_target_and_run }
```python
lightning.AriaNBVExperimentConfig.setup_target_and_run(stage=None)
```
Construct runtime owners and delegate one stage loop to Lightning.
Training verifies the fitted binner class count before `fit`; validation
and test pass the resolved checkpoint directly to Lightning. A globally
ranked interrupted trainer writes one explicit recovery checkpoint.
###### Returns {.doc-section .doc-section-returns}
| Name | Type | Description |
|--------|------------------------------------------------------------------|--------------------------------------------|
| | [pl](`pytorch_lightning`).[Trainer](`pytorch_lightning.Trainer`) | Trainer after the requested loop finishes. |
##### run_optuna_study { #aria_nbv.lightning.AriaNBVExperimentConfig.run_optuna_study }
```python
lightning.AriaNBVExperimentConfig.run_optuna_study()
```
Run an Optuna hyperparameter sweep for this experiment config.
##### summarize_vin { #aria_nbv.lightning.AriaNBVExperimentConfig.summarize_vin }
```python
lightning.AriaNBVExperimentConfig.summarize_vin()
```
Run VIN summary on a real oracle batch from the datamodule.
##### fit_binner_and_save { #aria_nbv.lightning.AriaNBVExperimentConfig.fit_binner_and_save }
```python
lightning.AriaNBVExperimentConfig.fit_binner_and_save(
datamodule=None,
*,
overwrite=False,
)
```
Fit `RriOrdinalBinner` from oracle batches and persist it.
###### Parameters {.doc-section .doc-section-parameters}
| Name | Type | Description | Default |
|------------|---------------------------------------------------------------------------------|----------------------------------------------------------|-----------|
| datamodule | [VinDataModule](`aria_nbv.lightning.one_step.datamodule.VinDataModule`) \| None | Optional pre-built datamodule (avoids re-instantiation). | `None` |
| overwrite | [bool](`bool`) | Overwrite existing binner JSON when True. | `False` |
###### Returns {.doc-section .doc-section-returns}
| Name | Type | Description |
|--------|------------------------|--------------------------------------|
| | [Path](`pathlib.Path`) | Path to the saved `rri_binner.json`. |
##### run { #aria_nbv.lightning.AriaNBVExperimentConfig.run }
```python
lightning.AriaNBVExperimentConfig.run()
```
Execute the configured action.
This method is intended to be called from CLI entry points.
### TrainerCallbacksConfig { #aria_nbv.lightning.TrainerCallbacksConfig }
```python
lightning.TrainerCallbacksConfig()
```
Configure one mutually compatible Lightning callback collection.
:meth:`setup_target` may adapt checkpoint, early-stopping, and pruning
flags for an Optuna trial. The returned callback objects are then owned and
invoked by the external Lightning trainer.
#### Attributes
| Name | Description |
| --- | --- |
| [target_type](#aria_nbv.lightning.TrainerCallbacksConfig.target_type) | Factory target for `aria_nbv.configs.base.BaseConfig.setup_target`. |
| [use_model_checkpoint](#aria_nbv.lightning.TrainerCallbacksConfig.use_model_checkpoint) | Attach a model-checkpoint callback using the fields below. |
| [checkpoint_monitor](#aria_nbv.lightning.TrainerCallbacksConfig.checkpoint_monitor) | Logged metric key used to rank checkpoints. |
| [checkpoint_mode](#aria_nbv.lightning.TrainerCallbacksConfig.checkpoint_mode) | Checkpoint ranking direction, conventionally ``"min"`` or ``"max"``. |
| [checkpoint_dir](#aria_nbv.lightning.TrainerCallbacksConfig.checkpoint_dir) | Checkpoint directory; ``None`` resolves through :class:`PathConfig`. |
| [checkpoint_filename](#aria_nbv.lightning.TrainerCallbacksConfig.checkpoint_filename) | Lightning format template evaluated from epoch, step, and logged metrics. |
| [checkpoint_save_top_k](#aria_nbv.lightning.TrainerCallbacksConfig.checkpoint_save_top_k) | Number of monitor-ranked checkpoints retained by Lightning. |
| [checkpoint_auto_insert_metric_name](#aria_nbv.lightning.TrainerCallbacksConfig.checkpoint_auto_insert_metric_name) | Let Lightning inject monitor names into the checkpoint filename. |
| [checkpoint_save_last](#aria_nbv.lightning.TrainerCallbacksConfig.checkpoint_save_last) | Lightning tri-state policy for maintaining a ``last.ckpt`` alias/copy. |
| [checkpoint_every_n_train_steps](#aria_nbv.lightning.TrainerCallbacksConfig.checkpoint_every_n_train_steps) | Optional positive optimizer-step checkpoint cadence. |
| [checkpoint_train_time_interval](#aria_nbv.lightning.TrainerCallbacksConfig.checkpoint_train_time_interval) | Optional positive wall-clock cadence accepted by `datetime.timedelta`. |
| [checkpoint_every_n_epochs](#aria_nbv.lightning.TrainerCallbacksConfig.checkpoint_every_n_epochs) | Optional positive epoch checkpoint cadence. |
| [checkpoint_save_on_train_epoch_end](#aria_nbv.lightning.TrainerCallbacksConfig.checkpoint_save_on_train_epoch_end) | Optional override for Lightning's train-epoch-end checkpoint timing. |
| [use_early_stopping](#aria_nbv.lightning.TrainerCallbacksConfig.use_early_stopping) | Attach an early-stopping callback for the configured monitor. |
| [early_stopping_monitor](#aria_nbv.lightning.TrainerCallbacksConfig.early_stopping_monitor) | Logged metric key observed by early stopping. |
| [early_stopping_mode](#aria_nbv.lightning.TrainerCallbacksConfig.early_stopping_mode) | Early-stopping improvement direction, ``"min"`` or ``"max"``. |
| [early_stopping_patience](#aria_nbv.lightning.TrainerCallbacksConfig.early_stopping_patience) | Validation checks without improvement allowed before stopping. |
| [optimizer_diagnostics](#aria_nbv.lightning.TrainerCallbacksConfig.optimizer_diagnostics) | Opt-in bounded gradient and optimizer scalars at the unscaled pre-step hook. |
| [use_lr_monitor](#aria_nbv.lightning.TrainerCallbacksConfig.use_lr_monitor) | Attach learning-rate logging when the trainer has a logger. |
| [lr_logging_interval](#aria_nbv.lightning.TrainerCallbacksConfig.lr_logging_interval) | Learning-rate logging cadence passed to Lightning. |
| [use_optuna_pruning](#aria_nbv.lightning.TrainerCallbacksConfig.use_optuna_pruning) | Enable Optuna pruning callback for hyperparameter optimisation runs. |
| [use_rich_progress_bar](#aria_nbv.lightning.TrainerCallbacksConfig.use_rich_progress_bar) | Enable the Rich progress bar; mutually exclusive with TQDM. |
| [use_tqdm_progress_bar](#aria_nbv.lightning.TrainerCallbacksConfig.use_tqdm_progress_bar) | Enable the TQDM progress bar; mutually exclusive with Rich. |
| [tqdm_refresh_rate](#aria_nbv.lightning.TrainerCallbacksConfig.tqdm_refresh_rate) | TQDM refresh cadence in training batches. |
| [use_rich_model_summary](#aria_nbv.lightning.TrainerCallbacksConfig.use_rich_model_summary) | Attach a Rich model-tree summary callback. |
| [rich_summary_max_depth](#aria_nbv.lightning.TrainerCallbacksConfig.rich_summary_max_depth) | Maximum module-tree depth rendered by the Rich summary. |
| [use_backbone_finetuning](#aria_nbv.lightning.TrainerCallbacksConfig.use_backbone_finetuning) | Attach Lightning's staged backbone-unfreezing callback. |
| [backbone_unfreeze_at_epoch](#aria_nbv.lightning.TrainerCallbacksConfig.backbone_unfreeze_at_epoch) | Zero-based epoch at which the callback unfreezes the backbone. |
| [backbone_lambda_func](#aria_nbv.lightning.TrainerCallbacksConfig.backbone_lambda_func) | Optional serialized learning-rate lambda consumed by backbone finetuning. |
| [backbone_train_bn](#aria_nbv.lightning.TrainerCallbacksConfig.backbone_train_bn) | Keep backbone batch-normalization layers trainable after unfreezing. |
| [use_timer](#aria_nbv.lightning.TrainerCallbacksConfig.use_timer) | Attach a Lightning wall-clock timer callback. |
| [timer_duration](#aria_nbv.lightning.TrainerCallbacksConfig.timer_duration) | Optional duration mapping accepted by `datetime.timedelta`. |
| [timer_interval](#aria_nbv.lightning.TrainerCallbacksConfig.timer_interval) | Timer check cadence passed to Lightning. |
#### Methods
| Name | Description |
| --- | --- |
| [setup_target](#aria_nbv.lightning.TrainerCallbacksConfig.setup_target) | Build callbacks and adapt trial-specific ownership flags. |
##### setup_target { #aria_nbv.lightning.TrainerCallbacksConfig.setup_target }
```python
lightning.TrainerCallbacksConfig.setup_target(
model_name=None,
*,
has_logger=True,
trial=None,
optuna_config=None,
)
```
Build callbacks and adapt trial-specific ownership flags.
###### Parameters {.doc-section .doc-section-parameters}
| Name | Type | Description | Default |
|---------------|--------------------------|-----------------------------------------------------------------------|-----------|
| model_name | [str](`str`) \| None | Optional prefix added to checkpoint filenames. | `None` |
| has_logger | [bool](`bool`) | Whether a trainer logger exists; LR monitoring is omitted when false. | `True` |
| trial | \'Trial \| None\' | Optional Optuna trial that owns pruning decisions. | `None` |
| optuna_config | \'OptunaConfig \| None\' | Required pruning config when `trial` enables the pruning callback. | `None` |
###### Returns {.doc-section .doc-section-returns}
| Name | Type | Description |
|--------|----------------------------------------------------------------------|--------------------------------------------------------------|
| | [list](`list`)\[[Callback](`pytorch_lightning.callbacks.Callback`)\] | Fresh callback list owned by one external Lightning trainer. |
###### Notes {.doc-section .doc-section-notes}
Trial runs disable checkpointing and early stopping to avoid
competing persistence/termination owners. Outside a trial, stale
pruning flags are disabled explicitly.
### TrainerFactoryConfig { #aria_nbv.lightning.TrainerFactoryConfig }
```python
lightning.TrainerFactoryConfig()
```
Configure one external Lightning trainer and its attached services.
#### Attributes
| Name | Description |
| --- | --- |
| [target_type](#aria_nbv.lightning.TrainerFactoryConfig.target_type) | Return the external Lightning trainer factory target. |
| [is_debug](#aria_nbv.lightning.TrainerFactoryConfig.is_debug) | Force CPU fast-dev execution, anomaly detection, and no checkpoint callback. |
| [fast_dev_run](#aria_nbv.lightning.TrainerFactoryConfig.fast_dev_run) | Ask Lightning to run one batch per loop as an integration smoke test. |
| [accelerator](#aria_nbv.lightning.TrainerFactoryConfig.accelerator) | Lightning accelerator selector such as ``"auto"``, ``"cpu"``, or ``"gpu"``. |
| [devices](#aria_nbv.lightning.TrainerFactoryConfig.devices) | Device count, selector, or explicit device-index sequence passed to Lightning. |
| [strategy](#aria_nbv.lightning.TrainerFactoryConfig.strategy) | Optional distributed-execution strategy; ``"auto"`` delegates selection. |
| [max_epochs](#aria_nbv.lightning.TrainerFactoryConfig.max_epochs) | Maximum training epochs; ``None`` delegates the unbounded policy to Lightning. |
| [max_steps](#aria_nbv.lightning.TrainerFactoryConfig.max_steps) | Exact optimizer-step ceiling; ``-1`` leaves the existing epoch-only policy. |
| [precision](#aria_nbv.lightning.TrainerFactoryConfig.precision) | Lightning numeric-precision policy, including mixed-precision strings. |
| [default_root_dir](#aria_nbv.lightning.TrainerFactoryConfig.default_root_dir) | Root directory used by Lightning for logger-free run artifacts. |
| [tf32_matmul_precision](#aria_nbv.lightning.TrainerFactoryConfig.tf32_matmul_precision) | Optional process-wide float32 matmul precision set before trainer construction. |
| [gradient_clip_val](#aria_nbv.lightning.TrainerFactoryConfig.gradient_clip_val) | Optional gradient clipping threshold applied by Lightning. |
| [accumulate_grad_batches](#aria_nbv.lightning.TrainerFactoryConfig.accumulate_grad_batches) | Positive number of batches accumulated per optimizer step. |
| [log_every_n_steps](#aria_nbv.lightning.TrainerFactoryConfig.log_every_n_steps) | Trainer logging cadence in optimizer/training steps. |
| [deterministic](#aria_nbv.lightning.TrainerFactoryConfig.deterministic) | Lightning deterministic-algorithm policy; ``None`` preserves framework defaults. |
| [limit_train_batches](#aria_nbv.lightning.TrainerFactoryConfig.limit_train_batches) | Optional absolute count or fraction limiting each training epoch. |
| [limit_val_batches](#aria_nbv.lightning.TrainerFactoryConfig.limit_val_batches) | Optional absolute count or fraction limiting each validation epoch. |
| [check_val_every_n_epoch](#aria_nbv.lightning.TrainerFactoryConfig.check_val_every_n_epoch) | Epoch cadence for validation when validation is enabled. |
| [num_sanity_val_steps](#aria_nbv.lightning.TrainerFactoryConfig.num_sanity_val_steps) | Validation batches run before training; ``-1`` checks the entire loader. |
| [use_distributed_sampler](#aria_nbv.lightning.TrainerFactoryConfig.use_distributed_sampler) | Allow Lightning to replace data-loader samplers during distributed execution. |
| [enable_validation](#aria_nbv.lightning.TrainerFactoryConfig.enable_validation) | Enable validation; false zeroes validation limits/cadence during validation. |
| [enable_model_summary](#aria_nbv.lightning.TrainerFactoryConfig.enable_model_summary) | Enable Lightning's default model summary callback. |
| [callbacks](#aria_nbv.lightning.TrainerFactoryConfig.callbacks) | Callback collection factory attached to the constructed trainer. |
| [use_wandb](#aria_nbv.lightning.TrainerFactoryConfig.use_wandb) | Use the configured W&B logger outside debug mode. |
| [wandb_config](#aria_nbv.lightning.TrainerFactoryConfig.wandb_config) | W&B logger config instantiated only when `use_wandb` is true. |
#### Methods
| Name | Description |
| --- | --- |
| [setup_target](#aria_nbv.lightning.TrainerFactoryConfig.setup_target) | Instantiate a Trainer after logger and callback ownership is resolved. |
##### setup_target { #aria_nbv.lightning.TrainerFactoryConfig.setup_target }
```python
lightning.TrainerFactoryConfig.setup_target(
experiment=None,
*,
trial=None,
optuna_config=None,
)
```
Instantiate a Trainer after logger and callback ownership is resolved.
###### Parameters {.doc-section .doc-section-parameters}
| Name | Type | Description | Default |
|---------------|-----------------------------|-------------------------------------------------------------------------|-----------|
| experiment | [Any](`typing.Any`) \| None | Optional experiment providing an `optuna_config` fallback. | `None` |
| trial | \'Trial \| None\' | Optional Optuna trial forwarded to callback construction. | `None` |
| optuna_config | \'OptunaConfig \| None\' | Explicit pruning configuration, preferred over the experiment fallback. | `None` |
###### Returns {.doc-section .doc-section-returns}
| Name | Type | Description |
|--------|------------------------------------------------------------------|-------------------------------------------------------------------|
| | [pl](`pytorch_lightning`).[Trainer](`pytorch_lightning.Trainer`) | External Lightning trainer owning the fresh logger and callbacks. |
###### Notes {.doc-section .doc-section-notes}
TF32 precision is process-wide. Debug mode uses Lightning's default
logger; normal mode uses W&B only when configured. Checkpointing is
enabled precisely when callback construction produced a checkpoint
callback.
### VinDataModule { #aria_nbv.lightning.VinDataModule }
```python
lightning.VinDataModule(config)
```
Own stage datasets and loaders for oracle-labelled VIN batches.
Lightning may call :meth:`setup` more than once. Dataset instances are
therefore initialized lazily and retained by stage. Scorer-device transfer
remains the module's responsibility; this class yields CPU/source-device
:class:`VinOracleBatch` objects whose candidate width is compact for a
single sample or right-padded after offline collation.
#### Attributes {.doc-section .doc-section-attributes}
| Name | Type | Description |
|--------|--------|----------------------------------------------------------------------------|
| config | | Immutable construction policy for sources, batching, and worker lifecycle. |
#### Methods
| Name | Description |
| --- | --- |
| [setup](#aria_nbv.lightning.VinDataModule.setup) | Initialize and retain the datasets required by one Lightning stage. |
| [train_dataloader](#aria_nbv.lightning.VinDataModule.train_dataloader) | Build the training loader with optional row and candidate shuffling. |
| [val_dataloader](#aria_nbv.lightning.VinDataModule.val_dataloader) | Build the deterministic validation loader for the retained source. |
| [test_dataloader](#aria_nbv.lightning.VinDataModule.test_dataloader) | Reuse the validation-loader contract for Lightning test evaluation. |
| [iter_oracle_batches](#aria_nbv.lightning.VinDataModule.iter_oracle_batches) | Return a direct iterator over one stage's oracle-labelled samples. |
##### setup { #aria_nbv.lightning.VinDataModule.setup }
```python
lightning.VinDataModule.setup(stage=None)
```
Initialize and retain the datasets required by one Lightning stage.
###### Parameters {.doc-section .doc-section-parameters}
| Name | Type | Description | Default |
|--------|---------------------------------------------------------|------------------------------------------------------------------------------------------------------------|-----------|
| stage | [Stage](`aria_nbv.utils.Stage`) \| [str](`str`) \| None | ``train``, ``val``, ``test``, or ``None``. ``None`` prepares both training and validation ownership paths. | `None` |
###### Notes {.doc-section .doc-section-notes}
Repeated calls are idempotent for already-created sources.
Validation and test share `_val_source`; when `use_train_as_val` is
enabled they deliberately share `_train_source` as well.
##### train_dataloader { #aria_nbv.lightning.VinDataModule.train_dataloader }
```python
lightning.VinDataModule.train_dataloader()
```
Build the training loader with optional row and candidate shuffling.
###### Returns {.doc-section .doc-section-returns}
| Name | Type | Description |
|--------|---------------------------------------------|-------------------------------------------------------------------|
| | [DataLoader](`torch.utils.data.DataLoader`) | DataLoader yielding :class:`VinOracleBatch`. Map-style batching |
| | [DataLoader](`torch.utils.data.DataLoader`) | produces poses ``PoseTW["B N_q 12"]``, RRI labels |
| | [DataLoader](`torch.utils.data.DataLoader`) | ``Tensor["B N_q", float32]``, and a hard prefix mask derived from |
| | [DataLoader](`torch.utils.data.DataLoader`) | `candidate_count`; iterable/online sources remain unbatched. |
##### val_dataloader { #aria_nbv.lightning.VinDataModule.val_dataloader }
```python
lightning.VinDataModule.val_dataloader()
```
Build the deterministic validation loader for the retained source.
###### Returns {.doc-section .doc-section-returns}
| Name | Type | Description |
|--------|---------------------------------------------|----------------------------------------------------------------------|
| | [DataLoader](`torch.utils.data.DataLoader`) | DataLoader yielding unshuffled :class:`VinOracleBatch` objects with |
| | [DataLoader](`torch.utils.data.DataLoader`) | the same compact/right-padded shape contract as the training loader. |
##### test_dataloader { #aria_nbv.lightning.VinDataModule.test_dataloader }
```python
lightning.VinDataModule.test_dataloader()
```
Reuse the validation-loader contract for Lightning test evaluation.
##### iter_oracle_batches { #aria_nbv.lightning.VinDataModule.iter_oracle_batches }
```python
lightning.VinDataModule.iter_oracle_batches(stage)
```
Return a direct iterator over one stage's oracle-labelled samples.
This bypasses worker processes and `VinOracleBatch.collate`, so yielded
candidate payloads retain their per-sample ``N_q`` width.
### VinDataModuleConfig { #aria_nbv.lightning.VinDataModuleConfig }
```python
lightning.VinDataModuleConfig()
```
Configure stage datasets and candidate-table collation.
Online sources yield one oracle-labelled snippet at a time and therefore
require ``num_workers=0``. Map-style offline sources may collate a batch of
size ``B``; candidate rows are right-padded to ``N_q`` and accompanied by
per-sample `candidate_count` values used to construct the hard prefix mask.
#### Attributes
| Name | Description |
| --- | --- |
| [target_type](#aria_nbv.lightning.VinDataModuleConfig.target_type) | Return the :class:`VinDataModule` factory target. |
| [paths](#aria_nbv.lightning.VinDataModuleConfig.paths) | Project path resolver used by nested dataset/store configurations. |
| [source](#aria_nbv.lightning.VinDataModuleConfig.source) | Config-as-factory source for online labels or an immutable offline store. |
| [shuffle](#aria_nbv.lightning.VinDataModuleConfig.shuffle) | Shuffle map-style training samples each epoch; ignored for iterable sources. |
| [shuffle_candidates](#aria_nbv.lightning.VinDataModuleConfig.shuffle_candidates) | Permute compact valid candidate rows and aligned labels per training sample. |
| [num_workers](#aria_nbv.lightning.VinDataModuleConfig.num_workers) | DataLoader worker count; must be zero for the non-multiprocess-safe online labeler. |
| [batch_size](#aria_nbv.lightning.VinDataModuleConfig.batch_size) | Optional offline batch size ``B`` using :meth:`VinOracleBatch.collate`. |
| [persistent_workers](#aria_nbv.lightning.VinDataModuleConfig.persistent_workers) | Keep worker processes between epochs; forced off when `num_workers` is zero. |
| [verbosity](#aria_nbv.lightning.VinDataModuleConfig.verbosity) | Dataset and oracle-labeler diagnostic verbosity. |
| [is_debug](#aria_nbv.lightning.VinDataModuleConfig.is_debug) | Serialized compatibility flag; worker and trainer debug policy is configured elsewhere. |
| [use_train_as_val](#aria_nbv.lightning.VinDataModuleConfig.use_train_as_val) | Reuse the exact train dataset instance for validation and testing. |
### VinLightningModule { #aria_nbv.lightning.VinLightningModule }
```python
lightning.VinLightningModule(config)
```
Own one-step CORAL training state for a VIN candidate scorer.
The module registers the scorer under `vin` to preserve historical
checkpoint keys, loads or restores the fitted :class:`RriOrdinalBinner`,
and accumulates stage metrics. For ordinal class label $y \in [0,K-1]$,
CORAL predicts threshold levels $l_k = 1[y > k]$ for ``K-1`` logits per
candidate. Only the flattened ``M`` rows satisfying the batch hard mask,
finite oracle label, and finite-logit checks contribute to loss.
`VinPrediction.candidate_valid` is intentionally diagnostic. The hard
action/training mask is derived from :attr:`VinOracleBatch.candidate_count`;
invalid rollout full-shell rows never enter this compact one-step batch.
#### Attributes {.doc-section .doc-section-attributes}
| Name | Type | Description |
|--------|--------|--------------------------------------------------------------------------|
| config | | Composed scorer, loss, optimizer, scheduler, binner, and logging policy. |
| vin | | Registered scorer module that owns the ``vin.*`` checkpoint namespace. |
#### Methods
| Name | Description |
| --- | --- |
| [setup](#aria_nbv.lightning.VinLightningModule.setup) | Initialize binner-derived scorer state for a Lightning stage. |
| [on_save_checkpoint](#aria_nbv.lightning.VinLightningModule.on_save_checkpoint) | Persist fitted ordinal-binner state inside a Lightning checkpoint. |
| [on_load_checkpoint](#aria_nbv.lightning.VinLightningModule.on_load_checkpoint) | Restore embedded ordinal-binner state before stage setup runs. |
| [load_for_inference](#aria_nbv.lightning.VinLightningModule.load_for_inference) | Load a checkpoint and return an evaluation-ready scorer module. |
| [prepare_for_inference](#aria_nbv.lightning.VinLightningModule.prepare_for_inference) | Initialize mandatory binner-derived state before direct inference. |
| [training_step](#aria_nbv.lightning.VinLightningModule.training_step) | Compute one masked CORAL update for an oracle-labelled training batch. |
| [validation_step](#aria_nbv.lightning.VinLightningModule.validation_step) | Evaluate masked ordinal loss and candidate-table metrics without updates. |
| [test_step](#aria_nbv.lightning.VinLightningModule.test_step) | Evaluate the test split using the validation loss/mask contract. |
| [on_train_epoch_end](#aria_nbv.lightning.VinLightningModule.on_train_epoch_end) | Emit and reset accumulated training metrics at the epoch boundary. |
| [on_validation_epoch_end](#aria_nbv.lightning.VinLightningModule.on_validation_epoch_end) | Emit/reset validation metrics and expected-RRI error statistics. |
| [on_test_epoch_end](#aria_nbv.lightning.VinLightningModule.on_test_epoch_end) | Emit and reset accumulated test metrics at the epoch boundary. |
| [on_after_backward](#aria_nbv.lightning.VinLightningModule.on_after_backward) | Log configured scorer gradient norms after Lightning backpropagation. |
| [configure_optimizers](#aria_nbv.lightning.VinLightningModule.configure_optimizers) | Construct optimizer and optional scheduler from trainable scorer state. |
| [summarize_vin](#aria_nbv.lightning.VinLightningModule.summarize_vin) | Summarize VIN inputs/outputs for a single oracle-labeled batch. |
| [plot_vin_encodings_batch](#aria_nbv.lightning.VinLightningModule.plot_vin_encodings_batch) | Generate VIN encoding plots for a single oracle-labeled batch. |
##### setup { #aria_nbv.lightning.VinLightningModule.setup }
```python
lightning.VinLightningModule.setup(stage)
```
Initialize binner-derived scorer state for a Lightning stage.
Lightning owns invocation timing. This hook integrates logging, loads
the configured binner when a checkpoint did not restore one,
initializes ordinal class representatives and optional prior biases,
then records the effective scorer config once per module instance.
##### on_save_checkpoint { #aria_nbv.lightning.VinLightningModule.on_save_checkpoint }
```python
lightning.VinLightningModule.on_save_checkpoint(checkpoint)
```
Persist fitted ordinal-binner state inside a Lightning checkpoint.
##### on_load_checkpoint { #aria_nbv.lightning.VinLightningModule.on_load_checkpoint }
```python
lightning.VinLightningModule.on_load_checkpoint(checkpoint)
```
Restore embedded ordinal-binner state before stage setup runs.
##### load_for_inference { #aria_nbv.lightning.VinLightningModule.load_for_inference }
```python
lightning.VinLightningModule.load_for_inference(
checkpoint_path,
*,
device='cpu',
fallback_binner_path=None,
)
```
Load a checkpoint and return an evaluation-ready scorer module.
###### Parameters {.doc-section .doc-section-parameters}
| Name | Type | Description | Default |
|----------------------|-----------------------------------------------------------|---------------------------------------------------------------------------------------------------|------------|
| checkpoint_path | [Path](`pathlib.Path`) \| [str](`str`) | Lightning checkpoint containing config and strict ``vin.*`` state-dict entries. | _required_ |
| device | [torch](`torch`).[device](`torch.device`) \| [str](`str`) | Destination device for the restored module. | `'cpu'` |
| fallback_binner_path | [Path](`pathlib.Path`) \| [str](`str`) \| None | Binner JSON used only when the checkpoint and restored config do not provide fitted binner state. | `None` |
###### Returns {.doc-section .doc-section-returns}
| Name | Type | Description |
|--------|------------------------|--------------------------------------------------------------|
| | \'VinLightningModule\' | Evaluation-mode :class:`VinLightningModule` with ordinal |
| | \'VinLightningModule\' | representatives initialized and gradients still owned by the |
| | \'VinLightningModule\' | caller's surrounding context. |
##### prepare_for_inference { #aria_nbv.lightning.VinLightningModule.prepare_for_inference }
```python
lightning.VinLightningModule.prepare_for_inference(fallback_binner_path=None)
```
Initialize mandatory binner-derived state before direct inference.
This is the non-Trainer lifecycle path used by diagnostics and
checkpoint loading. It never fits a binner; missing persisted state is
an error because ordinal probabilities cannot be mapped to stable RRI
representatives otherwise.
##### training_step { #aria_nbv.lightning.VinLightningModule.training_step }
```python
lightning.VinLightningModule.training_step(batch, batch_idx)
```
Compute one masked CORAL update for an oracle-labelled training batch.
Returns ``None`` when no row has a hard-valid candidate, finite oracle
RRI label, and finite ``K-1`` logits; Lightning then skips the update.
##### validation_step { #aria_nbv.lightning.VinLightningModule.validation_step }
```python
lightning.VinLightningModule.validation_step(batch, batch_idx)
```
Evaluate masked ordinal loss and candidate-table metrics without updates.
##### test_step { #aria_nbv.lightning.VinLightningModule.test_step }
```python
lightning.VinLightningModule.test_step(batch, batch_idx)
```
Evaluate the test split using the validation loss/mask contract.
##### on_train_epoch_end { #aria_nbv.lightning.VinLightningModule.on_train_epoch_end }
```python
lightning.VinLightningModule.on_train_epoch_end()
```
Emit and reset accumulated training metrics at the epoch boundary.
##### on_validation_epoch_end { #aria_nbv.lightning.VinLightningModule.on_validation_epoch_end }
```python
lightning.VinLightningModule.on_validation_epoch_end()
```
Emit/reset validation metrics and expected-RRI error statistics.
##### on_test_epoch_end { #aria_nbv.lightning.VinLightningModule.on_test_epoch_end }
```python
lightning.VinLightningModule.on_test_epoch_end()
```
Emit and reset accumulated test metrics at the epoch boundary.
##### on_after_backward { #aria_nbv.lightning.VinLightningModule.on_after_backward }
```python
lightning.VinLightningModule.on_after_backward()
```
Log configured scorer gradient norms after Lightning backpropagation.
Logging is disabled during sanity validation, evaluation mode, or when
:class:`GradNormLoggingConfig` is disabled. This hook observes gradients
only and does not clip or mutate them.
##### configure_optimizers { #aria_nbv.lightning.VinLightningModule.configure_optimizers }
```python
lightning.VinLightningModule.configure_optimizers()
```
Construct optimizer and optional scheduler from trainable scorer state.
###### Returns {.doc-section .doc-section-returns}
| Name | Type | Description |
|--------|-----------------------------------------------------|---------------------------------------------------------------------|
| | [dict](`dict`)\[[str](`str`), [Any](`typing.Any`)\] | Lightning optimizer mapping. One-cycle scheduling resolves its step |
| | [dict](`dict`)\[[str](`str`), [Any](`typing.Any`)\] | budget from the attached Trainer; plateau scheduling includes its |
| | [dict](`dict`)\[[str](`str`), [Any](`typing.Any`)\] | configured monitor, interval, and frequency. |
###### Raises {.doc-section .doc-section-raises}
| Name | Type | Description |
|--------|--------------------------------|------------------------------------------------|
| | [RuntimeError](`RuntimeError`) | If the scorer exposes no trainable parameters. |
##### summarize_vin { #aria_nbv.lightning.VinLightningModule.summarize_vin }
```python
lightning.VinLightningModule.summarize_vin(
batch,
*,
include_torchsummary=True,
torchsummary_depth=3,
)
```
Summarize VIN inputs/outputs for a single oracle-labeled batch.
###### Parameters {.doc-section .doc-section-parameters}
| Name | Type | Description | Default |
|----------------------|-----------------------------------------------------------|--------------------------------------------------|------------|
| batch | [VinOracleBatch](`aria_nbv.data_handling.VinOracleBatch`) | Oracle-labeled VIN batch from `VinDataModule`. | _required_ |
| include_torchsummary | [bool](`bool`) | Whether to append torchsummary module summaries. | `True` |
| torchsummary_depth | [int](`int`) | Max depth for torchsummary module traversal. | `3` |
###### Returns {.doc-section .doc-section-returns}
| Name | Type | Description |
|--------|--------------|------------------------------------------------|
| | [str](`str`) | Multiline string with VIN summary information. |
##### plot_vin_encodings_batch { #aria_nbv.lightning.VinLightningModule.plot_vin_encodings_batch }
```python
lightning.VinLightningModule.plot_vin_encodings_batch(
batch,
*,
out_dir,
lmax,
sh_normalization,
radius_freqs,
file_stem_prefix,
)
```
Generate VIN encoding plots for a single oracle-labeled batch.
###### Parameters {.doc-section .doc-section-parameters}
| Name | Type | Description | Default |
|------------------|-----------------------------------------------------------|------------------------------------------------|------------|
| batch | [VinOracleBatch](`aria_nbv.data_handling.VinOracleBatch`) | Oracle-labeled VIN batch from `VinDataModule`. | _required_ |
| out_dir | [Path](`pathlib.Path`) | Output directory for plots. | _required_ |
| lmax | [int](`int`) | Max SH degree for visualization. | _required_ |
| sh_normalization | [str](`str`) | Spherical harmonics normalization mode. | _required_ |
| radius_freqs | [list](`list`)\[[float](`float`)\] | Fourier frequencies for radius plot. | _required_ |
| file_stem_prefix | [str](`str`) | Filename prefix for the plots. | _required_ |
###### Returns {.doc-section .doc-section-returns}
| Name | Type | Description |
|--------|--------------------------------------------------------|---------------------------------------|
| | [dict](`dict`)\[[str](`str`), [Path](`pathlib.Path`)\] | Mapping of plot names to saved paths. |
### VinLightningModuleConfig { #aria_nbv.lightning.VinLightningModuleConfig }
```python
lightning.VinLightningModuleConfig()
```
Configure one-step ordinal candidate scoring and optimization.
The config composes the scorer, optimizer, optional scheduler, fitted RRI
binner, loss variants, and logging policy. It does not configure dataset
construction or rollout ``Q_H`` targets; those remain owned by
:class:`aria_nbv.lightning.VinDataModuleConfig` and
:mod:`aria_nbv.rollouts`, respectively.
#### Attributes
| Name | Description |
| --- | --- |
| [target_type](#aria_nbv.lightning.VinLightningModuleConfig.target_type) | Return the :class:`VinLightningModule` factory target. |
| [vin](#aria_nbv.lightning.VinLightningModuleConfig.vin) | Candidate scorer configuration. |
| [optimizer](#aria_nbv.lightning.VinLightningModuleConfig.optimizer) | AdamW config instantiated from scorer parameters during trainer setup. |
| [lr_scheduler](#aria_nbv.lightning.VinLightningModuleConfig.lr_scheduler) | Optional scheduler created after Lightning knows the optimizer and step budget. |
| [num_classes](#aria_nbv.lightning.VinLightningModuleConfig.num_classes) | Ordinal class count ``K``; scorer logits have final width ``K-1``. |
| [coral_bias_init](#aria_nbv.lightning.VinLightningModuleConfig.coral_bias_init) | CORAL threshold-bias initialization, optionally derived from binner priors. |
| [coral_loss_variant](#aria_nbv.lightning.VinLightningModuleConfig.coral_loss_variant) | Per-valid-row ordinal loss applied to ``Tensor["M K-1", float32]`` logits. |
| [coral_balance_source](#aria_nbv.lightning.VinLightningModuleConfig.coral_balance_source) | Source of ``K-1`` threshold priors for balanced BCE or focal loss. |
| [coral_balance_eps](#aria_nbv.lightning.VinLightningModuleConfig.coral_balance_eps) | Dimensionless clamp keeping threshold priors strictly inside ``(0, 1)``. |
| [coral_focal_gamma](#aria_nbv.lightning.VinLightningModuleConfig.coral_focal_gamma) | Non-negative focusing exponent for the CORAL focal variant. |
| [coral_focal_alpha](#aria_nbv.lightning.VinLightningModuleConfig.coral_focal_alpha) | Optional positive-class focal weight in ``[0, 1]``; ``None`` uses priors. |
| [binner_fit_snippets](#aria_nbv.lightning.VinLightningModuleConfig.binner_fit_snippets) | Oracle-labelled snippets used to fit ordinal thresholds; ``None`` uses the source extent. |
| [binner_max_attempts](#aria_nbv.lightning.VinLightningModuleConfig.binner_max_attempts) | Maximum skipped/invalid oracle batches tolerated during binner fitting. |
| [save_binner](#aria_nbv.lightning.VinLightningModuleConfig.save_binner) | Persist fitted ordinal thresholds and class representatives with the run. |
| [binner_path](#aria_nbv.lightning.VinLightningModuleConfig.binner_path) | Fitted binner JSON used for class labels and expected-RRI representatives. |
| [aux_regression_loss](#aria_nbv.lightning.VinLightningModuleConfig.aux_regression_loss) | Optional regression loss from expected ordinal RRI to finite oracle RRI. |
| [aux_regression_weight](#aria_nbv.lightning.VinLightningModuleConfig.aux_regression_weight) | Initial dimensionless multiplier for the auxiliary expected-RRI loss. |
| [aux_regression_weight_gamma](#aria_nbv.lightning.VinLightningModuleConfig.aux_regression_weight_gamma) | Per-interval multiplicative decay in ``(0, 1]`` for auxiliary weight. |
| [aux_regression_weight_min](#aria_nbv.lightning.VinLightningModuleConfig.aux_regression_weight_min) | Non-negative floor for the decayed auxiliary-loss multiplier. |
| [aux_regression_weight_interval](#aria_nbv.lightning.VinLightningModuleConfig.aux_regression_weight_interval) | Lightning counter used as the auxiliary-weight decay exponent. |
| [log_interval_steps](#aria_nbv.lightning.VinLightningModuleConfig.log_interval_steps) | Optional training-step cadence for buffered rank and ordinal diagnostics. |
| [log_spearman](#aria_nbv.lightning.VinLightningModuleConfig.log_spearman) | Enable Spearman rank-correlation metrics. |
| [grad_norms](#aria_nbv.lightning.VinLightningModuleConfig.grad_norms) | Post-backward gradient-norm targets and logging policy. |
| [coverage_weight_mode](#aria_nbv.lightning.VinLightningModuleConfig.coverage_weight_mode) | Unitless coverage proxy used to weight valid candidate rows during training. |
| [coverage_weight_floor](#aria_nbv.lightning.VinLightningModuleConfig.coverage_weight_floor) | Minimum per-row coverage weight in ``[0, 1]`` before schedule blending. |
| [coverage_weight_power](#aria_nbv.lightning.VinLightningModuleConfig.coverage_weight_power) | Non-negative exponent applied to coverage fractions in ``[0, 1]``. |
| [coverage_weight_strength_start](#aria_nbv.lightning.VinLightningModuleConfig.coverage_weight_strength_start) | Initial blend from uniform weights (0) to coverage weights (1). |
| [coverage_weight_strength_end](#aria_nbv.lightning.VinLightningModuleConfig.coverage_weight_strength_end) | Final uniform-to-coverage blend after the configured anneal window. |
| [coverage_weight_schedule](#aria_nbv.lightning.VinLightningModuleConfig.coverage_weight_schedule) | Interpolation schedule between starting and ending coverage strength. |
| [coverage_weight_interval](#aria_nbv.lightning.VinLightningModuleConfig.coverage_weight_interval) | Lightning counter used to advance coverage-strength annealing. |
| [coverage_weight_anneal_epochs](#aria_nbv.lightning.VinLightningModuleConfig.coverage_weight_anneal_epochs) | Positive epoch horizon for annealing; ``None`` keeps the start strength. |
| [coverage_weight_anneal_steps](#aria_nbv.lightning.VinLightningModuleConfig.coverage_weight_anneal_steps) | Positive global-step horizon for annealing; ``None`` keeps the start strength. |
| [coverage_weight_apply_aux](#aria_nbv.lightning.VinLightningModuleConfig.coverage_weight_apply_aux) | Apply the same valid-row coverage weights to expected-RRI regression. |