Diffract

Diffract is a Python library for analyzing deep neural network weights and tracking how they evolve during training.

Installation

Diffract requires Python 3.12:

pip install diffract-core

For development, clone the repository and install with uv, which provisions Python automatically:

git clone https://github.com/Risk-AI-Research/diffract.git
cd diffract
uv sync --extra dev

Optional extras

Extra

Description

torch

PyTorch model support

tensorflow

TensorFlow/Keras model support

flax

Flax/JAX model support

onnx

ONNX model support

frameworks

TensorFlow + Flax + ONNX bundle

viz

Plotly visualization helpers

pandas

Export to pandas DataFrames

polars

Export to polars DataFrames

redis

Redis cache backend

zarr

Zarr storage backend (cloud-native arrays via fsspec)

taichi

Taichi-accelerated heavy-tailed fitting and bootstrap p-value kernels

common

viz + pandas + polars (recommended)

all

torch + viz + taichi + pandas + polars

notebooks

Dependencies for the example notebooks

docs

Build this documentation

Install extras with pip install "diffract-core[torch,common]" (quotes matter in zsh), or uv sync --extra torch --extra common in a clone.

Start here

Overview

What Diffract is, core concepts, and when to use it.

Overview
Quickstart

5-minute tour: Session models.add compute.apply results.export_metrics viz.draw.

Quickstart
Recipes

Focused how-tos: filtering, kernels, exports, storage backends.

Recipes
API Reference

Docstring-driven reference starting from Session.

Reference