DynaMix: True Zero-Shot Inference of Dynamical Systems Preserving Long-Term Statistics (NeurIPS 2025)
This repository provides a Julia implementation of DynaMix, a foundation model architecture for zero-shot inference of dynamical systems that preserves long-term statistics. Note there is also a Python version available at https://github.com/DurstewitzLab/DynaMix-python.
Dynamical systems are ubiquitous in nature and society, from weather patterns and climate to financial markets and biological systems. While traditional forecasting methods require extensive training data for each specific system, DynaMix takes a fundamentally different approach by learning universal dynamical representations that generalize across systems.
DynaMix serves as a foundation model for dynamical systems. By training on a diverse collection of dynamical systems, DynaMix learns to extract and represent the underlying patterns and principles that govern temporal evolution across different domains. Unlike traditional methods that require retraining for each new system, DynaMix achieves zero-shot inference of a new system by only providing a short context window of observations.
- Accurate Zero-Shot DSR: DynaMix generalizes across diverse dynamical systems without fine-tuning, accurately capturing attractor geometry and long-term statistics.
- Multivariate Dynamics Modeling: The multivariate architecture captures dependencies across system dimensions and adapts flexibly to different dimensionalities and context lengths via embeddings.
- Efficient and Lightweight: Delivers high performance with a compact design, enabling orders-of-magnitude faster inference than traditional foundation models.
- Interpretable Dynamics Composition: Provides insights into the dynamical composition of reconstructed systems, revealing similarities across different dynamical systems.
- General Time Series Forecasting: Extends beyond DSR to general time series forecasting using adaptable embedding techniques.
Try DynaMix instantly through our interactive Huggingface Space at https://huggingface.co/spaces/DurstewitzLab/DynaMix. This demo lets you test the model's capabilities without installing any code or dependencies. Simply upload your time series data in the required format and generate long-term forecasts with zero-shot inference.
The entire project is written in Julia using the Flux deep learning stack.
Install the package in a new Julia environment:
julia> ]
(@v1.10) pkg> activate .
(DSR) pkg> instantiateWe recommend using the latest version of Julia (>v1.10). Note that for plotting tha PyPlot package is used, requiring a python installation.
DynaMix is based on a sparse mixture of experts (MoE) architecture operating in latent space:
- Expert Networks: Each expert is a specialized dynamical model (AL-RNN), given through
- Gating Network: Selects experts based on the provided context and current latent representation of the dynamics
By aggregating the expert weighting
Model implementations:
- DynaMix →
DynaMix, individual specifications for the architecture can be modified in thesettingsfile. - "Identity" mapping →
Identity, for generating observations from the latent states
DynaMix enables true zero-shot forecasting - the ability to generate accurate predictions for previously unseen dynamical systems without retraining or fine-tuning:
- A short context window from the new system is provided
- DynaMix infers the underlying dynamics from this context
- The model generates long-term forecasts that preserve both trajectory accuracy and statistical properties
A lightweight pretrained DynaMix model can be found in the models folder. This model has been trained on a diverse collection of dynamical systems and serves as a foundation model for zero-shot forecasting tasks.
To use the pretrained model load it via
model, O = load_model("models/dynamix-3d-alrnn-v1.0.bson")The pretrained model includes both the DynaMix architecture and the observation model, allowing for immediate deployment on new dynamical systems.
Example forecasting evaluations of dynamical systems and time series can be found in the notebooks folder.
Given context data from the target system with shape DynaMix_forecasting_pipeline along with the loaded model and observation model:
context = ...
DynaMix_forecasting_pipeline(model, O, context, T)The forecasting pipeline requires the following inputs:
-
model: DynaMix foundation model. Model and observation model can be loaded using the
load_model("path/to/model.bson")function. -
O: Observation model. Model and observation model can be loaded using the
load_model("path/to/model.bson")function. -
context: Context data in the form of a
$(T_C) \times (N)$ matrix - T: Forecast horizon, i.e. an integer specifying how many future steps to forecast
Optional arguments:
- preprocessing_method: for time series forecasting, choose between
pos_embedding,delay_embedding,delay_embedding_PECUZALandzero_embeddingas preprocessing method (default:pos_embedding) - standardize: standardize data?
True/False(default:True) - initial_x: Optional initial condition for the model in vector format, else last context value is used (default:
nothing)
DynaMix is trained using backpropagation through time with sparse teacher forcing (STF), a technique that balances stability and learning:
- The model makes predictions over a sequence of time steps
- At regular intervals (specified by
teacher_forcing_interval), the model's state is reset to match ground truth - This prevents error accumulation while still allowing the model to learn long-term dependencies
To start training, execute the main.jl file and see parsing for more details. Appropriate arguments can be parsed via the command line (or via changing the ones from the defaults in the settings):
$ julia -t4 --project main.jl --model DynaMix --experts 10 --latent_dim 30 -P 2 --epochs 2000
During training the model is saved every scalar_saving_interval epochs along with metrics evaluated on the test data. The saved model can be found in a generated Results folder and loaded using the load_model("path/to/model.bson") function.
-
Julia 1.10.1
-
Flux 0.14.16
If you use DynaMix in your research, please cite our paper:
@misc{hemmer2025truezeroshotinferencedynamical,
title={True Zero-Shot Inference of Dynamical Systems Preserving Long-Term Statistics},
author={Christoph Jürgen Hemmer and Daniel Durstewitz},
year={2025},
eprint={2505.13192},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/2505.13192},
}

