Background
VAFT currently provides signal-processing and scientific-processing capabilities based primarily on NumPy/SciPy/scikit-learn, but it does not yet have a common API for neural-network or broader machine-learning workflows.
A prototype workflow developed for the 2026 VEST IRE anomaly-detection study provides a useful reference case. It already separates the workflow into reusable stages:
shot data
-> preprocessing
-> window / feature extraction
-> shot-level dataset split
-> model training
-> anomaly scoring
-> threshold calibration
-> event composition
-> event-level output
The prototype compares KNN, One-Class SVM, and an Autoencoder on a shared feature dataset; only the Autoencoder requires PyTorch. This suggests that VAFT should support ML in a backend-neutral way, with PyTorch as an optional backend rather than as a core scientific API dependency.
Note: This issue describes an initial architectural plan. Before implementation, review the existing VAFT architecture in detail and propose a different design if it provides cleaner ownership, reuse, or integration with the current processing, pipeline, and storage layers.
Goals
Add a minimal ML-processing infrastructure under vaft.process, tentatively centered on:
vaft.process
|- features/ # reusable deterministic feature extraction where appropriate
`- ml/
|- dataset
|- inference
|- calibration
|- sklearn/
`- torch/ # optional backend
The design should:
- keep the public workflow backend-neutral;
- add PyTorch only as an optional dependency;
- separate deterministic feature extraction from model inference where practical;
- separate training from inference lifecycle;
- retain dataset, preprocessing, split, calibration, software, and model provenance;
- define stable artifact boundaries that can later integrate with the VAFT pipeline and FileDB/database layers;
- use the VEST IRE anomaly-detection workflow as the first reference implementation.
Ownership boundaries
vaft.process.ml should own computation such as:
- dataset preparation;
- model fitting;
- inference and scoring;
- threshold calibration;
- event-candidate composition.
It should not own:
- pipeline DAG orchestration;
- FileDB path policy;
- database registration;
- artifact replication;
- campaign scheduling.
Conceptually:
vaft.process.ml -> computation
pipeline -> orchestration
FileDB / DB -> persistence
Optional PyTorch backend
PyTorch should not become a mandatory VAFT dependency. A tentative packaging direction is:
[project.optional-dependencies]
torch = [
"torch..."
]
with usage such as:
pip install "vaft[torch]"
Without PyTorch installed, the following should still work:
import vaft
import vaft.process
import vaft.process.ml
Only PyTorch-specific functionality should raise an actionable optional-dependency error.
PyTorch types such as torch.Tensor, torch.nn.Module, and DataLoader should remain backend implementation details rather than required public scientific API types.
Common workflow contract
Start with a small contract rather than a large ML framework. Candidate concepts include:
FeatureSpec
FeatureDataset
SplitSpec
ModelSpec
ModelArtifact
InferenceResult
CalibrationResult
A target usage pattern could look like:
dataset = prepare_dataset(
shots,
feature_spec=...,
split_spec=...,
)
model = train_model(
dataset,
model_spec=...,
)
result = infer(model, dataset)
calibration = calibrate_threshold(result, labels=...)
events = compose_events(result, calibration=calibration)
Exact names and module placement should be decided after architecture review.
Training and inference
Training and inference should be treated as separate lifecycle stages.
shot corpus
-> feature dataset
-> training
-> model artifact
-> per-shot inference
-> scores / scientific products / event candidates
This separation is important for reproducibility, model reuse, and future pipeline integration.
Model artifact and provenance
A model artifact should contain or reference more than weights alone. At minimum, preserve:
- model specification / architecture;
- backend;
- feature schema;
- preprocessing configuration;
- training-shot selection;
- train/validation/test split;
- scaler / normalization;
- threshold calibration;
- VAFT/software version;
- evaluation metrics;
- model weights.
A future dataset/model fingerprint may be used to identify reproducible training configurations.
Reference implementation: VEST IRE anomaly detection
Port the existing IRE anomaly-detection prototype as the first reference workflow.
Current structure:
Stage 1:
Ip + dIp/dt
-> anomaly score
Stage 2:
H-alpha + dH-alpha/dt + cross-signal features
-> second anomaly score
both stages pass
-> anomalous windows
-> merged event-level candidates
Support the existing model families through the same dataset/inference contract:
- KNN;
- One-Class SVM;
- Autoencoder (optional PyTorch).
The dataset split must remain shot-level rather than window-level to avoid leakage.
Relation to physics-based event detection
ML output should not be interpreted directly as a physical reconnection onset.
Keep data-driven outputs such as:
anomaly score
anomalous window
IRE-like candidate interval
separate from physics-transparent observable events such as:
current_spike_onset
magnetic_burst_onset
H-alpha_burst_onset
This allows signal-processing and ML evidence to be compared rather than conflated. Final event candidates can later be connected to the common plasma-evolution timeline as one evidence producer with model/provenance metadata.
Initial phases
Phase 1 — ML core
Phase 2 — optional PyTorch
Phase 3 — IRE reference workflow
Phase 4 — artifact/provenance
Phase 5 — future pipeline / DB integration
Follow-up work may connect these contracts to:
- batch/corpus-level training stages;
- shot-level inference stages;
- FileDB model-artifact storage;
- model registry metadata;
- database-scale inference products;
- event/state timeline integration.
These integrations do not need to be implemented in the first PR.
Non-goals
The initial implementation should not attempt to:
- make PyTorch mandatory;
- support every ML framework;
- build distributed/GPU training infrastructure;
- implement a full experiment-tracking or model-registry service;
- replace deterministic signal processing with neural networks;
- define ML anomaly peaks as physical reconnection onset;
- reimplement existing event detectors inside the ML layer;
- couple training and inference into one opaque API;
- lock FileDB/database schema before the processing contract is stable.
Acceptance criteria
Long-term direction
This infrastructure should remain usable beyond IRE anomaly detection, including potential applications such as confinement-state classification, MHD-event classification, disruption/precursor inference, diagnostic reconstruction, equilibrium/stability/plasma-response surrogates, and time-series prediction.
The broader goal is to support a traceable workflow of:
scientific data
-> features / representation
-> data-driven model
-> traceable scientific product
within VAFT without coupling the scientific API to one ML backend.
Background
VAFT currently provides signal-processing and scientific-processing capabilities based primarily on NumPy/SciPy/scikit-learn, but it does not yet have a common API for neural-network or broader machine-learning workflows.
A prototype workflow developed for the 2026 VEST IRE anomaly-detection study provides a useful reference case. It already separates the workflow into reusable stages:
The prototype compares KNN, One-Class SVM, and an Autoencoder on a shared feature dataset; only the Autoencoder requires PyTorch. This suggests that VAFT should support ML in a backend-neutral way, with PyTorch as an optional backend rather than as a core scientific API dependency.
Goals
Add a minimal ML-processing infrastructure under
vaft.process, tentatively centered on:The design should:
Ownership boundaries
vaft.process.mlshould own computation such as:It should not own:
Conceptually:
Optional PyTorch backend
PyTorch should not become a mandatory VAFT dependency. A tentative packaging direction is:
with usage such as:
pip install "vaft[torch]"Without PyTorch installed, the following should still work:
Only PyTorch-specific functionality should raise an actionable optional-dependency error.
PyTorch types such as
torch.Tensor,torch.nn.Module, andDataLoadershould remain backend implementation details rather than required public scientific API types.Common workflow contract
Start with a small contract rather than a large ML framework. Candidate concepts include:
A target usage pattern could look like:
Exact names and module placement should be decided after architecture review.
Training and inference
Training and inference should be treated as separate lifecycle stages.
This separation is important for reproducibility, model reuse, and future pipeline integration.
Model artifact and provenance
A model artifact should contain or reference more than weights alone. At minimum, preserve:
A future dataset/model fingerprint may be used to identify reproducible training configurations.
Reference implementation: VEST IRE anomaly detection
Port the existing IRE anomaly-detection prototype as the first reference workflow.
Current structure:
Support the existing model families through the same dataset/inference contract:
The dataset split must remain shot-level rather than window-level to avoid leakage.
Relation to physics-based event detection
ML output should not be interpreted directly as a physical reconnection onset.
Keep data-driven outputs such as:
separate from physics-transparent observable events such as:
This allows signal-processing and ML evidence to be compared rather than conflated. Final event candidates can later be connected to the common plasma-evolution timeline as one evidence producer with model/provenance metadata.
Initial phases
Phase 1 — ML core
vaft.process.mlownership and minimal common types;Phase 2 — optional PyTorch
vaft.process.ml.torchor an architecture-equivalent backend module;Phase 3 — IRE reference workflow
Phase 4 — artifact/provenance
ModelArtifact/InferenceResultboundary.Phase 5 — future pipeline / DB integration
Follow-up work may connect these contracts to:
These integrations do not need to be implemented in the first PR.
Non-goals
The initial implementation should not attempt to:
Acceptance criteria
torch.Tensorortorch.nn.Module;Long-term direction
This infrastructure should remain usable beyond IRE anomaly detection, including potential applications such as confinement-state classification, MHD-event classification, disruption/precursor inference, diagnostic reconstruction, equilibrium/stability/plasma-response surrogates, and time-series prediction.
The broader goal is to support a traceable workflow of:
within VAFT without coupling the scientific API to one ML backend.