# Can Transformers Learn Full Bayesian Inference in Context?

트랜스포머는 문맥 내에서 완전한 베이즈 추론을 학습할 수 있는가?

Arik Reuter, Tim G. J. Rudner, Vincent Fortuin, David Rügamer · arXiv · 2025년 1월 28일

- **연구 문제** 복잡하고 고차원인 사후분포를 샘플링이나 변분추론으로 얻는 일은 느리거나 근사 오차가 크다는 문제가 있습니다.
- **연구 방법** 합성 데이터 결합분포로 학습한 트랜스포머 인코더와 흐름 매칭 디코더로 문맥에서 사후 샘플을 생성합니다.
- **주요 결과** GLM·요인분석·GMM 실험에서 ICL 샘플은 여러 지표에서 VI보다 HMC 기준에 가까운 결과를 보였으나 차원이 커지면 이점이 줄었습니다.

## 풀고자 하는 문제: 복잡한 사후분포의 빠른 샘플링

베이즈 추론에서 사후분포 P(z\|x) 전체를 얻는 일은 고차원이고 연속적인 잠재변수에서 특히 어렵습니다. 샘플링 기반 방법인 HMC는 정확하지만 느리고, 변분추론은 빠르지만 정규 분포 같은 변분 분포 가정 때문에 근사 오차가 생깁니다. 이 논문은 대형 언어 모델의 문맥 학습(ICL)처럼, 모델이 가중치 갱신 없이 입력 데이터 x를 문맥으로 받아 사후 샘플을 생성하도록 만들 수 있는지 묻습니다. 이 질문은 GLM, 요인분석, 가우시안 혼합 모델이라는 잠재변수 모델 세 계열에 대해 검증됩니다.

## 핵심 아이디어: 결합분포 샘플로 학습하는 조건부 흐름 매칭

제안 방법은 생성 모델에서 합성 데이터 쌍 (x, z)를 결합분포 P(x,z)에서 뽑아 학습 데이터로 씁니다. 인코더는 TabPFN과 비슷한 트랜스포머로 데이터셋 x를 처리하고, 디코더는 adaLN으로 시간 t를 조건으로 받아 벡터장을 출력합니다. 학습은 보간 상태 (1−ωt)z(0)+tz(1)에서 벡터장을 맞추는 흐름 매칭 손실로 이루어집니다. 실행 시점에는 기저분포의 표본을 시작점으로 학습된 벡터장을 ODE 솔버로 적분하여, 주어진 x에 대한 사후 샘플을 얻습니다.

## 학습 목표와 명제: 기대 발산과 결합분포 목적함수의 연결

이 논문은 사후 근사의 기대 발산 R\_θ를 직접 최소화하는 대신, 결합분포에서 샘플링하는 목적함수 ~R\_θ로 바꿉니다. 명제 1은 발산이 d(Q,P)=∫γ(Q)dP 형태의 범함수일 때 R\_θ와 ~R\_θ가 같아진다고 명시합니다. 전방 KL 발산은 이 형태에 해당하며, 그 경우 손실은 −log q\_θ(z\|x)의 상수 차이로 나타납니다. 흐름 매칭 목적함수에서는 보간 경로 γ\_t(z(1)\|z(0))=(1−ωt)z(0)+tz(1)와 가우시안 최적수송 경로가 쓰이며, ω는 1−σ\_min으로 정의됩니다.

## GLM 실험: 합성 데이터와 실제 데이터에서의 비교

GLM 실험은 일곱 가지 시나리오에서 ICL, 라플라스 근사, 여러 VI 방법을 HMC 또는 해석해 기준과 비교합니다. 합성 데이터에서 ICL의 평균 C2ST는 0.657로 보고되며, MMD와 W2에서도 VI보다 낮은 값을 보입니다. 실제 데이터 17개 중 여러 시나리오에서는 ICL이 HMC와 유사한 결과를 보입니다. 특히 감마 사전분포처럼 정규 분포에서 벗어난 사후분포에서 ICL이 VI보다 나은 결과를 보고합니다.

![Table 1: Summarized results for GLMs. Average perfor- mance of VI methods and our ICL approach on 50 synthetic and 17 real-world datasets across 7 different GL…](https://refivu.com/papers/20eca8da-4cd3-457c-9a32-dcda3c90a2b6/figures/figure-b3b08a192f3cb7631b0e1a97744dd46a.png?thumb=512)

**Table 1** : Summarized results for GLMs. Average perfor- mance of VI methods and our ICL approach on 50 synthetic and 17 real-world datasets across 7 different GLM scenarios. Comparison to the analytical solution when available and HMC otherwise. Lower is better for all metrics. The best average result is marked in bold.

[원문](https://arxiv.org/abs/2501.16825v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Arik Reuter, Tim G. J. Rudner, Vincent Fortuin, David Rügamer · Can Transformers Learn Full Bayesian Inference in Context? · 원문 그림 인용 · 원본 PDF 7쪽에서 그림 영역을 추출했습니다.

![Table 2: Results for GLMs. Real-world Evaluation on 17 datasets: Linear regression with a gamma prior on the coef- ficients β, and an inverse gamma prior on th…](https://refivu.com/papers/20eca8da-4cd3-457c-9a32-dcda3c90a2b6/figures/figure-955120bbdb3992563be0878a968b7dc8.png?thumb=512)

**Table 2** : Results for GLMs. Real-world Evaluation on 17 datasets: Linear regression with a gamma prior on the coef- ficients β, and an inverse gamma prior on the variance σ2 of the responses (scenario 5). Comparison to HMC samples. All results within two standard errors of the best average result are marked in bold.

[원문](https://arxiv.org/abs/2501.16825v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Arik Reuter, Tim G. J. Rudner, Vincent Fortuin, David Rügamer · Can Transformers Learn Full Bayesian Inference in Context? · 원문 그림 인용 · 원본 PDF 7쪽에서 그림 영역을 추출했습니다.

![Table 5: Distribution of variables for the considered GLM scenarios](https://refivu.com/papers/20eca8da-4cd3-457c-9a32-dcda3c90a2b6/figures/figure-b7674c337cb5a5fe7a3e939f6f52c602.png?thumb=512)

**Table 5** : Distribution of variables for the considered GLM scenarios.

[원문](https://arxiv.org/abs/2501.16825v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Arik Reuter, Tim G. J. Rudner, Vincent Fortuin, David Rügamer · Can Transformers Learn Full Bayesian Inference in Context? · 원문 그림 인용 · 원본 PDF 16쪽에서 그림 영역을 추출했습니다.

![Figure 7: Density plots for first three the marginals of the posterior in a GLM with a gamma prior on the coefficients β, and an inverse gamma prior on the var…](https://refivu.com/papers/20eca8da-4cd3-457c-9a32-dcda3c90a2b6/figures/figure-7c4d929699f065cda2d558911257aca2.png?thumb=512)

**Figure 7** : Density plots for first three the marginals of the posterior in a GLM with a gamma prior on the coefficients β, and an inverse gamma prior on the variance σ2 of the responses. The data is part of the Miami housing 2016 dataset.

[원문](https://arxiv.org/abs/2501.16825v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Arik Reuter, Tim G. J. Rudner, Vincent Fortuin, David Rügamer · Can Transformers Learn Full Bayesian Inference in Context? · 원문 그림 인용 · 원본 PDF 24쪽에서 그림 영역을 추출했습니다.

![Table 12: Generalized Linear Models: Evaluation on 50 synthetic and 17 real-world datasets for seven different scenarios. All results within two standard error…](https://refivu.com/papers/20eca8da-4cd3-457c-9a32-dcda3c90a2b6/figures/figure-e79566e4c2747989beefc8c0f7b1e2ff.png?thumb=512)

**Table 12** : Generalized Linear Models: Evaluation on 50 synthetic and 17 real-world datasets for seven different scenarios. All results within two standard errors of the best average result for each scenario are marked in bold.

[원문](https://arxiv.org/abs/2501.16825v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Arik Reuter, Tim G. J. Rudner, Vincent Fortuin, David Rügamer · Can Transformers Learn Full Bayesian Inference in Context? · 원문 그림 인용 · 원본 PDF 25쪽에서 그림 영역을 추출했습니다.

## 요인분석과 GMM 실험: 지표별 해석 차이

요인분석에서 ICL은 합성 데이터의 평균 C2ST 0.568로 VI보다 낮은 값을 보고합니다. 실제 데이터에서는 C2ST와 MMD가 ICL을 지지하지만 W2는 더 높게 나타나, 저자들은 이를 경험적 W2 계산의 수치 문제 가능성으로 해석합니다. 가우시안 혼합 모델은 이산 할당과 다봉 사후분포 때문에 더 어려우며, 여기서 C2ST는 여러 방법에서 거의 포화되어 구분력이 약합니다. 대신 합성 데이터의 MMD와 W2에서 ICL이 VI보다 낮은 값을 보고합니다.

![Table 3: Summarized results for FA. Average performance of VI methods and our ICL approach on 50 synthetic and 17 real-world datasets across 6 different FA sce…](https://refivu.com/papers/20eca8da-4cd3-457c-9a32-dcda3c90a2b6/figures/figure-0527808739dcd28c0eb8a9d0f29adfd4.png?thumb=512)

**Table 3** : Summarized results for FA. Average performance of VI methods and our ICL approach on 50 synthetic and 17 real-world datasets across 6 different FA scenarios. Com- parison to HMC samples. Lower is better for all metrics. The best average result is marked in bold.

[원문](https://arxiv.org/abs/2501.16825v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Arik Reuter, Tim G. J. Rudner, Vincent Fortuin, David Rügamer · Can Transformers Learn Full Bayesian Inference in Context? · 원문 그림 인용 · 원본 PDF 8쪽에서 그림 영역을 추출했습니다.

![Table 4: Summarized Results for GMMs. Average perfor- mance of VI methods and our ICL approach on 50 synthetic and 17 real-world datasets across 4 different GM…](https://refivu.com/papers/20eca8da-4cd3-457c-9a32-dcda3c90a2b6/figures/figure-8bfbcd3b74423e3c5d4880a73a49fb06.png?thumb=512)

**Table 4** : Summarized Results for GMMs. Average perfor- mance of VI methods and our ICL approach on 50 synthetic and 17 real-world datasets across 4 different GMM scenar- ios. Comparison to HMC samples in all cases. The best average result is marked in bold.

[원문](https://arxiv.org/abs/2501.16825v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Arik Reuter, Tim G. J. Rudner, Vincent Fortuin, David Rügamer · Can Transformers Learn Full Bayesian Inference in Context? · 원문 그림 인용 · 원본 PDF 8쪽에서 그림 영역을 추출했습니다.

![Figure 3: Density plots for the marginals of the posterior for GMM scenario 1. Comparison to HMC samples on a synthetic dataset whose density is depicted as a…](https://refivu.com/papers/20eca8da-4cd3-457c-9a32-dcda3c90a2b6/figures/figure-aeb8dee8288e767840c0f432ff3eca7a.png?thumb=512)

**Figure 3** : Density plots for the marginals of the posterior for GMM scenario 1. Comparison to HMC samples on a synthetic dataset whose density is depicted as a dotted line. Only the marginals of the first two components of the mean and the variance are shown. The density of the posterior obtained via HMC is depicted as a dotted line. While the ICL method aligns with the gold-standard HMC, the VI methods have a lower level of agreement and exhibit mode- seeking behaviour.

[원문](https://arxiv.org/abs/2501.16825v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Arik Reuter, Tim G. J. Rudner, Vincent Fortuin, David Rügamer · Can Transformers Learn Full Bayesian Inference in Context? · 원문 그림 인용 · 원본 PDF 9쪽에서 그림 영역을 추출했습니다.

![Table 6: Distribution and dimensionalitites of variables for the considered FA scenarios](https://refivu.com/papers/20eca8da-4cd3-457c-9a32-dcda3c90a2b6/figures/figure-b8054839ce3a827d74e6b5e77c35eb1f.png?thumb=512)

**Table 6** : Distribution and dimensionalitites of variables for the considered FA scenarios.

[원문](https://arxiv.org/abs/2501.16825v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Arik Reuter, Tim G. J. Rudner, Vincent Fortuin, David Rügamer · Can Transformers Learn Full Bayesian Inference in Context? · 원문 그림 인용 · 원본 PDF 16쪽에서 그림 영역을 추출했습니다.

![Table 7: Distribution and dimensionalitites of variables for the considered GMM scenarios](https://refivu.com/papers/20eca8da-4cd3-457c-9a32-dcda3c90a2b6/figures/figure-846b28ab740ab1ab8656607f08fd56ad.png?thumb=512)

**Table 7** : Distribution and dimensionalitites of variables for the considered GMM scenarios.

[원문](https://arxiv.org/abs/2501.16825v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Arik Reuter, Tim G. J. Rudner, Vincent Fortuin, David Rügamer · Can Transformers Learn Full Bayesian Inference in Context? · 원문 그림 인용 · 원본 PDF 17쪽에서 그림 영역을 추출했습니다.

![Table 13: Factor Analysis: Evaluation on 50 synthetic and 17 real-world datasets for six different scenarios. All results within two standard errors of the bes…](https://refivu.com/papers/20eca8da-4cd3-457c-9a32-dcda3c90a2b6/figures/figure-45b9a0ebde85ccdacf9dd3ed42e4c0a4.png?thumb=512)

**Table 13** : Factor Analysis: Evaluation on 50 synthetic and 17 real-world datasets for six different scenarios. All results within two standard errors of the best average result for each scenario are marked in bold.

[원문](https://arxiv.org/abs/2501.16825v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Arik Reuter, Tim G. J. Rudner, Vincent Fortuin, David Rügamer · Can Transformers Learn Full Bayesian Inference in Context? · 원문 그림 인용 · 원본 PDF 26쪽에서 그림 영역을 추출했습니다.

![Table 14: Gaussian Mixture Models: Evaluation on 50 synthetic and 17 real-world datasets for six different scenarios. All results within two standard errors of…](https://refivu.com/papers/20eca8da-4cd3-457c-9a32-dcda3c90a2b6/figures/figure-cc8b39e4b996cc1b1daad5b99fc73a1d.png?thumb=512)

**Table 14** : Gaussian Mixture Models: Evaluation on 50 synthetic and 17 real-world datasets for six different scenarios. All results within two standard errors of the best average result for each scenario are marked in bold.

[원문](https://arxiv.org/abs/2501.16825v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Arik Reuter, Tim G. J. Rudner, Vincent Fortuin, David Rügamer · Can Transformers Learn Full Bayesian Inference in Context? · 원문 그림 인용 · 원본 PDF 27쪽에서 그림 영역을 추출했습니다.

## 절제 실험과 적용 범위

절제 실험에서 흐름 매칭을 가우시안 근사로 바꾸면 성능이 크게 떨어진다고 보고됩니다. 확산 목적함수는 OT 경로 대비 여러 시나리오에서 C2ST가 높게 나타나며, 트랜스포머 인코더는 MLP 인코더보다 일관되게 낮은 값을 보입니다. 차원 확장 실험에서는 ICL의 이점이 차원이 커질수록 줄어들고, 20차원과 50차원에서는 여러 지표가 방법 간 차이를 명확히 구분하지 못합니다. 사전훈련에는 많은 계산 자원이 필요하며, 훈련 데이터 분포가 실제와 다르면 실패할 수 있다고 논의됩니다.

![Table 18: Generalized Linear Models: Comparing the in-context learner with a Gaussian approximation, fitted via the forward KL-divergence, to the proposed flow…](https://refivu.com/papers/20eca8da-4cd3-457c-9a32-dcda3c90a2b6/figures/figure-f3870204c5dff760c2a62e6674e611aa.png?thumb=512)

**Table 18** : Generalized Linear Models: Comparing the in-context learner with a Gaussian approximation, fitted via the forward KL-divergence, to the proposed flow matching method. Evaluation on 50 synthetic and 17 real-world datasets for seven different scenarios. If one method is by more than two standard errors better than the other, it is marked in bold. Overall, the ICL + Flow Matching method clearly outperforms the Gaussian approximation, fitted via the forward KL-divergence,: it yields significantly better results (according to the two-standard-error criterion) in 6 out of 7 scenarios on synthetic datasets and in all 7 scenarios on real-world datasets, across at least two of the three considered metrics (C2ST, MMD, or W2). In addition, the flow matching method consistently achieves lower or comparable standard errors, indicating more stable and reliable performance across datasets.

[원문](https://arxiv.org/abs/2501.16825v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Arik Reuter, Tim G. J. Rudner, Vincent Fortuin, David Rügamer · Can Transformers Learn Full Bayesian Inference in Context? · 원문 그림 인용 · 원본 PDF 30쪽에서 그림 영역을 추출했습니다.

![Table 19: Factor Analysis: Comparing the in-context learner with a Gaussian approximation, fitted via the forward KL- divergence, to the proposed flow matching…](https://refivu.com/papers/20eca8da-4cd3-457c-9a32-dcda3c90a2b6/figures/figure-4ca99c309e66ac39d47bc6335b087c20.png?thumb=512)

**Table 19** : Factor Analysis: Comparing the in-context learner with a Gaussian approximation, fitted via the forward KL- divergence, to the proposed flow matching method. Evaluation on 50 synthetic and 17 real-world datasets for seven different scenarios. If one method is by more than two standard errors better than the other, it is marked in bold. The flow matching approach shows favorable performance in the majority of cases. Specifically, it achieves statistically significant improvements in all 6 scenarios on synthetic data and in 5 out of 6 scenarios on real-world data. Notably, it often reduces discrepancy measures such as MMD and Wasserstein-2 distance by a large margin. In addition, the variability of the flow matching estimates is generally lower, leading to more reliable and consistent results across different datasets. In scenario 4, the Gaussian in-context learner learned a singular covariance matrix.

[원문](https://arxiv.org/abs/2501.16825v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Arik Reuter, Tim G. J. Rudner, Vincent Fortuin, David Rügamer · Can Transformers Learn Full Bayesian Inference in Context? · 원문 그림 인용 · 원본 PDF 31쪽에서 그림 영역을 추출했습니다.

![Table 20: Gaussian Mixture Models: Comparing the in-context learner with a Gaussian approximation, fitted via the forward KL-divergence, to the proposed flow m…](https://refivu.com/papers/20eca8da-4cd3-457c-9a32-dcda3c90a2b6/figures/figure-0ff069c142625003b02358520817614b.png?thumb=512)

**Table 20** : Gaussian Mixture Models: Comparing the in-context learner with a Gaussian approximation, fitted via the forward KL-divergence, to the proposed flow matching method. Evaluation on 50 synthetic and 17 real-world datasets for seven different scenarios. If one method is by more than two standard errors better than the other, it is marked in bold. While the differences are less clear-cut than in the previous models, ICL + Flow Matching demonstrates favorable performance in several scenarios, particularly for the Wasserstein-2 distance and MMD. Notably, its advantage is most visible in lower-dimensional settings (Scenario 1 and 2), where it consistently improves upon the Gaussian approximation, fitted via the forward KL-divergence, across most metrics. However, as the dimensionality increases, the performance gap tends to narrow, and in some cases, the inherent variability of the datasets, especially for the Gaussian approximation, fitted via the forward KL-divergence,, makes it difficult to conclusively determine a clear winner. Nonetheless, the flow matching approach often achieves smaller standard errors and lower discrepancy measures, underlining its potential for more stable modeling.

[원문](https://arxiv.org/abs/2501.16825v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Arik Reuter, Tim G. J. Rudner, Vincent Fortuin, David Rügamer · Can Transformers Learn Full Bayesian Inference in Context? · 원문 그림 인용 · 원본 PDF 31쪽에서 그림 영역을 추출했습니다.

![Table 21: GLMs: Comparison of the OT flow matching and the VP diffusion objective on 50 synthetic and 17 real-world datasets for three different scenarios. All…](https://refivu.com/papers/20eca8da-4cd3-457c-9a32-dcda3c90a2b6/figures/figure-a87a60627a402bf3dc0725c86b821533.png?thumb=512)

**Table 21** : GLMs: Comparison of the OT flow matching and the VP diffusion objective on 50 synthetic and 17 real-world datasets for three different scenarios. All results within two standard errors of the best average result for each scenario are marked in bold.

[원문](https://arxiv.org/abs/2501.16825v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Arik Reuter, Tim G. J. Rudner, Vincent Fortuin, David Rügamer · Can Transformers Learn Full Bayesian Inference in Context? · 원문 그림 인용 · 원본 PDF 32쪽에서 그림 영역을 추출했습니다.

![Table 22: FA: Comparison of the OT flow matching and the VP diffusion objective on 50 synthetic and 17 real-world datasets for three different scenarios. All r…](https://refivu.com/papers/20eca8da-4cd3-457c-9a32-dcda3c90a2b6/figures/figure-12526b7bacc7c8bfb4ebfca9db850444.png?thumb=512)

**Table 22** : FA: Comparison of the OT flow matching and the VP diffusion objective on 50 synthetic and 17 real-world datasets for three different scenarios. All results within two standard errors of the best average result for each scenario are marked in bold.

[원문](https://arxiv.org/abs/2501.16825v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Arik Reuter, Tim G. J. Rudner, Vincent Fortuin, David Rügamer · Can Transformers Learn Full Bayesian Inference in Context? · 원문 그림 인용 · 원본 PDF 32쪽에서 그림 영역을 추출했습니다.

![Table 23: GMMs: Comparison of the OT flow matching and the VP diffusion objective on 50 synthetic and 17 real-world datasets for three different scenarios. All…](https://refivu.com/papers/20eca8da-4cd3-457c-9a32-dcda3c90a2b6/figures/figure-3526d044ca162a5d4e2e3ebf12cf6c1d.png?thumb=512)

**Table 23** : GMMs: Comparison of the OT flow matching and the VP diffusion objective on 50 synthetic and 17 real-world datasets for three different scenarios. All results within two standard errors of the best average result for each scenario are marked in bold.

[원문](https://arxiv.org/abs/2501.16825v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Arik Reuter, Tim G. J. Rudner, Vincent Fortuin, David Rügamer · Can Transformers Learn Full Bayesian Inference in Context? · 원문 그림 인용 · 원본 PDF 33쪽에서 그림 영역을 추출했습니다.

![Figure 8: Marginal distribution for GLM scenario 2 (left) and GMM scenario 1 (right). The in-context learner is trained with a diffusion objective using VP pat…](https://refivu.com/papers/20eca8da-4cd3-457c-9a32-dcda3c90a2b6/figures/figure-489f1b0c4df67d6abb900fb9990e2f0c.png?thumb=512)

**Figure 8** : Marginal distribution for GLM scenario 2 (left) and GMM scenario 1 (right). The in-context learner is trained with a diffusion objective using VP paths.

[원문](https://arxiv.org/abs/2501.16825v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Arik Reuter, Tim G. J. Rudner, Vincent Fortuin, David Rügamer · Can Transformers Learn Full Bayesian Inference in Context? · 원문 그림 인용 · 원본 PDF 33쪽에서 그림 영역을 추출했습니다.

![Table 27: GLMs: Comparison when using an MLP-based encoder and a transformer encoder on 50 synthetic and 17 real-world datasets for three different scenarios](https://refivu.com/papers/20eca8da-4cd3-457c-9a32-dcda3c90a2b6/figures/figure-3b4a5dded8109bcc0019a198f3d2cb4c.png?thumb=512)

**Table 27** : GLMs: Comparison when using an MLP-based encoder and a transformer encoder on 50 synthetic and 17 real-world datasets for three different scenarios.

[원문](https://arxiv.org/abs/2501.16825v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Arik Reuter, Tim G. J. Rudner, Vincent Fortuin, David Rügamer · Can Transformers Learn Full Bayesian Inference in Context? · 원문 그림 인용 · 원본 PDF 35쪽에서 그림 영역을 추출했습니다.

![Table 28: FA: Comparison when using an MLP-based encoder and a transformer encoder on 50 synthetic and 17 real-world datasets for three different scenarios](https://refivu.com/papers/20eca8da-4cd3-457c-9a32-dcda3c90a2b6/figures/figure-7d6517978db0cab6d4d4abf3961ccf4a.png?thumb=512)

**Table 28** : FA: Comparison when using an MLP-based encoder and a transformer encoder on 50 synthetic and 17 real-world datasets for three different scenarios.

[원문](https://arxiv.org/abs/2501.16825v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Arik Reuter, Tim G. J. Rudner, Vincent Fortuin, David Rügamer · Can Transformers Learn Full Bayesian Inference in Context? · 원문 그림 인용 · 원본 PDF 35쪽에서 그림 영역을 추출했습니다.

![Table 29: GMMs: Comparison when using an MLP-based encoder and a transformer encoder on 50 synthetic and 17 real-world datasets for three different scenarios](https://refivu.com/papers/20eca8da-4cd3-457c-9a32-dcda3c90a2b6/figures/figure-ebc046d88098fa5c0bafdfc6b9bcd816.png?thumb=512)

**Table 29** : GMMs: Comparison when using an MLP-based encoder and a transformer encoder on 50 synthetic and 17 real-world datasets for three different scenarios.

[원문](https://arxiv.org/abs/2501.16825v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Arik Reuter, Tim G. J. Rudner, Vincent Fortuin, David Rügamer · Can Transformers Learn Full Bayesian Inference in Context? · 원문 그림 인용 · 원본 PDF 36쪽에서 그림 영역을 추출했습니다.

![Figure 9: Out-of-distribution (OOD) performance of the ICL method in GLM Scenario 2. The x-axis shows the distribution shift between training and test distribu…](https://refivu.com/papers/20eca8da-4cd3-457c-9a32-dcda3c90a2b6/figures/figure-5e2b494b644418162c92695217e2574b.png?thumb=512)

**Figure 9** : Out-of-distribution (OOD) performance of the ICL method in GLM Scenario 2. The x-axis shows the distribution shift between training and test distributions, quantified by C2ST. The y-axis displays the performance of the in-context learner, evaluated via C2ST, MMD, and W2 distances against HMC samples — where higher values indicate worse performance. OOD data is generated by gradually increasing the variance of the prior on the regression coefficients from an initial value of 1.0 to √ 2, 1.7, 2, 2.5, and 3.5.

[원문](https://arxiv.org/abs/2501.16825v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Arik Reuter, Tim G. J. Rudner, Vincent Fortuin, David Rügamer · Can Transformers Learn Full Bayesian Inference in Context? · 원문 그림 인용 · 원본 PDF 37쪽에서 그림 영역을 추출했습니다.

![Table 30: Distribution of variables for the OOD analysis on GLM scenarios](https://refivu.com/papers/20eca8da-4cd3-457c-9a32-dcda3c90a2b6/figures/figure-cf11f9ca01ad036b7499e066d55f66a8.png?thumb=512)

**Table 30** : Distribution of variables for the OOD analysis on GLM scenarios.

[원문](https://arxiv.org/abs/2501.16825v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Arik Reuter, Tim G. J. Rudner, Vincent Fortuin, David Rügamer · Can Transformers Learn Full Bayesian Inference in Context? · 원문 그림 인용 · 원본 PDF 38쪽에서 그림 영역을 추출했습니다.

![Table 32: Distribution of variables for the OOD analysis on the FA scenarios](https://refivu.com/papers/20eca8da-4cd3-457c-9a32-dcda3c90a2b6/figures/figure-3806d70abd17d01db91b2ea4bda94c13.png?thumb=512)

**Table 32** : Distribution of variables for the OOD analysis on the FA scenarios.

[원문](https://arxiv.org/abs/2501.16825v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Arik Reuter, Tim G. J. Rudner, Vincent Fortuin, David Rügamer · Can Transformers Learn Full Bayesian Inference in Context? · 원문 그림 인용 · 원본 PDF 39쪽에서 그림 영역을 추출했습니다.

![Table 34: Distribution for the OOD analysis of the GMM scenarios](https://refivu.com/papers/20eca8da-4cd3-457c-9a32-dcda3c90a2b6/figures/figure-3a49958dd3da17ea1a0105dd900a4e90.png?thumb=512)

**Table 34** : Distribution for the OOD analysis of the GMM scenarios.

[원문](https://arxiv.org/abs/2501.16825v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Arik Reuter, Tim G. J. Rudner, Vincent Fortuin, David Rügamer · Can Transformers Learn Full Bayesian Inference in Context? · 원문 그림 인용 · 원본 PDF 40쪽에서 그림 영역을 추출했습니다.

![Table 35: OOD Performance: Evaluation on 50 synthetic datasets for 6 different GMM scenarios. All results within two standard errors of the non-OOD result for…](https://refivu.com/papers/20eca8da-4cd3-457c-9a32-dcda3c90a2b6/figures/figure-6d79fbee959adff155a22d3ca895d51d.png?thumb=512)

**Table 35** : OOD Performance: Evaluation on 50 synthetic datasets for 6 different GMM scenarios. All results within two standard errors of the non-OOD result for each scenario are marked in bold.

[원문](https://arxiv.org/abs/2501.16825v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Arik Reuter, Tim G. J. Rudner, Vincent Fortuin, David Rügamer · Can Transformers Learn Full Bayesian Inference in Context? · 원문 그림 인용 · 원본 PDF 40쪽에서 그림 영역을 추출했습니다.

![Table 36: Generalized Linear Models: Ablation with respect to the dimensionality of the problem on 50 synthetic and 17 real-world datasets for scenarios 1,2 an…](https://refivu.com/papers/20eca8da-4cd3-457c-9a32-dcda3c90a2b6/figures/figure-d72e31557043ad865370ee50dc505bcb.png?thumb=512)

**Table 36** : Generalized Linear Models: Ablation with respect to the dimensionality of the problem on 50 synthetic and 17 real-world datasets for scenarios 1,2 and 3. All results within two standard errors of the best average result for each scenario are marked in bold. Due to the limitations of the number of features in the real-world data, we can only use 5 datasets for 20 and one dataset for 50 dimensions.

[원문](https://arxiv.org/abs/2501.16825v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Arik Reuter, Tim G. J. Rudner, Vincent Fortuin, David Rügamer · Can Transformers Learn Full Bayesian Inference in Context? · 원문 그림 인용 · 원본 PDF 42쪽에서 그림 영역을 추출했습니다.

![Table 37: Generalized Linear Models: Ablation with respect to the dimensionality of the problem on 50 synthetic and 17 real-world datasets for scenarios 4, 5 a…](https://refivu.com/papers/20eca8da-4cd3-457c-9a32-dcda3c90a2b6/figures/figure-0304ccfae48fa1d3182411e53981e501.png?thumb=512)

**Table 37** : Generalized Linear Models: Ablation with respect to the dimensionality of the problem on 50 synthetic and 17 real-world datasets for scenarios 4, 5 and 6. All results within two standard errors of the best average result for each scenario are marked in bold. Due to the limitations of the number of features in the real-world data, we can only use 5 datasets for 20 and one dataset for 50 dimensions.

[원문](https://arxiv.org/abs/2501.16825v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Arik Reuter, Tim G. J. Rudner, Vincent Fortuin, David Rügamer · Can Transformers Learn Full Bayesian Inference in Context? · 원문 그림 인용 · 원본 PDF 43쪽에서 그림 영역을 추출했습니다.

![Table 38: Generalized Linear Models: Ablation with respect to the dimensionality of the problem on 50 synthetic and 17 real-world datasets for scenario 7. All…](https://refivu.com/papers/20eca8da-4cd3-457c-9a32-dcda3c90a2b6/figures/figure-7ba03d10519a0dbf282b58af17640c20.png?thumb=512)

**Table 38** : Generalized Linear Models: Ablation with respect to the dimensionality of the problem on 50 synthetic and 17 real-world datasets for scenario 7. All results within two standard errors of the best average result for each scenario are marked in bold. Due to the limitations of the number of features in the real-world data, we can only use 5 datasets for 20 and one dataset for 50 dimensions.

[원문](https://arxiv.org/abs/2501.16825v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Arik Reuter, Tim G. J. Rudner, Vincent Fortuin, David Rügamer · Can Transformers Learn Full Bayesian Inference in Context? · 원문 그림 인용 · 원본 PDF 44쪽에서 그림 영역을 추출했습니다.

![Table 39: Evaluating the predictive performance across 50 synthetic and 17 real-world datasets in GLM scenario 2 for different dimensionalities. All results wi…](https://refivu.com/papers/20eca8da-4cd3-457c-9a32-dcda3c90a2b6/figures/figure-eb656fb4465ef77fa569dba3aee1ffc4.png?thumb=512)

**Table 39** : Evaluating the predictive performance across 50 synthetic and 17 real-world datasets in GLM scenario 2 for different dimensionalities. All results within two standard errors of the best average result for each scenario are marked in bold. Due to the limitations of the number of features in the real-world data, we can only use 5 datasets for 20 and one dataset for 50 dimensions. We find that the quality of the samples by the in-context learner, when evaluated based on predictive performance, decreases consistently with an increase in the dimensionality of the problem. Note that the randomness in the results, especially for higher dimensionalities, can in rare cases lead to better mean values. This is most likely not significant when taking the standard error into account.

[원문](https://arxiv.org/abs/2501.16825v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Arik Reuter, Tim G. J. Rudner, Vincent Fortuin, David Rügamer · Can Transformers Learn Full Bayesian Inference in Context? · 원문 그림 인용 · 원본 PDF 45쪽에서 그림 영역을 추출했습니다.

![Table 40: Evaluating the predictive performance across 50 synthetic and 17 real-world datasets in GLM scenario 2 for different dimensionalities. All results wi…](https://refivu.com/papers/20eca8da-4cd3-457c-9a32-dcda3c90a2b6/figures/figure-bb165cc1b655cb1e6149e173cc28b9a3.png?thumb=512)

**Table 40** : Evaluating the predictive performance across 50 synthetic and 17 real-world datasets in GLM scenario 2 for different dimensionalities. All results within two standard errors of the best average result for each scenario are marked in bold. Due to the limitations of the number of features in the real-world data, we can only use 5 datasets for 20 and one dataset for 50 dimensions. We find that the quality of the samples by the in-context learner, when evaluated based on predictive performance, decreases consistently with an increase in the dimensionality of the problem.

[원문](https://arxiv.org/abs/2501.16825v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Arik Reuter, Tim G. J. Rudner, Vincent Fortuin, David Rügamer · Can Transformers Learn Full Bayesian Inference in Context? · 원문 그림 인용 · 원본 PDF 46쪽에서 그림 영역을 추출했습니다.

![Table 41: Evaluating the predictive performance across 50 synthetic and 17 real-world datasets in GLM scenario 2 for different dimensionalities. All results wi…](https://refivu.com/papers/20eca8da-4cd3-457c-9a32-dcda3c90a2b6/figures/figure-73a64765598fa6c7ebd765876d2a0a99.png?thumb=512)

**Table 41** : Evaluating the predictive performance across 50 synthetic and 17 real-world datasets in GLM scenario 2 for different dimensionalities. All results within two standard errors of the best average result for each scenario are marked in bold. Due to the limitations of the number of features in the real-world data, we can only use 5 datasets for 20 and one dataset for 50 dimensions. We find that the quality of the samples by the in-context learner, when evaluated based on predictive performance, decreases consistently with an increase in the dimensionality of the problem.

[원문](https://arxiv.org/abs/2501.16825v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Arik Reuter, Tim G. J. Rudner, Vincent Fortuin, David Rügamer · Can Transformers Learn Full Bayesian Inference in Context? · 원문 그림 인용 · 원본 PDF 47쪽에서 그림 영역을 추출했습니다.

## 논문 정보

- **저자**: Arik Reuter, Tim G. J. Rudner, Vincent Fortuin, David Rügamer
- **학회·저널**: arXiv · 프리프린트
- **최초 공개일**: 2025년 1월 28일
- **등록일**: 2026년 10월 29일
- **수정일**: 2025년 8월 7일
- **버전**: v2
- **arXiv**: 2501.16825
- **분류**: cs.LG
- **원문 이용 조건**: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)
- **제공 범위**: 논문 정보, 해설, 허용된 원문 그림

[논문 원문 ↗](https://arxiv.org/abs/2501.16825v2) · [원문 PDF ↗](https://arxiv.org/pdf/2501.16825v2)

AI 해설은 논문 원문과 별개의 설명이며 오류가 있을 수 있습니다. 원문과 그림은 각 출처의 이용 조건과 따로 표시된 권리를 따릅니다.

## 초록

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 and enables us to infer complex posterior distributions for models 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 that do not operate in context. The source code for this paper is available at https://github.com/ArikReuter/ICL\_for\_Full\_Bayesian\_Inference.

## 원문 인용

Arik Reuter, Tim G. J. Rudner, Vincent Fortuin, David Rügamer (2025). Can Transformers Learn Full Bayesian Inference in Context?. arXiv:2501.16825v2. https://arxiv.org/abs/2501.16825v2

**BibTeX**

```
@misc{reuter2025transformers,
  title = {{Can Transformers Learn Full Bayesian Inference in Context?}},
  author = {Arik Reuter and Tim G. J. Rudner and Vincent Fortuin and David Rügamer},
  year = {2025},
  eprint = {2501.16825},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2501.16825v2}
}
```

## 이 논문의 용어

- [flow matching](https://refivu.com/terms/866ec58102b7-flow-matching)
- [Proposition 1](https://refivu.com/terms/ef6913a0bc9e-proposition-1)
- [in-context learning](https://refivu.com/terms/d53d2af6b551-in-context-learning)
- [Maximum Mean Discrepancy](https://refivu.com/terms/2b1ea1367bf7-maximum-mean-discrepancy)
- [variational inference](https://refivu.com/terms/44c66cf79542-variational-inference)
- [TabPFN](https://refivu.com/terms/1502d06485bd-tabpfn)
- [Hamiltonian Monte Carlo](https://refivu.com/terms/390634556361-hamiltonian-monte-carlo)
- [Wasserstein-2 distance](https://refivu.com/terms/260fe6bc3568-wasserstein-2-distance)
- [C2ST](https://refivu.com/terms/5c8244b262d2-c2st)
- [Gaussian mixture models](https://refivu.com/terms/8790d8b8cf6a-gaussian-mixture-models)
- [SGLD](https://refivu.com/terms/31089689c28b-sgld)
- [adaptive layer norm](https://refivu.com/terms/4f2b3bf2430a-adaptive-layer-norm)

## 다른 논문 해설

- [Sub-Sequential Physics-Informed Learning with State Space Model](https://refivu.com/papers/1f83b0c4-f6a4-45a3-b53d-f03b2c001d27-sub-sequential-physics-informed-learning-with-state-space.md)
- [Unisolver: PDE-Conditional Transformers Towards Universal Neural PDE Solvers](https://refivu.com/papers/a7154426-94d9-4030-b848-c26f52fa8098-unisolver-pde-conditional-transformers-towards-universal.md)
- [Sum-of-Parts: Self-Attributing Neural Networks with End-to-End Learning of Feature Groups](https://refivu.com/papers/64a614cf-df2a-4469-b333-aef93481c689-sum-of-parts-self-attributing-neural-networks-with.md)
- [MEG-XL: Data-Efficient Brain-to-Text via Long-Context Pre-Training](https://refivu.com/papers/fa64770e-c957-4f6e-ba6e-b94240ad53df-meg-xl-data-efficient-brain-to-text-via.md)
- [Dynamic Relational Priming Improves Transformer in Multivariate Time Series](https://refivu.com/papers/8ba7886a-c6c4-45b0-8777-4fadbf2dfc42-dynamic-relational-priming-improves-transformer-in.md)
- [Head Dimension Matters in Language Models for Long-Context Retrieval](https://refivu.com/papers/838a75bf-a7dc-49db-9750-9545dee4724f-head-dimension-matters-in-language-models-for-long.md)
- [Gradual Transition from Bellman Optimality Operator to Bellman Operator in Online Reinforcement Learning](https://refivu.com/papers/ca5f26dd-888c-4604-a0af-618a58cfe6e0-gradual-transition-from-bellman-optimality-operator-to.md)
- [Pivoting Factorization: A Compact Meta Low-Rank Representation of Sparsity for Efficient Inference in Large Language Models](https://refivu.com/papers/ccf0a44e-f28b-4762-9dec-55d3069d68a9-pivoting-factorization-a-compact-meta-low-rank.md)
- [Understanding and Mitigating Memorization in Generative Models via Sharpness of Probability Landscapes](https://refivu.com/papers/e75379e9-eec1-44a1-a86a-1569dc00ae8d-understanding-and-mitigating-memorization-in-generative.md)
- [Field Matching: an Electrostatic Paradigm to Generate and Transfer Data](https://refivu.com/papers/e2b68152-3fe1-42d9-9c69-d4a171d6d98a-field-matching-an-electrostatic-paradigm-to-generate-and.md)
- [Balancing Interference and Correlation in Spatial Experimental Designs: A Causal Graph Cut Approach](https://refivu.com/papers/a4debb05-37af-49fa-bdd7-59fb6ee8db90-balancing-interference-and-correlation-in-spatial.md)
- [DRAG: Data Reconstruction Attack using Guided Diffusion](https://refivu.com/papers/4839aaf8-38e7-4160-bc2e-53b55d3c9898-drag-data-reconstruction-attack-using-guided-diffusion.md)

---

AI 해설에는 오류가 있을 수 있습니다. [Refivu](https://refivu.com/papers/20eca8da-4cd3-457c-9a32-dcda3c90a2b6-can-transformers-learn-full-bayesian-inference-in-context)
