What does a Bayes-filtered transformer believe? A predictive Monte Carlo approach
Abstract
A \emph{Bayes-filtered transformer} (BFT) is a transformer trained on sequences that are generated in two steps: first a latent task is drawn from a prior, then observations are drawn conditional on that task. Trained under autoregressive log loss, the BFT's next-token prediction, in the idealized limit, \emph{is} the Bayesian posterior predictive distribution (PPD) induced by that prior and that conditional law. In practice the trained BFT is only an approximation of this ideal PPD, raising an interpretive question: what prior and posterior over the latent task has the trained BFT actually internalized? Existing work answers this question by comparing the trained BFT's predictions against the predictions of various ``reference'' posteriors, each standing in for a different candidate algorithm or computation the BFT might be implementing. This prediction-space comparison is fragile: different posteriors can share the same posterior-mean predictions. We use \emph{predictive Monte Carlo} (PMC) as an interpretability tool for BFTs: using only next-token generation, we obtain with PMC an approximation to the implicit prior and posterior over the latent task, answering the interpretive question directly in latent space. We apply PMC to three stylized task families spanning 0-Markov and 1-Markov exchangeability. We reproduce previously reported phenomena in latent space and show that comparisons of PMC priors and posteriors can reveal patterns in model behavior that the corresponding prediction-space comparisons miss. Code is available at \url{https://github.com/afiq-aswadi/bft-pmc}.