Skip to content

Models

jNO ships no model zoo of its own. Every model — from a simple MLP to a Fourier Neural Operator to a large pretrained foundation model — comes from foundax, jNO's model library, and is wrapped with jno.nn(...) to gain jNO's training controls (optimizer, schedules, freeze / mask / LoRA, dtype, diagnostics).

Full architecture reference, constructor signatures, and pretrained checkpoints live in the foundax docs: https://fhg-iisb.github.io/foundax/


Wrapping a model

jno.nn accepts any Equinox module. foundax models are Equinox modules, but you can wrap your own eqx.Module in exactly the same way — see Operations → Part B for a custom model example.

import foundax
import jno
import optax

net = jno.nn(foundax.mlp(in_features=2, hidden_dims=64, num_layers=4,
                               key=jax.random.PRNGKey(0)))
net.optimizer(optax.adam(1e-3))

Once wrapped, all jNO model controls are available: freeze, masks, LoRA, dtype conversion, and diagnostics. See Operations → Part B.


Available architecture families

Family foundax constructors
Linear / MLP foundax.linear, foundax.mlp
DeepONet foundax.deeponet
FNO foundax.fno1d, foundax.fno2d, foundax.fno3d
CNO foundax.cno2d
U-Net foundax.unet1d, foundax.unet2d, foundax.unet3d
MgNO foundax.mgno1d, foundax.mgno2d
Geometry-aware foundax.geofno, foundax.pcno, foundax.pit, foundax.pointnet
GNOT family foundax.cgptno, foundax.gnot, foundax.moegptno
Transformer foundax.transformer
Foundation models foundax.poseidon, foundax.morph, foundax.mpp, foundax.walrus, foundax.dpot, foundax.prose, …

For constructor signatures, hyperparameters, and pretrained checkpoints see the foundax docs.


Structured-grid domains

For Poseidon-style structured 2D workflows, build the grid on the unit square. n counts cells, so a 128x128 pixel grid — the resolution these models expect — is n=127:

domain = jno.shape.rect(0.0, 0.0, 1.0, 1.0).structured(n=127).domain()
domain.grid["shape"]     # (128, 128) — nodes; a nodal field reshapes straight to it

Marching a network as an ODE — Model.flow

v.flow(x0, time=...) integrates the network as a velocity field, dx/dt = v(x, t, *cond). The network is called state-first, time-second.

x  = v.flow(x0_array, time=ts)                     # concrete start -> the marched array
xg = v.flow(jno.noise.gaussian(ndim=2), time=ts)   # symbolic start -> a node for jno.core([...])

time= takes the grid points: an array is the primary form, so a non-uniform schedule needs no extra argument and a decreasing grid marches backwards, mapping a sample back to its latent. A (t0, t1, n) triple is sugar for linspace, with n counting points exactly as in domain(time=...). The state is any pytree, so a multi-field generative model marches in one call.

Because the symbolic form is an ordinary trace node, a constraint on generated samples is just another term, and an optimisable latent gets a gradient through the whole march:

# a physics residual on what the model generates
xg = v.flow(jno.noise.gaussian(ndim=D), time=(0.0, 1.0, 17))
crux = jno.core([(v((1 - t) * x0 + t * x1, t) - (x1 - x0)).mse, lam * residual(xg).mse])

# recover the latent behind an observation — v.freeze(), z trainable
z = jno.np.parameter((n, D))
crux = jno.core([(observe(v.flow(z, time=ts)) - y_obs).mse])

Sampling as an SDE — flow(noise=..., key=...)

Passing a jno.noise spec turns the march into a stochastic one: the deterministic step, then draw · √|dt|, redrawn independently at every step (Euler–Maruyama).

x = v.flow(x0, time=ts, key=k, noise=jno.noise.gaussian(std=0.3))

Here the noise node names a distribution, not a draw — the one place in jNO where it means that. Its shape comes from the state being marched, so ndim=/like= are refused rather than ignored. Parameters may be schedules, callables of the march time, which is what an SDE sampler's σ_t is:

noise=jno.noise.gaussian(std=lambda t: 0.3 * jnp.sqrt(t / (1 - t)))

The per-step redraw is the property to rely on. A single draw shared across the march would not be Brownian motion at all — the increments would be perfectly correlated and the endpoint variance would come out a factor of the step count too large, getting worse as the step count is raised. Verified against the Itô isometry: with std=σ and zero drift the endpoint variance is σ²T and does not move as the step count goes 10 → 40 → 80.

key= is required on the eager path. A concrete initial state marches outside the solver, where there is no step key to inherit, and a noise node evaluated without a key returns zeros — so omitting it would silently give a deterministic ODE labelled as an SDE. Inside a term list the solver's step key is used and key= may be omitted. A key= with no noise= also raises, since it would do nothing.

A backward grid works: the increment scales with √|dt|, so a decreasing time= is a real backward SDE rather than a NaN.

Why this matters. The per-step Gaussian transition is exactly the policy that RL post-training of flow models optimises — Flow-GRPO's policy is a per-step Gaussian, not a continuous-time density, so it needs no divergence. Together with save=True for the trajectory, that is the ingredient list.


Limitations. Heun's method, fixed step, explicit — no adaptive control and no error estimate, so the step count is the accuracy knob: second order for the ODE, strong order 1/2 for the SDE (the Euler–Maruyama increment sets it). No log-density: that needs the divergence of v with respect to the state, which jno.np.divergence (defined over coordinate Variables) does not provide — note this blocks exact likelihoods, not the per-step transition density an SDE sampler gives. Dropout must still be off.

The network is handed ctx.key, which is the same key at every step of the march (only the SDE increment folds in the step index), so a dropout mask would be identical across all steps rather than resampled — and on the eager path that key is None. Reverse mode stores every step, so a march inside a training loss costs its step count in both compute and activation memory — core.solve(checkpoint_gradients=True) trades roughly 30 % compute back for the memory.