Skip to main content

Opifex

A unified scientific machine learning framework built on JAX/Flax NNX

From Latin "opifex" - worker, skilled maker

Documentation • Getting Started • Examples • Contributing


CI Documentation Security codecov

PyPI version Python versions Downloads

GitHub stars GitHub forks pre-commit Ruff

License: MIT Python 3.12+ JAX FLAX NNX uv


Research preview. Opifex is under rapid iteration and the API will change while we iterate toward v1.0. What that means concretely:

Area Status Impact
API 🔄 Unstable Breaking changes are expected. Public interfaces may change without deprecation warnings. Pin to a specific release or commit if stability is required.
Tests 🔄 In Flux Test suite is being expanded. Some tests may fail or be skipped. Coverage metrics are improving but not yet full.
Documentation 🔄 Evolving Docs may not reflect current implementation. Code examples might be outdated. Refer to source code and tests for accurate usage.

Pin a version if you need stability, and do not put it in production yet. For research and experimentation it is ready to use today, with the understanding that APIs will evolve.

This is public this early on purpose. Issues, questions and pull requests genuinely steer what gets built next, and a star tells us which layer to push on.


A JAX-native platform for scientific machine learning, built for unified excellence, probabilistic-first design, and high performance.

🎯 Core Vision

  • 🔬 Unified Excellence: Single JAX/Flax NNX platform spanning neural operators, physics-informed learning, differentiable solvers, atomistic & quantum modeling, and uncertainty quantification
  • 📊 Probabilistic-First: Built-in calibration, conformal prediction, Bayesian inference, and active learning across scientific workflows
  • ⚡ High Performance: End-to-end jit, vmap, and reverse/implicit grad compatibility with GPU acceleration
  • 🏗️ Production-Oriented: Reproducible benchmarking, roofline profiling, experiment tracking, and serving primitives
  • 🤝 Community-Driven: Open patterns for education, research collaboration, and industrial adoption

✨ Key Features

  • Neural Operators: FNO, DeepONet, PINO, TFNO, UFNO, SFNO, LocalFNO, AM-FNO, MS-FNO, UNO, FourierDeepONet, AdaptiveDeepONet, MultiPhysicsDeepONet, GINO, MGNO, UQNO, LNO, WNO, GNO, OperatorNet (20 registered architectures; opifex.neural.operators.OPERATOR_REGISTRY)
    • Spectral, Multi-Scale & Clifford Families: Resolution-invariant Fourier (FNO, TFNO, UFNO, UNO, MS-FNO, AM-FNO, LocalFNO), spherical (SFNO), wavelet (WNO), latent attention (LNO), and multivector Clifford (CliffordFNO) operators
    • Branch-Trunk, Geometry & Physics-Informed Families: DeepONet variants (FourierDeepONet, AdaptiveDeepONet, MultiPhysicsDeepONet), irregular-mesh graph and geometry-informed operators (GNO, GINO, MGNO), physics-informed PINO, and uncertainty-aware UQNO
  • Physics-Informed Neural Networks & KANs: Standard PINNs, variational/fractional/spacetime/GP variants (VPINN, fPINN, GST-PINN, GP-PINN, multi-scale PINNs), domain decomposition (FBPINN, XPINN, CPINN), and physics-informed Kolmogorov-Arnold networks (PIKAN)
  • Differentiable PDE, Stiff ODE & Nonlinear Solvers: Typed Problem / Method / Solution protocol (opifex.core.solver) spanning staggered-grid Navier-Stokes, lid-driven cavity, Burgers, Darcy, shallow-water, and spectral ETDRK4 PDE solvers, pure-JAX stiff Rosenbrock/ESDIRK ODE integrators (Rodas4, Ros34PW2, Kvaerno3), LevenbergMarquardt nonlinear least squares with implicit differentiation, UDE, and additive_hybrid classical-neural solvers
  • Atomistic Potentials: E(3)-equivariant SchNet, PaiNN, and NequIP backbones (with MACE-style higher body-order symmetric contraction), energy/forces/stress heads, and an ASE calculator
  • Quantum Chemistry: Differentiable Kohn-Sham DFT (SCFSolver with Anderson/DIIS mixing and implicit fixed-point differentiation), neural exchange-correlation functionals, variational Monte Carlo, and equivariant Fock/Hamiltonian prediction (QH9)
  • Equivariant Algebra, Geometry & Fields: Native E(3) irreps, Clebsch-Gordan, Wigner-D, and spherical harmonics; spherical and Poincaré hyperbolic manifolds, constructive solid geometry (CSG), point-cloud radius graphs, and staggered-grid MAC differential operators with exact DFT/DCT-II pressure projection
  • Uncertainty Quantification & Probabilistic Numerics: Split, grouped, time-series, risk-controlling, and right-censored IPCW/doubly-robust conformal prediction (CensoredSplitConformalRegressor); censored Gaussian/Tobit likelihoods and correlated contrasts; Gaussian processes, state-space & computation-aware Kalman filters (cakf_filter), Bayesian quadrature, data assimilation, simulation-based inference (NPE/NLE/NRE), PAC-Bayes, Sobol/Morris sensitivity, FORM/SORM reliability, BlackJAX MCMC, and UQ adapters (opifex.capabilities.UQ_CAPABILITIES)
  • Active Learning, Bayesian Optimization & Multi-Fidelity: Traced joint mutual-information batch acquisition (batch_bald), constrained multi-objective qEHVI, Thompson sampling, REMBO, trust-region & asynchronous BO, experimental design, and linear/NARGP/MUMBO multi-fidelity surrogates
  • Equation Discovery: Sparse Identification of Nonlinear Dynamics (SINDy, EnsembleSINDy, WeakSINDy, BayesianSINDy) and symbolic regression
  • Training, Meta-Optimization & Control: NNX-native Trainer with GradNorm physics/boundary loss balancing, NTK spectral diagnostics, adaptive residual sampling (RAR-D), learn-to-optimize (L2O) & meta-learning (MAML/Reptile), second-order hybrid optimizers, and model predictive control (MPC)
  • Scientific Data, Benchmarking & MLOps: datarax Source/Pipeline loaders (PDEBench, VTK unstructured meshes, QH9, spectral PDE generators), calibrax-backed operator benchmarking & roofline profiling (opifex-benchmark CLI), MLflow/W&B/Neptune experiment tracking, and 59 runnable example scripts and notebooks

For detailed feature documentation, see Features.

🚀 Quick Start

Prerequisites

  • Python 3.12+
  • CUDA-compatible GPU (optional but recommended)

Installation

opifex is on PyPI:

uv add opifex            # or: pip install opifex
uv add "opifex[cuda12]"  # Linux NVIDIA GPU wheels (CUDA 12)
uv add "opifex[mlflow]"  # with the MLflow experiment backend

To work on opifex itself, clone the repository and use the managed environment:

# Clone the repository
git clone https://github.com/avitai/opifex.git
cd opifex

# Set up development environment (auto-detects CUDA / Metal / CPU)
./setup.sh

# Activate environment
source ./activate.sh

# Run tests to verify installation
uv run pytest

For detailed installation instructions, see Installation Guide.

📚 Basic Usage

Fourier Neural Operator (FNO)

import jax
from flax import nnx
from opifex.neural.operators.fno import FourierNeuralOperator

# Create FNO for learning PDE solution operators
rngs = nnx.Rngs(jax.random.key(0))

fno = FourierNeuralOperator(
    in_channels=1,
    out_channels=1,
    hidden_channels=32,
    modes=12,
    num_layers=4,
    rngs=rngs,
)

# Input: (batch, channels, *spatial_dims)
x = jax.random.normal(jax.random.key(1), (4, 1, 64, 64))
y = fno(x)
print(f"FNO: {x.shape} -> {y.shape}")  # (4, 1, 64, 64) -> (4, 1, 64, 64)

Deep Operator Network (DeepONet)

import jax
from flax import nnx
from opifex.neural.operators.deeponet import DeepONet

# Create DeepONet for function-to-function mapping
rngs = nnx.Rngs(jax.random.key(0))

deeponet = DeepONet(
    branch_sizes=[100, 64, 64, 32],  # 100 sensor locations
    trunk_sizes=[2, 64, 64, 32],     # 2D output coordinates
    activation="gelu",
    rngs=rngs,
)

# Branch input: function values at sensors (batch, num_sensors)
# Trunk input: evaluation coordinates (batch, n_locations, coord_dim)
branch_input = jax.random.normal(jax.random.key(1), (8, 100))
trunk_input = jax.random.uniform(jax.random.key(2), (8, 50, 2))  # 50 eval points

output = deeponet(branch_input, trunk_input)
print(f"DeepONet output: {output.shape}")  # (8, 50)

Equation Discovery (SINDy)

import jax
import jax.numpy as jnp
from opifex.discovery.sindy import SINDy, SINDyConfig

# Generate Lorenz trajectory (σ=10, ρ=28, β=8/3) with scanned RK4
def lorenz(state, sigma=10.0, rho=28.0, beta=8.0 / 3.0):
    x, y, z = state
    return jnp.array([sigma * (y - x), x * (rho - z) - y, x * y - beta * z])

dt, state0 = 0.001, jnp.array([1.0, 1.0, 1.0])

def rk4_step(state, _):
    k1 = lorenz(state)
    k2 = lorenz(state + 0.5 * dt * k1)
    k3 = lorenz(state + 0.5 * dt * k2)
    k4 = lorenz(state + dt * k3)
    nxt = state + (dt / 6.0) * (k1 + 2 * k2 + 2 * k3 + k4)
    return nxt, (nxt, lorenz(nxt))

_, (traj, derivs) = jax.lax.scan(rk4_step, state0, None, length=10000)
trajectory = jnp.concatenate([state0[None], traj], axis=0)
derivatives = jnp.concatenate([lorenz(state0)[None], derivs], axis=0)

# Discover governing equations from data
model = SINDy(SINDyConfig(polynomial_degree=2, threshold=0.3))
model.fit(trajectory, derivatives)

for eq in model.equations(["x", "y", "z"]):
    print(eq)
# dx/dt = -10.000 x + 10.000 y            (true: -10 x + 10 y)
# dy/dt = 27.999 x + -1.000 y + -1.000 x z  (true: 28 x - y - x z)
# dz/dt = -2.667 z + 1.000 x y            (true: -8/3 z + x y)

Conformal Uncertainty Quantification

import jax
import jax.numpy as jnp
from opifex.uncertainty.conformal import SplitConformalRegressor

x_cal = jnp.linspace(0.0, 1.0, 100)
y_cal = jnp.sin(2.0 * jnp.pi * x_cal) + 0.1 * jax.random.normal(jax.random.key(0), (100,))
pred_cal = jnp.sin(2.0 * jnp.pi * x_cal)

calibrator = SplitConformalRegressor(alpha=0.1)
state = calibrator.fit(predictions=pred_cal, targets=y_cal)

x_test = jnp.array([0.25, 0.5, 0.75])
interval = calibrator.with_state(state).predict(predictions=jnp.sin(2.0 * jnp.pi * x_test))
print(f"90% interval shape: {interval.lower.shape} -> {interval.upper.shape}")  # (3,) -> (3,)

For full examples and tutorials, see the Examples directory and Documentation.

🔧 Development

# Run tests
uv run pytest

# Code quality checks
uv run pre-commit run --all-files

For detailed development guidelines, see Development Guide.

📖 Documentation

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


Ready to get started? Check out our Quick Start Guide or explore the Examples directory!

Metadata

Release files for opifex 0.2.13

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for opifex 0.2.13
File Size Uploaded Provenance Actions
opifex-0.2.13.tar.gz 1.4 MB With provenance Details for opifex-0.2.13.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for opifex 0.2.13
File Interpreter ABI Platform Actions
opifex-0.2.13-py3-none-any.whl Python 3 none any Details for opifex-0.2.13-py3-none-any.whl

Total release size: 3.1 MB

Release files / opifex-0.2.13.tar.gz

Download URL opifex-0.2.13.tar.gz
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
c46b39ea4926f822186a8a80bd42181e73a00a47c84ec966b5c06bbf5e17f5db
BLAKE2b-256 checksum
How to use checksums
d4924a477d69b2a0e350d6a201f120ca6ea684a53d071d4aa76c61d461912b12
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Release files / opifex-0.2.13-py3-none-any.whl

Download URL opifex-0.2.13-py3-none-any.whl
Size 1.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
2c0d388b3bbf68d3f6308ff6c978a1ab665a55792ea28808817605cc9d1858a8
BLAKE2b-256 checksum
How to use checksums
7608ab5d4171b85e661ebf73288bb1285dee9affbb36a1afe7d67684796990d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Security for opifex 0.2.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for opifex-0.2.13.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page