Tracing LLM Behavior to the Training Data with Empirical Next-Token Distributions
For researchers in mechanistic interpretability, this work provides a data-centric perspective to understand how model behaviors originate from training data, complementing weight-based analyses.
This paper investigates how closely an LLM's next-token distribution matches the empirical next-token distribution (ENTD) from its training data. They find that for many inputs the agreement is near-perfect and increases with scale, but a long tail of significant discrepancies exists, which they attribute to architectural, procedural, and finite-sample factors.
In this paper, we study the connection between an LLM's output distribution and the data used to train it. Specifically, we study the degree to which an LLM's next-token distribution agrees with the empirical next-token distribution (ENTD) given the context in the training data. The ENTD is an appealing target because it is the unrestricted global minimizer of the next-token cross entropy loss used for pretraining, as well as an easily interpretable function of the pretraining corpus. We find that for a significant fraction of inputs, the LLM's distribution agrees with the ENTD almost perfectly, and the average agreement increases with model scale and training compute. Nevertheless, there is a long tail of input sequences where the LLM and ENTD differ significantly, and we examine several possible sources of this discrepancy across the transformer architecture, training procedure, and finite-sample noise in the ENTD estimate itself. More broadly, we hope our findings will encourage more work on ``data-centric mechanistic interpretability,'' a complement to standard mechanistic interpretability that opens the black box of how model behaviors arise from the data, rather than how they are encoded in the learned weights.