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.10+.

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.3

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.3
File Size Uploaded Provenance Actions
extro_torx-0.0.3.tar.gz 73.0 kB With provenance Details for extro_torx-0.0.3.tar.gz

Built distribution (wheel)

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

Total release size: 139.0 kB

Release files / extro_torx-0.0.3.tar.gz

Download URL extro_torx-0.0.3.tar.gz
Size 73.0 kB
Tags Source
SHA-256 checksum
How to use checksums
933d6d1925f2666069c2cc4ad2cfbfdccf316667f48922194200f047e03e3732
BLAKE2b-256 checksum
How to use checksums
4334348a779d1266731ab7a29be861894c322a0534d88d18dd4f879f9b3873cb
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 Oct 19, 2026.

Transparency log

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

Download URL extro_torx-0.0.3-py3-none-any.whl
Size 66.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4620b9d8065fb6bf688177da49daf9222cdd91d4e18c2939689f4f28d581f619
BLAKE2b-256 checksum
How to use checksums
4de44f5b3d129d9b27076c51b90652f68f925cce2a4e2a0d139896ea782ad0c1
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 Oct 19, 2026.

Transparency log

Security for extro-torx 0.0.3

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 extro_torx-0.0.3.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 Oct 19, 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