AutoStan: Autonomous Bayesian Model Improvement via Predictive Feedback

arXiv cs.LG / 3/31/2026

📰 NewsSignals & Early TrendsIdeas & Deep AnalysisModels & Research

Key Points

  • AutoStanは、CLI上のコーディングエージェントがStanで書かれたベイズモデルを自動で生成し、MCMC実行を通じて反復的に改善するフレームワークである。
  • 改善の判断は、持ち出しデータでのNLPD(負の対数予測密度)に加え、発散・R-hat・有効サンプルサイズなどのサンプラ診断という2系統のフィードバックを組み合わせて行う。
  • 合成回帰(外れ値あり)では、単純な線形回帰からStudent-tの頑健化、非線形かつ異分散な構造、汚染混合(contamination mixture)へと段階的に進み、解釈可能なままTabPFNに匹敵または上回る性能を示した。
  • 他の4つの実験でも、階層的部分プーリング、相関ランダム効果を伴う変化する傾きモデル、サッカーの攻守のPoissonモデルなど、多様なベイズモデリングに対して同一メカニズムが有効に働いた。

Abstract

We present AutoStan, a framework in which a command-line interface (CLI) coding agent autonomously builds and iteratively improves Bayesian models written in Stan. The agent operates in a loop, writing a Stan model file, executing MCMC sampling, then deciding whether to keep or revert each change based on two complementary feedback signals: the negative log predictive density (NLPD) on held-out data and the sampler's own diagnostics (divergences, R-hat, effective sample size). We evaluate AutoStan on five datasets with diverse modeling structures. On a synthetic regression dataset with outliers, the agent progresses from naive linear regression to a model with Student-t robustness, nonlinear heteroscedastic structure, and an explicit contamination mixture, matching or outperforming TabPFN, a state-of-the-art black-box method, while remaining fully interpretable. Across four additional experiments, the same mechanism discovers hierarchical partial pooling, varying-slope models with correlated random effects, and a Poisson attack/defense model for soccer. No search algorithm, critic module, or domain-specific instructions are needed. This is, to our knowledge, the first demonstration that a CLI coding agent can autonomously write and iteratively improve Stan code for diverse Bayesian modeling problems.