AGENT SKILL

mcmc-and-prediction

Run Pyro HMC/NUTS/MCMC diagnostics and prior/posterior predictive sampling workflows.

License 许可
Apache-2.0
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
mcmc-and-prediction
license
Apache 2.0
metadata
{ "disco-role": "operating" }
description
Run Pyro HMC/NUTS/MCMC diagnostics and prior/posterior predictive sampling workflows.
disable-model-invocation
true

02 资源文件 4

03 SKILL.md 正文

MCMC And Prediction

Use this sub-skill when the user is running, tuning, or debugging Pyro Hamiltonian Monte Carlo workflows (NUTS, HMC, MCMC.run(), get_samples(), summary(), diagnostics()) or drawing prior/posterior predictive samples with Predictive, WeighedPredictive, or MHResampler.

Route First

  • For NUTS/HMC setup, warmup/sample/chain choices, constrained-site initialization, transforms, diagnostics, and the eight-schools pattern, read references/mcmc-workflows.md.
  • For prior predictive, posterior predictive from MCMC samples, deterministic and observed return sites, sample shapes, guide-based predictive, weighted predictive, and resampling, read references/prediction-workflows.md.
  • For divergences, invalid initial parameters/support, max tree depth, multiprocessing chains, memory, discrete latent variables, progress bars, JIT, and predictive shape surprises, read references/troubleshooting.md.
  • To confirm that a small self-contained CPU NUTS workflow runs in the active package environment, run scripts/eight_schools_mcmc_smoke.py. Start with python scripts/eight_schools_mcmc_smoke.py --help; use --disable-progbar in non-interactive logs.

Best-Fit Tasks

Use this sub-skill for requests like:

  • "run NUTS/HMC on this Pyro model";
  • "choose num_samples, warmup_steps, num_chains, or target_accept_prob";
  • "initialize a positive/simplex/bounded latent site for MCMC";
  • "read mcmc.summary() or mcmc.diagnostics() and fix divergences";
  • "draw posterior predictive samples for observations or deterministic sites";
  • "use Predictive with MCMC samples, an SVI guide, weighted samples, or MHResampler".

Boundaries And Reroutes

  • Model primitives, pyro.sample, pyro.param, pyro.plate, observations, pyro.deterministic, seeds, and parameter-store basics: route to ../modeling-basics/.
  • Distribution choice, support constraints, .to_event(), and detailed batch/event/plate shape algebra: route to ../distributions-and-shapes/.
  • SVI training, ELBO choice, autoguides, optimizers, and guide fitting before guide-based predictive: route to ../svi-and-autoguides/.
  • Handler ordering for condition, replay, trace, block, masking/scaling, config_enumerate, infer_discrete, and enumeration dimension allocation: route to ../effect-handlers-and-enumeration/.
  • Long domain examples such as epidemiological HMC, neural transport HMC, or optional contrib integrations should be treated as reference patterns, not as required runtime scripts. Optional CUDA, funsor, Horovod, Lightning, Graphviz, torchvision, pandas, and scanpy support is unverified in the minimum runtime.

High-Value Checks Before Answering

  1. Confirm the model has continuous latent state for HMC/NUTS; discrete latent sites must be observed, enumerated/marginalized correctly, or rerouted.
  2. Keep validation on while debugging: use MCMC(..., disable_validation=False) and fix support/shape errors before tuning sampler parameters.
  3. Use constrained values with init_strategy=init_to_value(...); use unconstrained tensors only when explicitly passing initial_params.
  4. Inspect mcmc.diagnostics() for divergences, acceptance rate, n_eff, and r_hat; do not judge convergence from a tiny smoke run.
  5. For prediction, decide whether each site should be conditioned from posterior_samples, sampled anew, or explicitly returned via return_sites.
  6. For parallel=True predictive or multi-chain MCMC, ensure model functions are plate-annotated and multiprocessing-safe before blaming Pyro internals.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-triton-opt

Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-solve

END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-skill

PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-pattern-fusion

Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-orchestrate

Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-feedback

Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).

★ 351