Skip to main content

Artifex

Python JAX Flax License

Generative modeling for JAX/Flax NNX: VAEs, GANs, diffusion, flows, energy-based, autoregressive and geometric models across seven modalities

From Latin "artifex": craftsman, artist, maker.

Documentation • Getting Started • Examples • Contributing


Research preview, mid-rebuild. Artifex is in an active rebuild cycle, so breaking changes between commits are expected and stability is not guaranteed. Pin a commit if you need it. What that means concretely:

Area Status Current expectation
API surface Unstable Public interfaces can change without deprecation while runtime boundaries are still being simplified.
Performance In progress Optimization work is ongoing across training, inference, and benchmark paths. Do not assume current throughput or memory behavior is final.
Feature breadth Expanding Core model families ship today, but additional capabilities, deeper integrations, and broader examples are still being added.
Docs and workflows Maintained but evolving Checked-in installation, quickstart, examples, and contributor workflows are kept aligned with the live runtime, while broader documentation continues to be revised.

Artifex is suitable for active research and repository development. It is not in a state where long-term API stability or production guarantees should be assumed.


Overview

Artifex is a modular library for generative modeling research, providing implementations of several generative model families with a focus on modularity, type safety, and scientific reproducibility. Built on JAX and Flax NNX, it emphasizes clean abstractions and extensible design for research experimentation.

Why Artifex?

  • Research First: Designed for experimentation with clean, modular architecture
  • Modern Stack: Built on JAX/Flax NNX with full JIT compilation and automatic differentiation
  • Typed Surfaces: Protocol-based design with Pyright-checked source interfaces
  • Multi-Modal: Unified interface across images, text, audio, proteins, and more
  • Extensible: Easy to add new models, losses, and domain-specific constraints
  • Actively Verified: Blocking CI enforces repository contracts, packaging checks, and focused test suites

Design Philosophy

Research-Focused

Artifex prioritizes:

  • Modularity: Easy to swap components and experiment
  • Clarity: Clean, readable implementations over clever optimizations
  • Extensibility: Simple to add new models and functionality
  • Reproducibility: Deterministic with clear configuration management

Technical Principles

  • Type Checking: Pyright standard-mode checks block on the whole source tree through the pre-commit hook CI runs
  • Linting: The shared ruff rule set (ANN, ARG, B, C90, PLR, PTH, RET, TRY on top of E/F/I/W/D) blocks on src/; files that carried findings when it was adopted sit in a generated per-file baseline that can only shrink
  • JAX Native: Built on JAX's functional programming paradigm
  • Flax NNX: Modern object-oriented API for neural networks
  • Configuration Management: Frozen dataclass configs with validation
  • Testing: Blocking CI enforces repository contracts and an 80% repo-wide coverage floor

See Design Philosophy for detailed discussion.

Features

Generative Models

  • VAE Family: VAE, β-VAE, VQ-VAE, Conditional VAE
  • GAN Family: DCGAN, WGAN, StyleGAN, CycleGAN, PatchGAN
  • Diffusion Models: DDPM, DDIM, Score-based models, DiT, Latent Diffusion
  • Normalizing Flows: RealNVP, Glow, MAF, IAF, Neural Spline Flows
  • Energy-Based Models: Langevin dynamics, MCMC sampling with BlackJAX
  • Autoregressive Models: PixelCNN, WaveNet, Transformer-based
  • Geometric Models: Point clouds, meshes, protein structures, SE(3) molecular flows

Modality Support

  • Image: Multi-scale architectures, various loss functions, quality metrics
  • Text: Tokenization, language modeling, text generation
  • Audio: Spectral processing, waveform generation, WaveNet
  • Protein: Structure generation with physical constraints
  • Tabular: Mixed data types, privacy-preserving generation
  • Timeseries: Sequential patterns, temporal dynamics
  • Multi-Modal: Cross-modal generation and alignment

Core Components

  • Unified Configuration: Frozen dataclass configs with nested validation
  • Protocol-Based Design: Clear interfaces for models, trainers, and data
  • Modular Losses: Composable loss functions (reconstruction, adversarial, perceptual)
  • Flexible Sampling: Multiple sampling strategies (ancestral, MCMC, ODE/SDE)
  • Extension System: Domain-specific constraints and functionality
  • Evaluation Framework: Standardized metrics and benchmarks with Calibrax-aligned composition

Quick Start

Installation

# Package users
pip install avitai-artifex

# Optional Linux NVIDIA GPU support
pip install "avitai-artifex[cuda12]"

The PyPI distribution is named avitai-artifex; the Python import package remains artifex.

Optional extras

The base install carries the generative-model library only. Subsystems with their own dependencies ship behind extras:

Extra Installs Needed for
cli typer the artifex command and python -m artifex.cli
geometric trimesh the mesh datasets under artifex.benchmarks.datasets
benchmarks cli, geometric, datasets, huggingface-hub artifex.benchmarks
analysis graphviz artifex.generative_models.utils.code_analysis
logging mlflow, wandb, tensorboard the experiment trackers

Importing a subsystem without its extra raises an ImportError that names the extra:

pip install "avitai-artifex[cli,benchmarks]"

If you are contributing from a source checkout instead:

git clone https://github.com/avitai/artifex.git
cd artifex

# Run setup script (creates .venv, syncs extras, chooses a backend policy)
./setup.sh

# Activate the environment (must use 'source')
source ./activate.sh

The setup script automatically:

  • Detects an appropriate backend policy
  • Creates a virtual environment with uv
  • Syncs the right extras for CPU, CUDA 12, or Metal development
  • Writes a generated .artifex.env file and leaves .env for user-owned overrides
  • Re-sourcing activate.sh refreshes the managed backend state before applying user overrides

For an explicit choice, use ./setup.sh --backend cpu, ./setup.sh --backend cuda12, or ./setup.sh --backend metal.

If you need to rebuild from scratch, use ./setup.sh --recreate. If you also want to clear repo-local test and coverage artifacts without touching user-owned .env files, use ./setup.sh --force-clean.

For detailed package-user and source-checkout options, see the Installation Guide.

Start with the checked-in VAE quickstart

The primary onboarding path is the live VAE quickstart under docs/getting-started/quickstart.py and docs/getting-started/quickstart.ipynb. It trains a VAE on MNIST with from_tfds(..., eager=True), VAETrainer, and train_epoch_staged.

from datarax.sources import from_tfds
from artifex.generative_models.core.configuration import DecoderConfig, EncoderConfig, VAEConfig
from artifex.generative_models.models.vae import VAE
from artifex.generative_models.training import train_epoch_staged
from artifex.generative_models.training.trainers import VAETrainer, VAETrainingConfig

From a source checkout, run the maintained quickstart pair directly:

uv run python docs/getting-started/quickstart.py
uv run jupyter lab docs/getting-started/quickstart.ipynb

For the full walkthrough, see the Quickstart Guide.

Documentation

Start Here

User and API Guides

Contributor References

Architecture

Artifex keeps the public package surface relatively small at the top level and concentrates most runtime code under artifex.generative_models.

artifex/
├── src/artifex/
│   ├── benchmarks/         # Benchmark foundations, adapters, datasets, and suites
│   ├── cli/                # Supported `artifex` command-line entrypoint
│   ├── configs/            # Checked-in config defaults and loader utilities
│   ├── data/               # Shared data helpers and retained dataset surfaces
│   ├── generative_models/
│   │   ├── core/           # Configuration, protocols, losses, layers, sampling, evaluation
│   │   ├── extensions/     # Audio, chemical, NLP, protein, and vision extensions
│   │   ├── factory/        # Canonical model creation surface
│   │   ├── inference/      # Inference and optimization helpers
│   │   ├── modalities/     # Image, text, audio, protein, tabular, timeseries, multimodal
│   │   ├── models/         # VAE, GAN, diffusion, flow, energy, autoregressive, geometric
│   │   ├── training/       # Loops, callbacks, optimizers, schedulers, RL, trainers
│   │   ├── utils/          # Logging, JAX helpers, visualization, analysis utilities
│   │   └── zoo/            # Checked-in model zoo configs
│   ├── utils/              # Shared package utilities
│   └── visualization/      # Public visualization helpers
├── docs/                   # User, API, and contributor documentation
├── examples/               # Executable scripts and notebook pairs
└── tests/                  # Package, integration, unit, and repo-contract coverage

See Architecture Overview for more detail.

Development

Verification workflow

# Standard test suite
uv run pytest

# Focused contract checks
uv run pytest tests/artifex/repo_contracts -q --no-cov

# Docs validation
uv run python scripts/validate_docs.py --check-only --config-path mkdocs.yml --docs-path docs --src-path src

Code quality

# Run the repository hooks
uv run pre-commit run --all-files

# Targeted quality tools
uv run ruff check src tests
uv run ruff format src tests
uv run pyright

See Testing Guide and Contributing Guide for the maintained contributor workflow.

Project Status

Artifex is in active alpha development.

  • Checked-in installation, onboarding, example, and contributor guides are maintained against the live runtime.
  • Blocking CI enforces repository contracts and build verification.
  • Quality reports remain reviewed while broader release hardening continues.
  • Security workflow checks are blocking for pull-request and push enforcement.
  • Package surfaces can still evolve between commits when a simpler or more truthful runtime design requires it.

Use the Installation Guide, Quickstart Guide, Testing Guide, and Planned Modules as the current source of truth for supported workflows.

Contributing

Artifex accepts contributions through the standard repository workflow.

  1. Clone the repository and run ./setup.sh.
  2. Activate the environment with source ./activate.sh.
  3. Create a feature branch for the change.
  4. Add or update tests and documentation with the code change.
  5. Run uv run pytest and uv run pre-commit run --all-files.
  6. Open a Pull Request.

See the Contributing Guide for the full contributor checklist and coding expectations.

Citation

If you use Artifex in research, please cite:

@software{artifex_2025,
  title = {Artifex: Generative Modeling Research Library},
  author = {Shafiei, Mahdi and contributors},
  year = {2025},
  url = {https://github.com/avitai/artifex},
  version = {0.1.12}
}

License

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

Acknowledgments

Artifex builds on several strong open-source projects:

  • JAX - Numerical computing and transformations
  • Flax - Neural network modules with NNX support
  • Optax - Optimization utilities
  • Orbax - Checkpointing
  • BlackJAX - MCMC and energy-based sampling
  • Calibrax - Evaluation and benchmark composition
  • Datarax - Dataset and source adapters used in onboarding workflows

Release files for avitai-artifex 0.1.12

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

Source distribution (sdist)

Source distribution for avitai-artifex 0.1.12
File Size Uploaded
avitai_artifex-0.1.12.tar.gz 637.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for avitai-artifex 0.1.12
File Interpreter ABI Platform
avitai_artifex-0.1.12-py3-none-any.whl Python 3 none any Details

Total release size: 1.5 MB

Release files / avitai_artifex-0.1.12.tar.gz

Download URL avitai_artifex-0.1.12.tar.gz
Size 637.3 kB
Tags Source
SHA-256 checksum
How to use checksums
9c779c2382611002e2b5adce7b1d1fa6c80f817e2b1a7fd55681ae8c9f0195a9
BLAKE2b-256 checksum
How to use checksums
11d3494e46b7b4b25999d09baa5c3fe02586d1e4a53446d889dadc99a4a11858
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 18, 2026.

Transparency log

Release files / avitai_artifex-0.1.12-py3-none-any.whl

Download URL avitai_artifex-0.1.12-py3-none-any.whl
Size 852.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f384c0429eb42be8a20d758453cd3d067b2b5f2cdd459f8efb7383cb3804c66c
BLAKE2b-256 checksum
How to use checksums
6fa5872246c36e3ce4eb5cabb4986c908f00b1815ccd8d8bd5f544f7cf68d75b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 18, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.14

2 release files

0.1.13

2 release files

This release

0.1.12 This release

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.0

2 release files

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