Skip to content
Proyectos

ml-jku/neural-gyrokinetics

Ver en GitHub

Acerca de

Machine learning tools to accelerate high-dimensional plasma turbulence simulations.

IA y aprendizaje automático

Cómo se miden estas cifras

Crecimiento de estrellas medido

in 24h
0
in 7 days
Recopilando historial
in 15 days
Recopilando historial
in 1 month
Recopilando historial

Cambios netos en períodos que se solapan, no totales diarios. Los datos no disponibles se dejan en blanco. Las estrellas indican interés, no calidad.

README.md

Original

Neural Gyrokinetics

Machine learning tools to accelerate and compress high-dimensional plasma turbulence simulations. A growing collection of research code at the intersection of scientific machine learning and gyrokinetics.

  • GyroSwin Icon GyroSwin: a 5D neural surrogate for nonlinear gyrokinetics. blogpost
  • PINC Icon PINC: physics-informed neural compression of plasma data. blogpost
  • GyroSplat Icon GyroSplat: 5D snapshots as Gaussian and Gabor splats, with the potential and the heat flux computed from the stored splats. arXiv | blogpost | code | dataset
  • GyroFlow Icon GyroFlow: latent flow matching that samples statistically steady 5D turbulence without simulating the transient. code
  • gyaradax: a differentiable JAX gyrokinetic solver. repo · blogpost

This repository keeps growing as the project expands.

Who is this for?

Researchers at the intersection of scientific machine learning and plasma physics, or anyone working on accelerating high-dimensional simulations.

Models and data

GyroSwin checkpoints are on the Hub in three sizes: small | medium | large, with the in- and out-of-distribution evaluation cases at gyroswin_cbc_id_ood.

The PINC compression test set and model checkpoints (neural fields and autoencoders) are at pinc_gkw. The complete adiabatic trajectory set (bf16 distribution functions and potentials, metadata, GKW input.dat) is at 🤗 cbc-gyroswin-256traj, with the held-out evaluation trajectories under id/ and ood/. Download the evaluation sets only:

from huggingface_hub import snapshot_download
snapshot_download("gerkone/cbc-gyroswin-256traj", repo_type="dataset",
                  allow_patterns=["id/*", "ood/*"], local_dir="data/preprocessed_kvikio")

The GyroSplat evaluation snapshots and the stored codes of every method are at gyrosplat-dataset-gkw. The per-snapshot result rows behind its tables are in neugk/gyrosplat/results.

Reproducing GyroSwin

With the evaluation sets downloaded as above, from the repository root:

python scripts/gyroswin/eval_gyroswin.py --ckpt ml-jku/gyroswin_large --data-root data/preprocessed_kvikio

This rolls out the hub checkpoint (--ckpt, small / medium / large) on the 6 in- and 5 out-of-distribution cases of the paper and prints the time-averaged heat-flux error per case and the RMSE per split (Table 2). --split id|ood|all evaluates every trajectory under id/ and ood/ instead. Single rollouts that write each prediction (df, phi, flux) to predictions/ run with python -m neugk.gyroswin.eval.inference_from_hf --ckpt <checkpoint>.

Reproducing GyroSplat

The notebooks in notebooks/gyrosplat rebuild every table and figure from prior calculated results. To fit a single snapshot run something like:

python -m neugk.gyrosplat fit --dataset gkw --config configs/gyrosplat/recipe/gkw_302x.yaml data.trajectory=iteration_13 data.timestep=100

scripts/gyrosplat/reproduce_gkw.sh <snapshots> <results_dir> runs GyroSplat and the baselines on the 39 evaluation snapshots at both file sizes. See the GyroSplat README.

Running

Experiments use Hydra configs (configs/{dataset,logging,model,training,validation}); training and evaluation run through main.py. To sample from a trained diffusion checkpoint:

python generate_samples.py configs/generation/generate_samples.yaml

setting diffusion_checkpoint_dir, ae_checkpoint, data_path and generation.{trajectories,output_dir} in the config. With normalization_file and inference.latent_scale set, no training data is needed. scripts/gyroflow/eval_gyroflow.py <sampling config> samples the id/ and ood/ sets and reports the time-averaged heat-flux error.

Components

GyroSwin Icon GyroSwin is a 5D vision transformer with shifted-window linear attention that captures the full nonlinear dynamics of gyrokinetic turbulence, predicting turbulent transport at a fraction of the simulation cost while preserving physics that quasilinear models miss. See the blogpost.

PINC Icon PINC compresses gyrokinetic turbulence data by up to 70,000x while preserving physical diagnostics, with a unified pipeline to assess how well compressors retain spatial and temporal turbulence. See the blogpost.

GyroSplat Icon GyroSplat stores a 5D snapshot as a sum of Gaussian and Gabor splats, 302x smaller on the adiabatic GKW set. The potential and the heat-flux spectrum are formulas of the stored splats, and the fit matches both to the simulation. See the paper and the README.

GyroFlow Icon GyroFlow is a latent flow-matching model over the compressed representations. It samples statistically steady 5D turbulence directly, without simulating the transient. See the paper.

gyaradax is a differentiable JAX implementation of the gyrokinetic right-hand side, used for the physics losses and the PINN-residual baseline. repo · paper · blogpost

Project structure

📁 configs                            # Experiment configs (Hydra)

📁 neugk
├── 📁 gyroswin                       # GyroSwin surrogate
│   ├── 📁 eval                       # rollout evaluation and hub inference
│   ├── 📁 models                     # GyroSwin and baseline architectures
│   └── 📄 run.py                     # GyroSwin runner
│
├── 📁 pinc                           # physics-informed neural compression
│   ├── 📁 autoencoders               # 5D Swin AE, VAE, VQ-VAE, VAPOR baseline
│   ├── 📁 neural_fields              # per-snapshot neural fields (incl. PINN-residual baseline)
│   ├── 📁 eval                       # compression metrics, reconstructors, traditional baselines
│   ├── 📄 losses.py                  # PINC integral and spectral losses
│   ├── 📄 peft_utils.py              # LoRA/EVA adapters for the fine-tuning stage
│   ├── 📄 nf_main.py                 # neural field parallel runner
│   └── 📄 run.py                     # PINC autoencoder runner
│
├── 📁 gyrosplat                      # compression with Gaussian and Gabor splats
│   ├── 📁 model                      # splats, rendering, amplitude solves, fitting stages, storage
│   ├── 📁 backends                   # synthetic and GKW potential / flux readouts
│   ├── 📁 baselines                  # Fourier, wavelets, PCA, ZFP/SZ3, plain splats, neural field
│   ├── 📁 eval                       # scores, ablations, tables and figures of the paper
│   ├── 📁 results                    # per-snapshot result rows
│   └── 📄 recipe.py                  # the pipeline: compress / decode / score
│
├── 📁 diffusion                      # GyroFlow: latent flow matching / diffusion
│   ├── 📁 models                     # AR transformer, DiT, diffusion UNet
│   └── 📄 run.py                     # diffusion runner
│
├── 📁 physics                        # gyrokinetic integrals and diagnostics
│   ├── 📄 integrals.py               # potential and flux phase-space integrals
│   └── 📄 diagnostics.py             # spectra and turbulence diagnostics
│
├── 📁 dataset                        # dataset classes, backends and preprocessing
├── 📁 models                         # shared nD ViT / Swin building blocks
├── 📄 evaluate.py                    # base evaluator
├── 📄 losses.py                      # common losses and gradient balancer
└── 📄 runner.py                      # base runner class

📄 main.py                            # training / evaluation entry point
📄 generate_samples.py                # diffusion sampling entry point

Citing

@inproceedings{paischer2025gyroswin,
    title={GyroSwin: 5D Surrogates for Gyrokinetic Plasma Turbulence Simulations},
    author={Fabian Paischer and Gianluca Galletti and William Hornsby and Paul Setinek and Lorenzo Zanisi and Naomi Carey and Stanislas Pamela and Johannes Brandstetter},
    booktitle={Advances in Neural Information Processing Systems 38: Annual Conference on Neural Information Processing Systems 2025, NeurIPS 2025, San Diego, CA, USA, December 02 - 07, 2025},
    year={2025}
}
@misc{galletti2026pinc,
      title={Physics-Informed Neural Compression of High-Dimensional Plasma Data},
      author={Gianluca Galletti and Gerald Gutenbrunner and Sandeep S. Cranganore and William Hornsby and Lorenzo Zanisi and Naomi Carey and Stanislas Pamela and Johannes Brandstetter and Fabian Paischer},
      year={2026},
      eprint={2602.04758},
      archivePrefix={arXiv},
      primaryClass={physics.plasm-ph},
}
@inproceedings{gutenbrunner2026gyrosplat,
    title={GyroSplat: A Linear Representation of Fusion Plasma Turbulence with Direct and Differentiable Physics},
    author={Gerald Gutenbrunner and Andreas Radler and Gianluca Galletti and Johannes Brandstetter and Fabian Paischer},
    booktitle={RPS Workshop at NeurIPS 2026},
    year={2026},
    url={https://openreview.net/forum?id=xZMuTU83eC}
}

Explorar proyectos relacionados

Cargando…