Density estimation with LLMs: a geometric investigation of in-context learning trajectories
Toni J. B. Liu, Nicolas Boullé, Raphaël Sarfati, Christopher J. Earls
摘要
Large language models (LLMs) demonstrate remarkable emergent abilities to perform in-context learning across various tasks, including time-series forecasting. This work investigates LLMs' ability to estimate probability density functions (PDFs) from data observed in-context; such density estimation (DE) is a fundamental task underlying many probabilistic modeling problems. We use Intensive Principal Component Analysis (InPCA) to visualize and analyze the in-context learning dynamics of LLaMA-2, Gemma, and Mistral. Our main finding is that these LLMs all follow similar learning trajectories in a low-dimensional InPCA space, which are distinct from those of traditional density estimation methods such as histograms and Gaussian kernel density estimation (KDE). We interpret these LLMs' in-context DE process as a KDE algorithm with adaptive kernel width and shape. This custom kernel model captures a significant portion of the LLMs' behavior despite having only two parameters. We further speculate on why the LLMs' kernel width and shape differ from classical algorithms, providing insights into the mechanism of in-context probabilistic reasoning in LLMs. Our codebase, along with a 3D visualization of an LLM's in-context learning trajectory, is publicly available at https://github.com/AntonioLiu97/LLMICL_inPCA.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 2 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- LoRA: Low-Rank Adaptation of Large Language Models 引用了 Language Models are Few-Shot Learners
- Transformers as Unsupervised Learning Algorithms: A study on Gaussian Mixtures 引用了 An Explanation of In-context Learning as Implicit Bayesian Inference
- Transformers as Unsupervised Learning Algorithms: A study on Gaussian Mixtures 引用了 Language Models are Few-Shot Learners
- Pre-trained Large Language Models Learn to Predict Hidden Markov Models In-context 引用了 An Explanation of In-context Learning as Implicit Bayesian Inference
- Pre-trained Large Language Models Learn to Predict Hidden Markov Models In-context 引用了 Language Models are Few-Shot Learners
- Pre-trained Large Language Models Learn to Predict Hidden Markov Models In-context 引用了 Large Language Models Are Zero-Shot Time Series Forecasters
- An Explanation of In-context Learning as Implicit Bayesian Inference 引用了 Language Models are Few-Shot Learners
- Large Language Models Are Zero-Shot Time Series Forecasters 引用了 Language Models are Few-Shot Learners
- Time-LLM: Time Series Forecasting by Reprogramming Large Language Models 引用了 Language Models are Few-Shot Learners
- Time-LLM: Time Series Forecasting by Reprogramming Large Language Models 引用了 Large Language Models Are Zero-Shot Time Series Forecasters
引用它的顶会 Paper2
它引用的 Paper12
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah 等NeurIPS 2020 · 64,255 次引用
- LoRA: Low-Rank Adaptation of Large Language ModelsEdward J. Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu 等ICLR 2022 · 18,833 次引用
- An Explanation of In-context Learning as Implicit Bayesian InferenceSang Michael Xie, Aditi Raghunathan, Percy Liang, Tengyu MaICLR 2022 · 1,030 次引用
- Time-LLM: Time Series Forecasting by Reprogramming Large Language ModelsMing Jin, Shiyu Wang, Lintao Ma, Zhixuan Chu 等ICLR 2024 · 915 次引用
- Large Language Models Are Zero-Shot Time Series ForecastersNate Gruver, Marc Finzi, Shikai Qiu, Andrew Gordon WilsonNeurIPS 2023 · 898 次引用
相关 Paper
- What Do Language Models Learn in Context? The Structured Task HypothesisJiaoda Li, Yifan Hou, Mrinmaya Sachan, Ryan CotterellACL 2024 · 5 次引用
- Task Descriptors Help Transformers Learn Linear Models In-ContextRuomin Huang, Rong GeICLR 2025
- Language Models Are Implicitly ContinuousSamuele Marro, Davide Evangelista, Xuanqiang Angelo Huang, Emanuele La Malfa 等ICLR 2025
- Emergence and Effectiveness of Task Vectors in In-Context Learning: An Encoder Decoder PerspectiveSeungwook Han, Jinyeop Song, Jeff Gore, Pulkit AgrawalICML 2025
- Controllable Context Sensitivity and the Knob Behind ItJulian Minder, Kevin Du, Niklas Stoehr, Giovanni Monea 等ICLR 2025
