IC-511LLaMA-2, Gemma, and Mistral all perform in-context density estimation via an adaptive kernel-like process, as revealed by their similar low-dimensional INPCA trajectories bounded between the geodesic and the Gaussian submanifold
Toni J.B. Liu, Nicolas Boulle, Raphaël Sarfati, Christopher Earls
The authors prompt LLaMA-2 (7B, 13B, 70B), Gemma (2B, 7B), and Mistral-7B-v0.3 with comma-delimited numbers sampled from known distributions (Gaussian, uniform, t-distribution, random PDFs) and extract the models' predicted next-token density at each context length using the hierarchy-PDF algorithm. Embedding these density estimates in a 2D INPCA space (capturing ~90% of pairwise Hellinger distances) reveals that all three model families trace out strikingly similar trajectories, geometrically bounded between the geodesic (shortest path from uniform ignorance to the target) and the 1D Gaussian submanifold. A bespoke 2-parameter KDE with adaptive kernel shape (s) and bandwidth (h) closely reproduces these trajectories: the fitted kernel width decays significantly faster than the classical n^(-1/5) schedule, and the shape parameter evolves from approximately 0.1 to approximately 1 as context length increases. This adaptive kernel behavior distinguishes the LLMs from both fixed-kernel Gaussian KDE (which lingers on the Gaussian submanifold and lags on narrow targets) and Bayesian histograms (which follow the geodesic but converge slowly).
Evidence
correlational
Key metric
2D INPCA embeddings capture 92% of pairwise Hellinger distances (Gaussian targets), 89% (uniform targets), 91% (cross-model comparison); fitted kernel shape s evolves from ~0.1 to ~1; fitted kernel width decays significantly faster than n^(-1/5)
Caveat
Analysis limited to context length n=200 (LLaMA-2 context window is 4096 tokens, ~1365 data points); the bespoke KDE is a post-hoc fit, not a mechanistic proof; the paper notes that with Silverman's bandwidth, Gaussian KDE can match or surpass LLaMA-13B on convergence speed, so the comparison is 'inherently unfair to llama' since it is not specifically prompted for density estimation.