Papers › Can Transformers Learn Full Bayesian Inference in Context?

Can Transformers Learn Full Bayesian Inference in Context?

28 Jan 2025arXiv:2501.16825archive 2025-07-28

Arik Reuter, Tim G. J. Rudner, Vincent Fortuin, David Rügamer

Transformers have emerged as the dominant architecture in the field of deep learning, with a broad range of applications and remarkable in-context learning (ICL) capabilities. While not yet fully understood, ICL has already proved to be an intriguing phenomenon, allowing transformers to learn in context -- without requiring further training. In this paper, we further advance the understanding of ICL by demonstrating that transformers can perform full Bayesian inference for commonly used statistical models in context. More specifically, we introduce a general framework that builds on ideas from prior fitted networks and continuous normalizing flows which enables us to infer complex posterior distributions for methods such as generalized linear models and latent factor models. Extensive experiments on real-world datasets demonstrate that our ICL approach yields posterior samples that are similar in quality to state-of-the-art MCMC or variational inference methods not operating in context.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2501.16825")

Code

Syntology Ran 12 of 16 code samples harvested from 1 repository linked to this paper; 4 have no recorded run. Of those that ran: 1 ran · violated contract; 11 ran with no contract checked.

By repository: official repository: 16 samples from 1 repository, 12 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

arikreuter/icl_for_full_bayesian_inference officialmentioned in paperjax report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

16 samples harvested; 12 ran; 0 honoured the contract we drafted; 4 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · violated contract
11ran
4unverified

Licence: 16 of the 16 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from arikreuter/icl_for_full_bayesian_inference. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

ConditionalBatchNorm arikreuter/icl_for_full_bayesian_inference/LinearRegression/Models/Transformer_CNF.py official repository ran no licence file found · pointer only · 3672477c19ee824f · report
ConditionalLayerNorm arikreuter/icl_for_full_bayesian_inference/LinearRegression/Models/Transformer_CNF.py official repository ran no licence file found · pointer only · 7334dfff7c15eb8c · report
DecoderBlockConditional arikreuter/icl_for_full_bayesian_inference/LinearRegression/Models/Transformer_CNF.py official repository ran no licence file found · pointer only · 8746a274af2a0929 · report
EncoderBlockConditional arikreuter/icl_for_full_bayesian_inference/LinearRegression/Models/Transformer_CNF.py official repository ran no licence file found · pointer only · cf23a8049b4ef088 · report
Linear_block arikreuter/icl_for_full_bayesian_inference/LinearRegression/Models/Transformer_CNF.py official repository ran fingerprinted no licence file found · pointer only · 8f40ac592744ccad · report
Linear_skip_block arikreuter/icl_for_full_bayesian_inference/LinearRegression/Models/Transformer_CNF.py official repository ran fingerprinted no licence file found · pointer only · 02ac666b2ac3c6a1 · report
MLP arikreuter/icl_for_full_bayesian_inference/LinearRegression/Models/Transformer_CNF.py official repository ran fingerprinted no licence file found · pointer only · 67f27ed04e3e9672 · report
MLPConditional arikreuter/icl_for_full_bayesian_inference/LinearRegression/Models/Transformer_CNF.py official repository ran no licence file found · pointer only · 19ec286a9acca6f1 · report
PositionalEncoding arikreuter/icl_for_full_bayesian_inference/LinearRegression/Models/Transformer_CNF.py official repository ran no licence file found · pointer only · 870643f6c036b79d · report
PositionwiseFeedForward arikreuter/icl_for_full_bayesian_inference/LinearRegression/Models/Transformer_CNF.py official repository ran fingerprinted no licence file found · pointer only · c8a3be75f1c48e47 · report
Rescale arikreuter/icl_for_full_bayesian_inference/LinearRegression/Models/Transformer_CNF.py official repository ran no licence file found · pointer only · a5253f7ea1d3f236 · report
string2bool arikreuter/icl_for_full_bayesian_inference/Experiments/RunExperiments/RunExperiments_LFM.py official repository ran · violated contract no licence file found · pointer only · c838b52183d58395 · report
TransformerCNF arikreuter/icl_for_full_bayesian_inference/LinearRegression/Models/Transformer_CNF.py official repository unverified no licence file found · pointer only · 76c46a50e69c7c97 · report
TransformerConditional arikreuter/icl_for_full_bayesian_inference/LinearRegression/Models/Transformer_CNF.py official repository unverified no licence file found · pointer only · 420e50cb6931a973 · report
TransformerDecoderConditional arikreuter/icl_for_full_bayesian_inference/LinearRegression/Models/Transformer_CNF.py official repository unverified no licence file found · pointer only · 6a80680a5be99f66 · report
TransformerEncoderConditional arikreuter/icl_for_full_bayesian_inference/LinearRegression/Models/Transformer_CNF.py official repository unverified no licence file found · pointer only · ad9007e5c53a09ac · report

Tasks

Bayesian InferenceIn-Context LearningVariational Inference

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

Normalizing FlowsVariational Inference

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections