Skip to main content

Quivers

A typed functional probabilistic programming language for PyTorch.

CI Docs PyPI Python 3.14+ License: MIT

Quickstart · Tutorials · Examples · Language reference · Python API


Quivers is a typed functional probabilistic programming language and compiler with a PyTorch runtime. It includes the QVR source language, a compiler to the Quivers Indexed Effect Core (QIEC), inference and diagnostics, a mixed-effects formula interface, eleven transpilers, and editor and notebook tooling. Its Python API also exposes categorical, deduction, and structural modeling primitives.

A probabilistic program describes how unknown quantities could generate data. For a regression, it might first draw a slope and an intercept, then describe how measurements vary around the resulting line. Fitting the program asks which slopes and intercepts remain plausible after seeing the measurements. Quivers keeps that model separate from the algorithm used to fit it.

The types describe what can connect to what. A table from people to activities can compose with a table from activities to outcomes when the intermediate activities agree. The chosen algebra determines how alternative routes combine: adding probabilities answers a different question from taking a best score. You can use the modeling interface before studying this mathematical structure. Start with the conceptual introduction and a first regression.

What Quivers includes

Area What it provides
QVR language and compiler Typed probabilistic programs with indexed families, lexical effect instances, row-polymorphic computations, and authored handlers. The language includes discrete marginalization and collection operators such as map, fold, and traverse.
Execution and inference A PyTorch runtime with automatic differentiation and more than forty distribution families. Inference includes SVI with automatic and flow-based guides, HMC, NUTS, and hybrid samplers.
Formulas and data A brms-style mixed-effects interface for pandas, Polars, and other Narwhals-compatible dataframes. The generated QVR can be saved and edited.
Diagnostics and analysis ArviZ export, ESS and R-hat, PSIS-LOO, posterior-predictive checks, LOO-PIT, static program summaries, source maps, and algebra-aware initialization advice.
Composition and structure A typed V-enriched categorical API and algebra-parametric semantics. QVR adds weighted chart deduction and declarations for structural signatures, encoders, decoders, and losses.
Transpilation Capability-checked output for BUGS, Church, Edward2, Gen, JAGS, NumPyro, PyMC, Pyro, Stan, Turing, and WebPPL. Unsupported target features are reported before code generation.
Developer tooling A command-line interface, interactive REPL, Jupyter kernel, language server, Pygments and tree-sitter grammars, and first-party extensions for VS Code, Cursor, and Zed.

Installation

Quivers requires Python 3.14 or later. Install the base package with:

python -m pip install quivers

Optional features are distributed as extras:

python -m pip install 'quivers[formulas,diagnostics,repl,lsp,targets]'

The user-facing extras are formulas, data, diagnostics, repl, lsp, and targets. The dev and docs extras are for work on Quivers itself. Some transpilation targets require their own runtime or compiler. The installation guide covers editor setup and target-specific dependencies.

Quick start

The following QVR file is a larger language-model showcase. It defines a stochastic GRU-shaped recurrence; the regression tutorial above introduces sample, observe, and inference with a smaller model:

object Token : FinSet 256
object Resp : FinSet 32
object Embedded : Real 64
object Hidden : Real 128

morphism tok_embed : Token -> Embedded [role=embed]
morphism gate_z, gate_r : Embedded * Hidden -> Hidden ~ LogitNormal
morphism lm_head : Hidden -> Token ~ Categorical

program gru_cell(x_t, h_prev) : Embedded * Hidden -> Hidden
    sample z <- gate_z(x_t, h_prev)
    sample r <- gate_r(x_t, h_prev)

    let reset_hidden = r * h_prev

    sample h_cand <- Normal(loc=reset_hidden, scale=0.5)

    let z_complement = 1.0 - z
    let h_new = z_complement * h_prev + z * h_cand
    return h_new

define backbone = tok_embed >> scan(gru_cell)

program gru_lm : Token -> Token
    sample h <- backbone

    observe next_token : Resp <- lm_head(h)
    return next_token

export gru_lm

Download the example and check it:

curl -LO https://raw.githubusercontent.com/quivers-dev/quivers/main/docs/examples/source/gru_lm.qvr
qvr check gru_lm.qvr

The QVR tutorial develops the language and inference workflow from a first model. The examples gallery covers hierarchical and state-space models, mixture models, neural language models, formal grammars, and structural autoencoders.

Typical workflows

Check, inspect, and run a QVR file from the command line:

qvr check model.qvr
qvr run model.qvr --list
qvr run model.qvr my_program

Check whether a model is supported by a target before emitting code:

qvr check --target pyro model.qvr
qvr transpile --to pyro model.qvr -o model.py
qvr transpile --to-all model.qvr --out-dir generated

Fit a mixed-effects model from a dataframe, then save the QVR produced by the formula compiler:

from quivers.formulas import fit

result = fit(
    "response ~ predictor + (1 + predictor | participant)",
    data=df,
    family="gaussian",
    method="nuts",
)
result.dump_qvr("model.qvr")

For language work, qvr repl opens the interactive environment, qvr-kernel install registers the Jupyter kernel, and qvr-lsp starts the language server. The repository contains extensions for VS Code and Cursor and Zed.

How the pieces fit together

flowchart LR
    Formula["Formulas + data"] --> QVR["QVR programs"]
    QVR --> Check["Parser + type/effect checker"]
    Check --> QIEC["Typed executable QIEC"]
    QIEC --> Ref["Reference execution"]
    QIEC --> Tools["Analysis + editor diagnostics"]
    QIEC --> Targets["11 target transpilers"]
    QVR --> Torch["PyTorch program"]
    Torch --> Infer["Inference + diagnostics"]
    QVR --> API["Categorical + structural Python APIs"]
    API --> Torch

Documentation

Resource Use it for
Getting started Installation and a first working model.
QVR tutorials Guided lessons from core syntax through indexed effects, handlers, inference, and release checks.
Python tutorials The typed categorical library and its composition rules.
Examples Complete models organized by statistical family and language feature.
Language reference QVR syntax, types, effects, execution, and tooling behavior.
Guides Inference, formulas and data, transpilation, the REPL, the LSP, and extension points.
Python API Public classes, functions, and modules.
Semantics Formal denotations for well-typed programs.
QIEC internals The stable core, serialization format, and runtime ABI.

Project status

Quivers is alpha software. Language and API changes are recorded in the changelog, and published releases are available from PyPI and GitHub Releases.

Support

Use GitHub Issues for bug reports, feature requests, and documentation problems. Include a minimal .qvr file, the command you ran, and the complete diagnostic when reporting compiler or runtime behavior.

Contributing

See CONTRIBUTING.md for the development setup, tests, contribution workflow, and commit conventions.

Acknowledgments

This project was developed by Aaron Steven White at the University of Rochester with support from the National Science Foundation (NSF-BCS-2237175 CAREER: Logical Form Induction, NSF-BCS-2040831 Computational Modeling of the Internal Structure of Events). It was architected and implemented with the assistance of Claude Code.

License

Quivers is released under the MIT License.

Metadata

Release files for quivers 0.53.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 quivers 0.53.2
File Size Uploaded Provenance Actions
quivers-0.53.2.tar.gz 11.0 MB With provenance Details for quivers-0.53.2.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for quivers 0.53.2
File Interpreter ABI Platform Actions
quivers-0.53.2-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details for quivers-0.53.2-cp314-cp314-win_amd64.whl
quivers-0.53.2-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.28+ x86-64, Linux glibc 2.5+ x86-64 Details for quivers-0.53.2-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
quivers-0.53.2-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details for quivers-0.53.2-cp314-cp314-macosx_11_0_arm64.whl

Total release size: 34.0 MB

Release files / quivers-0.53.2.tar.gz

Download URL quivers-0.53.2.tar.gz
Size 11.0 MB
Tags Source
SHA-256 checksum
How to use checksums
6f06aa99ff31f35f5b3f168eaed73993ed8b2b74149ad73122ae7b8e3b5a051d
BLAKE2b-256 checksum
How to use checksums
797e34e764e82bba386f82c79e2e6f9f01ab4d3f6fb81346e99fe1986632450a
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 12, 2026.

Transparency log

Release files / quivers-0.53.2-cp314-cp314-win_amd64.whl

Download URL quivers-0.53.2-cp314-cp314-win_amd64.whl
Size 8.2 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
a283cbcb8d4160ecf8952b4f4780b78293bb8075a544abb437f3d27217b42367
BLAKE2b-256 checksum
How to use checksums
3031edac88f660dc42924c99d0e5567f56b6cb17833c269d4c855583c4556b1a
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 12, 2026.

Transparency log

Release files / quivers-0.53.2-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl

Download URL quivers-0.53.2-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Size 7.4 MB
Tags CPython 3.14 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
3540bf53da34ec44b4def1c5281b2be224cfbbab28a2fcbd229b858543c87e65
BLAKE2b-256 checksum
How to use checksums
8e7e802bc1c5d3b2d78b30047fef6b53681a96a5ac5ef726c4bcc4a61f8157f9
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 12, 2026.

Transparency log

Release files / quivers-0.53.2-cp314-cp314-macosx_11_0_arm64.whl

Download URL quivers-0.53.2-cp314-cp314-macosx_11_0_arm64.whl
Size 7.4 MB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
9d0659ec982cb0e5bd9210900567f34c1283a5bf962fd920ece4ffc8d11e96cd
BLAKE2b-256 checksum
How to use checksums
ccb6b689f58a8fea1a0ca32ac3b4ece93dd441c1eed40f39c6aa10b89951a4d8
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 12, 2026.

Transparency log

Security for quivers 0.53.2

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

All 4 files in this release have been uploaded with provenance metadata.

Select from 4 files

Attestation for quivers-0.53.2.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 12, 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.

Release history Release notifications | RSS feed

This release

0.53.2 This release

4 release files Full provenance

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