Skip to main content
Torx Logo

Torx

Probabilistic circuits in JAX.

Torx is a JAX-based library for building and sampling probabilistic programs, with all the benefits of JAX (native GPU/TPU acceleration, differentiability, vectorization). Its two core objects are the parametrised stochastic circuit (PSC), a circuit of probabilistic gates whose wiring mirrors the sampling hardware it targets, and the directed factor graph (DFG), the layer beneath the circuits: a directed acyclic graph of conditional samplers, arranged so that each variable appears after the variables it depends on.

Whitepaper: A Framework for Stochastic Differentiable Programming (arXiv:2608.01612) introduces the framework, works through examples, and reports experimental results on Extropic's XTR-0 hardware.

Installation

Requires Python 3.11+.

pip install extro-torx

or

git clone https://github.com/extropic-ai/torx.git
cd torx
pip install -e ".[testing,examples]"

Documentation

Available at docs.torx.ai.

Quick example

Build and simulate a simple probabilistic circuit:

import jax
import jax.numpy as jnp
from torx import psc

gates = [
    psc.PNOT(0),
    psc.PCNOT([0, 1]),
]

circuit = psc.DiscretePCircuit(gates)
thetas = circuit.init_params(jax.random.key(0))
sim = psc.StateVectorSimulator()
compiled = sim.build_circuit(circuit, thetas)

state = jnp.array([1.0, 0.0, 0.0, 0.0])

density = sim.density(compiled, state)
print(f"Final distribution: {density}")

Citation

If you found this library useful in academic research, please cite:

@misc{verdon2026frameworkstochasticdifferentiableprogramming,
  title         = {A Framework for Stochastic Differentiable Programming},
  author        = {Guillaume Verdon and Leo Tyrpak and Owen Lockwood and Seth Morton and Alexander Neagoe and Anton Sugolov and Ian MacCormack and Mirko Amico},
  year          = {2026},
  eprint        = {2608.01612},
  archivePrefix = {arXiv},
  primaryClass  = {cs.ET},
  url           = {https://arxiv.org/abs/2608.01612},
}

See also: other libraries in the JAX ecosystem

thrml: probabilistic graphical models and block Gibbs sampling in JAX.

Awesome JAX: a longer list of other JAX projects.

Metadata

Release files for extro-torx 0.0.2

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

Source distribution (sdist)

Source distribution for extro-torx 0.0.2
File Size Uploaded
extro_torx-0.0.2.tar.gz 72.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for extro-torx 0.0.2
File Interpreter ABI Platform
extro_torx-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 139.0 kB

Release files / extro_torx-0.0.2.tar.gz

Download URL extro_torx-0.0.2.tar.gz
Size 72.9 kB
Tags Source
SHA-256 checksum
How to use checksums
14f9685ffb367e986d2b4757593c3ebe3adb6aefc6ac44820f0d4ae0cc294854
BLAKE2b-256 checksum
How to use checksums
c1aa112a19956d52b4ac1e2a896d61b0a6d4b60f1241576d7aeb5098ff83a71e
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 30, 2026.

Transparency log

Release files / extro_torx-0.0.2-py3-none-any.whl

Download URL extro_torx-0.0.2-py3-none-any.whl
Size 66.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
728417448b95e9708ba9160948889be7c27b4a5db296678093ab5bee9edbc693
BLAKE2b-256 checksum
How to use checksums
293fc5908460c99a6e761ca4a8d3d397dfc2ae938d369640dd082b939a5914c0
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 30, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

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