Examples Gallery¶
.qvr programs spanning probabilistic regressions, latent-variable
models, state-space models, language models, encoder-decoder networks,
weighted deductions, and QIEC computations. Most full pages include a
## Try it section; CI executes runnable documentation blocks and skips blocks
marked as illustrative. Pages with current model limitations identify them
directly.
The measured transpilation corpus lives under docs/examples/source/. Mixed
QIEC case studies whose purpose is reference-machine execution live under
docs/examples/qiec/, so adding one does not silently expand the promised
backend matrix.
Language feature map¶
Use this table when you want an example of a language feature rather than a particular statistical family.
| Feature | Primary example | What to inspect |
|---|---|---|
| indexed families, authored handlers, computation calls, parser search, structural attachments, grouped marginalization | Amortized Bayesian Semantics | mixed entry list, effect trace, target-capability diagnostics |
| schema and bundle elaboration, generated search and weight effects | Schema-Bundled Chart Parser | classic chart against run_deduction |
| direct deduction, learned rule weights, program-to-deduction call | PCFG and CCG | inside weights, parameter store, scored parser call |
| structural signature, encoder, decoder, loss, typed PyTorch attachments | Term Autoencoder | Program.run("reconstruct", term) and autograd |
| grouped and fibred exact marginalization | Latent Dirichlet Allocation | over, via, and the per-group reduction |
| program templates and subprogram calls | Parametric Partial Pooling | static object arguments, prefixed sites, labeled tuple return |
| open sequence extent and recursive scan lowering | Vanilla RNN LM | generated scan step and trajectory site addresses |
| network kernel computation | Bayesian Neural Network | MLP parameter source and reference-machine boundary |
| measure-algebra families | Amortized Bayesian Semantics | heterogeneous Mixture value used for scoring and prediction |
| finite collection traversal, indexed effects, nested computation calls, lexical uncertainty | Lexical-Uncertainty RSA | map/fold normalization, traverse over worlds and lexica, lexical marginalization, observed-or-predicted interpretation |
The generated transpilation support matrix records whether each measured source reaches each backend. A successful reference-machine run and a successful transpile are distinct claims; the examples state both where they differ.
Integrated QIEC case study¶
- Amortized Bayesian Semantics: a learnable categorial parser, structural logical-form autoencoder, indexed missing-data computation with a contamination measure, authored robustification handler, and hierarchical model with grouped exact marginalization.
- Lexical-Uncertainty RSA: the specificity model of Bergen, Levy, and Goodman (2016), with a literal listener nested inside a pragmatic speaker and a listener that traverses and marginalizes over three lexica.
Regressions¶
- Bayesian Linear Regression: Normal likelihood with Normal-prior weights.
- Beta Regression: Beta-distributed response with logit link.
- Gamma Regression: Gamma response with a log-shape predictor and unit rate.
- Horseshoe Regression: sparse linear regression under the horseshoe prior.
- Negative Binomial Regression: overdispersed count response.
- Continuous-gate Poisson Regression: differentiable relaxation of a zero-inflation gate.
- Item Response Theory (2PL): Rasch-style logistic IRT with item difficulty and discrimination.
- Weibull Survival: uncensored Weibull event-time regression; censored rows require an explicit survival-score term.
Latent-variable models¶
- Isotropic Bayesian Factor Model: low-rank factors and loadings with one shared observation scale.
- Probabilistic PCA: the isotropic factor model interpreted through its principal-component solution.
- Latent Dirichlet Allocation: topic model with Dirichlet priors on per-document and per-topic distributions.
- Gaussian Mixture Model: finite mixture with grouped marginalization over the cluster label.
- Latent Decoder and Encoder Paths: prior-decoder program plus a separately exported encoder-decoder path; the current SVI block does not use the encoder as its guide.
- Bayesian Neural Network: nonlinear regression through an MLP-parameterised Normal kernel, made Bayesian after lifting priors over its weights.
- Parametric Partial Pooling: random effects from a parametric program template, with a labeled return tuple, a score-step sum-to-zero factor, and export selection.
- Probabilistic Matrix Factorization: low-rank Bayesian completion of a sparse rating matrix.
- Bilinear Tensor Contraction: neural-tensor-layer scoring of predicate-argument pairs via an operadic three-way contraction.
State-space and time-series models¶
- AR(1): first-order autoregressive Normal scalar series.
- Changepoint Model: piecewise-constant means with a sampled change point.
- Conditionally Factorized Stochastic Volatility: AR(1) log-volatility conditionals with externally supplied lag values.
- Gaussian-Kernel SSM: learned transition, emission, and filtering kernels; not a closed-form Kalman filter.
- Finite-State Path Composition: product-fuzzy transition and emission relations, plus a partial discrete-program sketch.
- Continuous-State Sequence Model: Gaussian transition, emission, and separately learned recognition kernels.
- Deep Markov Model: nonlinear-MLP transition and emission cells.
Language models¶
- Vanilla RNN LM: single-cell Elman RNN scored by a Categorical head.
- GRU-shaped LM: stochastic reset and update gates with a simplified candidate update.
- LSTM-shaped LM: stochastic gates without a separately threaded cell state.
- Dual-RNN Masked-Token Model: two left-to-right scans combined for a masked-token target.
- Transformer-shaped LM: parallel MLP-normal branches with a Categorical head; no dot-product self-attention or causal mask.
Encoder-decoder and structured outputs¶
- Sequence-to-Sequence: parallel encoder-decoder branches joined by a learned merge, without attention.
- Tree-Structured Score Tensor: recursive additive scores over a parametric tree.
Weighted deductions¶
- PCFG: probabilistic context-free grammar with learnable production weights.
- CCG: combinatory categorial grammar with forward / backward application and composition.
- Type-Logical Grammar (Lambek): Lambek calculus with residuated slashes and tensor.
- PMCFG: probabilistic multiple context-free grammar with WH-movement via a rank-2 non-terminal.
- Schema-Bundled Chart Parser: pattern-polymorphic rule schemas bundled into a differentiable CKY chart parser.
- Term Autoencoder: a signature, encoder, decoder, and loss compressing typed lambda terms.
- Multimodal TLG: Lambek calculus extended with diamond and box modalities.
- Custom Sequent Rules: user-defined sequents over a free residuated category.
- Quantifier Scope: continuation-monad lift for generalized quantifiers.
- Montague NLI: Montague-style lambda-term LFs plus modus-ponens NLI prover.