When a language model answers a question from a long prompt, not every word contributes equally. Context attribution measures each token's importance by removing it and seeing the effect. Doing this for all tokens separately requires rerunning the model for each, which is expensive.
This work estimates all token importances at once with far fewer evaluations. It assumes the model is 'stable': small deletions affect output smoothly. The method uses sketching and gradient calculations from backpropagation to reduce the number of runs.
The algorithm needs only O(√(log(1/ε))/ε) evaluations to achieve error ε, a guarantee also validated on a small language model. This makes efficient context attribution practical for crediting sources, trimming prompts, and detecting attacks.
