tpt-augur
RustA hardware-accelerated probabilistic programming language — write variables as distributions, not values, and run built-in Bayesian inference (HMC, VI, particle filter, MH) at native speed.
Languages
TPT Augur
A hardware-accelerated probabilistic programming language.
Augur lets you write variables as probability distributions instead of static values and runs massive parallel posterior sampling at native speed. It compiles a small, distribution-native language down to a typed model and executes it with several built-in Bayesian inference engines.
let mu ~ Normal(0, 1)
observe Normal(mu, 1) = 0.5
The posterior of mu is Normal(0.25, 0.5) — Augur recovers it automatically.
Status
This repository is the compiler, runtime, standard-library, package manifest,
and CLI for Augur. It is self-contained and builds with a plain Rust
toolchain — no external tpt-gpu checkout is required to use the language or
run inference on CPU. Hardware offload, LSP tooling, and TPT-ecosystem
integrations (Keystone DB, Locus) are tracked in TODO.md and the
design spec.
Features
- Distribution-native syntax —
let x ~ Normal(0, 1); uncertainty propagates automatically through+,-,*,/and nested calls. - Built-in inference engines, selected automatically from model topology
or forced with an explicit override:
- Hamiltonian Monte Carlo (
hmc) - Mean-field variational inference (
vi) - Bootstrap particle filter / SMC (
pf) - Random-walk Metropolis–Hastings (
mh)
- Hamiltonian Monte Carlo (
- Error-tolerant parser — partially-broken programs still yield a usable parse tree with diagnostics, which powers the formatter and future editor tooling.
- Type-checker & static analysis — undeclared variables, arity mismatches, and degenerate distribution parameters are caught up front.
- Mixed deterministic / probabilistic control flow — standard
if/elsegates observations and priors safely alongside stochastic logic.
Quickstart
# Build the workspace
cargo build --workspace
# Type-check a model
cargo run -p tpt-tpt-augur-cli -- check examples/beta_binomial.augur
# Run inference (engine auto-selected)
cargo run -p tpt-tpt-augur-cli -- run examples/beta_binomial.augur
# Pretty-print / canonicalise a model
cargo run -p tpt-tpt-augur-cli -- fmt examples/beta_binomial.augur
# Read a model from stdin and infer
cargo run -p tpt-tpt-augur-cli -- repl < examples/normal_mean.augur
Language
| Construct | Meaning |
|---|---|
let name ~ Dist(a, b) | A latent random variable with a prior. |
let name = expr | A deterministic binding (carries the uncertainty of its inputs). |
observe Dist(...) = value | A likelihood / conditioning statement. |
if cond { ... } else { ... } | Deterministic control flow gating enclosed items. |
Supported distributions: Normal, HalfNormal, Beta, Gamma, Uniform,
Exponential, Binomial, Poisson, Bernoulli.
CLI
| Command | Description |
|---|---|
augur run <file> | Parse, type-check, and run inference. Flags: -e/--engine, -n/--samples, -c/--chains, --warmup, --seed. |
augur check <file> | Type-check and report diagnostics without sampling. |
augur fmt <file> | Emit canonical formatting. |
augur repl | Read a model from stdin and infer with the auto-selected engine. |
Workspace layout
| Crate | Role |
|---|---|
compiler/tpt-tpt-augur-frontend | Lexer, AST, error-tolerant parser, formatter. |
compiler/tpt-tpt-augur-ir | Typed IR: lowering, type-checking, uncertainty propagation. |
runtime/tpt-tpt-augur-runtime | Inference engines (HMC, VI, PF, MH) and posterior summaries. |
stdlib/tpt-tpt-augur-std | Concrete distributions with log-densities and samplers. |
pkg/tpt-tpt-augur-pkg | Augur package manifest format (Augur.toml). |
tools/tpt-tpt-augur-cli | The augur command-line interface. |
Examples
See examples/:
beta_binomial.augur— Beta–Binomial conjugacy (posterior mean ≈ 0.667).normal_mean.augur— Normal–Normal conjugacy.bayesian_regression.augur— Bayesian linear regression.ar1_timeseries.augur— AR(1) time-series filtering.
Run any of them with cargo run -p tpt-tpt-augur-cli -- run examples/<file>.
Testing
cargo test --workspace
The runtime test suite validates each engine against known closed-form posteriors (Normal–Normal, Beta–Binomial).
License
Dual-licensed under MIT or Apache License 2.0, at your option. See LICENSE-MIT and LICENSE-APACHE.