Density estimation with LLMs: a geometric investigation of in-context learning trajectories
Not on the map. Why?
Abstract (arXiv)
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 leverage the Intensive Principal Component Analysis (InPCA) to visualize and analyze the in-context learning dynamics of LLaMA-2 models. 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 like histograms and Gaussian kernel density estimation (KDE). We interpret the LLaMA in-context DE process as a KDE with an adaptive kernel width and shape. This custom kernel model captures a significant portion of LLaMA's behavior despite having only two parameters. We further speculate on why LLaMA's kernel width and shape differs 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
Key facts. Cited by 6 papers in the map (data through 14 Oct 2026). Builds on 15 of its 39 references that are in the map. First posted on arXiv 7 Oct 2024.
Builds on
15 of 39 references.
References · 15
- 2021LoRA: Low-Rank Adaptation of Large Language Modelscited by 14,380
- 2015Deep Unsupervised Learning using Nonequilibrium Thermodynamicscited by 7,058
- 2019Normalizing Flows for Probabilistic Modeling and Inferencecited by 1,323
- 2021An Explanation of In-context Learning as Implicit Bayesian Inferencecited by 938
- 2022Transformers learn in-context by gradient descentcited by 732
- 2023Time-LLM: Time Series Forecasting by Reprogramming Large Language Modelscited by 700
- 2022What learning algorithm is in-context learning? Investigations with linear modelscited by 684
- 2022Why Can GPT Learn In-Context? Language Models Implicitly Perform Gradient Descent as Meta-Optimizerscited by 204
- 2023Birth of a Transformer: A Memory Viewpointcited by 161
- 2024LLM Processes: Numerical Predictive Distributions Conditioned on Natural Languagecited by 55
- 2023Measuring Inductive Biases of In-Context Learning with Underspecified Demonstrationscited by 49
- 2024LLMs learn governing principles of dynamical systems, revealing an in-context neural scaling lawcited by 32
Built on by
Citing papers per year: 2025: 3; 2026: 3.
6 papers.
- 2026The Shape of Beliefs: Geometry, Dynamics, and Interventions along Representation Manifolds of Language Models' Posteriorscited by 15
- 2025Text-Trained LLMs Can Zero-Shot Extrapolate PDE Dynamics, Revealing a Three-Stage In-Context Learning Mechanismcited by 7
- 2025Pre-trained Large Language Models Learn Hidden Markov Models In-contextcited by 4
- 2026Jacobian Scopes: token-level causal attributions in LLMscited by 4
- 2025Transformers as Unsupervised Learning Algorithms: A study on Gaussian Mixturescited by 3
- 2026A Graph Signal Processing Perspective on Numerical Sequence Representations in LLM In-Context Learningcited by 0
- 2026A Graph Signal Processing Perspective on Numerical Sequence Representations in LLM In-Context Learning4 Aug 2026
- 2026The Shape of Beliefs: Geometry, Dynamics, and Interventions along Representation Manifolds of Language Models' Posteriors2 Feb 2026
- 2026Jacobian Scopes: token-level causal attributions in LLMs23 Jan 2026
- 2025Text-Trained LLMs Can Zero-Shot Extrapolate PDE Dynamics, Revealing a Three-Stage In-Context Learning Mechanism8 Sep 2025
- 2025Pre-trained Large Language Models Learn Hidden Markov Models In-context8 Jun 2025
- 2025Transformers as Unsupervised Learning Algorithms: A study on Gaussian Mixtures17 May 2025
Similar, not cited
Close in wording, no citation either way
- 2026Sparse or Dense? A Mechanistic Estimation of Computation Density in Transformer-based LLMs
- 2026In-Context Function Learning in Large Language Models
- 2026Eliciting Numerical Predictive Distributions of LLMs Without Autoregression
- 2026Rethinking the Role of LLMs in Time Series Forecasting
- 2023In-Context Explainers: Harnessing LLMs for Explaining Black Box Models
- 2024Beyond the Black Box: A Statistical Model for LLM Reasoning and Inference
- 2026Stories in Space: In-Context Learning Trajectories in Conceptual Belief Space
- 2026Interpretable Probability Estimation with LLMs via Shapley Reconstruction