Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

How to use the FIM-SDE Model

This tutorial demonstrates how to use our Foundation Inference Model (FIM) to estimate drift and diffusion functions from stochastic differential equation (SDE) data. This page provides a comprehensive introduction to using our trained SDE model with real data examples.

Introduction

Stochastic Differential Equations are fundamental mathematical models used to describe systems that evolve over time under the influence of both deterministic forces (drift) and random noise (diffusion). These equations take the form:

dx=f(x)dt+G(x)dW(t)dx = f(x)dt + G(x)dW(t)

where:

  • f(x)f(x) is the drift function representing deterministic evolution

  • G(x)dW(t)G(x)dW(t) is the diffusion term representing stochastic perturbations

  • W(t)W(t) is a Wiener process (Brownian motion)

Our model learns to estimate both ff and GG directly from observed trajectory data in a zero-shot manner, without requiring prior knowledge of the underlying system dynamics.

Let"s start by loading the necessary libraries and the pre-trained model.

Model supports up to 3D systems

Double Well Potential

Let’s start with a classic example in stochastic dynamics - the double well potential. This system exhibits bistable behavior where particles can transition between two stable states due to noise.

Dataset structure:
  observations: (1, 5000, ...)
  locations: (1024, 1, ...)
  initial_states: (5, 1, ...)
Prepared data shapes:
  Trajectories: torch.Size([1, 1, 5000, 1])
  Times: torch.Size([1, 1, 5000, 1])
  Locations: torch.Size([1, 50, 1])
Drift shape: torch.Size([1, 50, 3])
Diffusion shape: torch.Size([1, 50, 3])
Concepts normalized: False

Sampling Paths

The FIM-SDE model can also sample trajectories from the estimated process behind the observed data. Let’s try this and see if they behave as we would expect, e.g. jumping between the two wells and not escaping them.

Initial states shape: torch.Size([1, 5, 1])
Time grid shape: torch.Size([1, 5, 5000, 1])
Mask shape torch.Size([1, 5, 5000, 1])
Sampled paths shape: torch.Size([1, 5, 5000, 1])
Grid of sampled paths shape: torch.Size([1, 5, 5000, 1])
<Figure size 1200x1000 with 4 Axes>

Duffing Oscillator

We can again sample some paths:

Sampled paths shape: torch.Size([1, 5, 5000, 2])
Grid of sampled paths shape: torch.Size([1, 5, 5000, 1])
<Figure size 1200x1200 with 4 Axes>