Research map / Probabilistic and scientific modeling / Uncertainty and Gaussian processes
Can Generative AI Solve Your In-Context Learning Problem? A Martingale Perspective
Read the paperCheck your idea against 108,967 papers
AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.
Proposes the generative predictive p-value, which lets posterior predictive checks run on conditional generative models (e.g., Llama-2, Gemma-2) by sampling dataset completions from the model's predictive distribution, to decide whether a CGM can solve an in-context learning problem.
Problem
Assessing whether a conditional generative model is an appropriate Bayesian model for an in-context learning problem, when only the predictive distribution (not the likelihood or posterior) of the CGM is accessible.
Approach
Replace sampling from the latent-explanation posterior with ancestral (predictive resampling) generation of a large dataset completion from the CGM predictive, then compute posterior-predictive-style p-values on that completion; a martingale argument (Doob's theorem) shows the infinite-completion version equals the standard posterior predictive p-value.
Key results
- On OOD tabular tasks with NLL discrepancy, the generative predictive p-value gives non-trivial OOD predictors across all significance levels (M=40, N-n=200).
- For Llama-2 7B in-capability vs out-of-capability text tasks, the NLL discrepancy gives accuracy above 0.5 across significance levels.
- The NLL discrepancy's p-values correlate with response RMSE (lower p-value, higher error), yielding substantially lower risk than NLML at matched accuracy in tabular experiments.
Measured effects reported in the paper
| What was changed | Where | Measured | Effect |
|---|---|---|---|
| Use the generative predictive p-value under either the NLL or NLML discrepancy to predict out-of-capability tasks | Llama-2 7B · Natural language ICL: RTE and MQP vs. SST2 and AG News | accuracy: >0.5 | Helped |
| Use the generative predictive p-value under either the NLL or NLML discrepancy to predict OOD tasks | Llama-2 regression model · Generative fill: MNIST and CIFAR-10 vs. SVHN | accuracy: > 0.66\bar{6} | Helped |
| Use NLML instead of NLL as the discrepancy | Generative predictive p-value capability predictor · Tabular, natural language, and imaging ICL tasks | precision | Helped |
| Use NLL instead of NLML as the discrepancy | Generative predictive p-value capability predictor · Tabular, natural language, and imaging ICL tasks | recall | Helped |
| Use NLL with significance level α=0.05 rather than NLML at an evaluated significance level | Generative predictive p-value capability predictor · Tabular, natural language, and imaging ICL tasks | accuracy: α=0.05 | Helped |
| Use the NLL discrepancy rather than NLML | Generative predictive p-value capability predictor · In-distribution polynomial tabular tasks | risk | Helped |
| Use NLL rather than NLML to calculate the p-value | Generative predictive p-value · In-distribution polynomial tabular tasks | association between p-value and response RMSE | Helped |
| Increase the generated completion size N-n | Generative predictive p-value · Reference Bayesian polynomial regression and OOD ReLU-NN tasks | approximation to reference NLL p-value: N-n = 2; 100 | Helped |
| Increase the in-context dataset size n | NLML discrepancy capability predictor · Tabular and natural language ICL tasks | recall | Mixed |
| Use NLL rather than NLML to assess capability | Generative predictive p-value · In-distribution polynomial tabular tasks | ability to indicate sufficient in-context examples | Helped |
Surprising findings
- The NLML discrepancy's recall is sensitive to the number of in-context examples n and can misclassify out-of-capability tasks as solvable at small alpha or small n.
- The NLML-based p-value does not correlate with RMSE, while the NLL-based one does, indicating NLML cannot tell whether there are enough examples.
Limitations
- Finite completion size N introduces estimation error relative to the ideal posterior predictive p-value; formal error analysis left to future work.
- Theory requires identifiability and measurability conditions that may not hold for contemporary LLMs.
- Empirical evaluation uses only Llama-2 7B and Gemma-2 9B and small synthetic or narrow benchmarks.
Experimental setup
Datasets: SVHN MNIST CIFAR-10 SST2 AG News Medical Questions Pairs (MQP) RTE synthetic polynomial, ReLU-NN and RBF-GP regression tasks
Benchmarks: SST2 AG News MQP RTE SVHN MNIST CIFAR-10 synthetic tabular OOD regression tasks
Metrics: precision recall F1 accuracy FPR RMSE-based risk
Baselines: NLML discrepancy (posterior predictive p-value style) posterior predictive p-value
Builds on: posterior predictive checks Doob's theorem for estimators predictive resampling Bayesian model criticism
Closest papers by meaning
- In-Context Learning through the Bayesian Prism (ICLR 2024 · similarity 0.88)
- Estimating the Hallucination Rate of Generative AI (NeurIPS 2024 · similarity 0.88)
- Is In-Context Learning in Large Language Models Bayesian? A Martingale Perspective (ICML 2024 · similarity 0.86)
- Can Transformers Learn Full Bayesian Inference in Context? (ICML 2025 · similarity 0.86)
- Technical Debt in In-Context Learning: Diminishing Efficiency in Long Context (NeurIPS 2025 · similarity 0.85)
- In-Context Learning Strategies Emerge Rationally (NeurIPS 2025 · similarity 0.85)
Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.
