Become a Creator today!Start creating today - Share your story with the world!
Start for free
00:00:00
00:00:01
#157 Amortized Inference & BayesFlow in Practice, with Stefan Radev image

#157 Amortized Inference & BayesFlow in Practice, with Stefan Radev

S1 E157 · Learning Bayesian Statistics
Avatar
0 Plays13 days ago

Support & Resources
→ Support the show on Patreon
Bayesian Modeling Course (first 2 lessons free)

Our theme music is « Good Bayesian », by Baba Brinkman (feat MC Lars and Mega Ran). Check out his awesome work


Takeaways:

Q: What is simulation-based inference and what does "sim-to-real" mean?
A: Simulation-based inference (SBI) uses a mechanistic simulator as an epistemic tool: you train a neural network on a large number of labeled simulations and then deploy it on real, unlabeled data. The "sim-to-real" framing captures the key asymmetry -- your network never sees real data during training, only simulations, but it generalizes to real observations at inference time. This is the opposite of the more common "synthetic-for-ML" approach, where fake data is used purely to augment real training data.

Q: What is the amortized inference agent skill and what does it do?
A: It's an open-source AI agent skill, co-developed by Stefan and Alexandre, that teaches an AI coding agent to run a complete, state-of-the-art amortized inference workflow. Because amortized inference is recent enough that it's underrepresented in LLM training data, vanilla agents tend to get it wrong. The skill injects the right methodology: it guides the agent to set up the simulator, choose the right network architecture, run a pilot, train with appropriate diagnostics, and produce an actionable report -- without the user needing to know the details.

Q: What is calibration coverage and why should you never skip it?
A: Calibration coverage tells you whether your posterior uncertainty is honest -- whether your credible intervals actually contain the true parameter at the right frequency. A model can show poor parameter recovery yet still be well-calibrated (because it's falling back on the prior), or it can appear to recover parameters while being poorly calibrated. Running calibration diagnostics both in-sample and out-of-sample is especially revealing for hierarchical models, which often appear to underfit in-sample but generalize much better out-of-sample thanks to shrinkage.

Full takeaways here

Chapters:
00:00:00 How does amortized inference fit into the Bayesian workflow?
00:12:03 What does "sim-to-real" mean in simulation-based inference?
00:15:57 Why is amortized inference particularly suited to psychology and neuroscience?
00:21:51 What is the amortized inference agent skill?
00:39:00 What is calibration coverage and how do you interpret it?
00:41:50 How do you decide what to do next after your first training run?
00:44:53 How do actionable insights make Bayesian workflows more usable?
00:49:08 What are the unique challenges of hierarchical models in amortized inference?
01:00:51 What is the current state of BayesFlow's support for hierarchical models?
01:05:00 What are the main failure modes of amortized inference and how do you handle model misspecification?

Thank you to my Patrons for making this episode possible!

Links from the show

Recommended