Gradient Sketching for Scalable Data Attribution

This direction is split into other directions: gradient dimensionality reduction. Its last version stays readable and citable here.

Version 1 of 1110 papers120 conceptsfrozen 2026-10-04

Modern foundation models are trained on trillions of tokens and billions of images, yet we often treat them as "black boxes" when it comes to their training history. If a model generates a specific fact or a particular artistic style, which training examples were responsible?

Answering this question is the goal of Training Data Attribution (TDA). However, the standard mathematical tool for this—the Influence Function—requires calculating and storing gradients that are as large as the model itself. For a 70B-parameter model, a single gradient vector takes 140GB of memory. Storing these for a massive corpus is physically impossible.

The breakthrough across recent research is the realization that we don't need the full gradient to understand influence. By using Random Projections, we can compress these massive vectors into tiny "sketches" that preserve the essential geometry of how a model learns.

The Geometry of Influence

To understand why sketching works, we first need to understand what "influence" actually is. In a linearized view of a neural network, the influence of a training point $z$ on a prediction $x$ is proportional to the inner product of their gradients: $$\text{Influence}(z, x) \approx \nabla \theta(z)^\top \nabla \theta(x)$$ Intuitively, if the update the model would have made to learn from $z$ points in the same direction as the gradient needed to predict $x$, then $z$ is highly influential for $x$.

As Hrayr Harutyunyan and Alessandro Achille demonstrate in Smooth Unique Information, this gradient-based signal allows us to identify which samples are essential, redundant, or even corrupted. The challenge is that we cannot compute these inner products in a billion-dimensional space.

The Johnson-Lindenstrauss Shortcut

The core mechanism enabling modern TDA is the Johnson-Lindenstrauss (JL) lemma. It states that high-dimensional points can be projected into a much lower-dimensional space while nearly preserving the distances (and inner products) between them.

By multiplying a high-dimensional gradient by a fixed random matrix, we create a "sketch." Sung Min Park and Aleksander Madry introduced TRAK (Tracing with the Randomly-projected After Kernel), which uses these projections to make attribution 100–1000x faster. Because the inner product is preserved, the "influence" calculated in the compressed space is a faithful proxy for the influence in the original parameter space.

This compression is often extreme. In RapidIn, Huawei Lin and Weijie Zhao show that gradients can be compressed by over 200,000x into "RapidGrads" while still allowing for accurate retrieval of influential tokens in models as large as Llama-2 70B (Token-wise Influential Training Data Retrieval).

Scaling to Foundation Models

Once gradients are compressed into searchable indices, TDA becomes a retrieval problem rather than a heavy optimization problem. This has allowed researchers to scale attribution to the largest existing models:

From Attribution to Data Selection

If we can measure which data is influential, we can also decide which data to keep. This has led to a new generation of data selection algorithms that outperform simple text-based filtering.

In LESS (Low-rank gradiEnt Similarity Search), Mengzhou Xia and Danqi Chen use gradient sketches to select the top 5% of data for instruction tuning, often outperforming models trained on the full dataset. Similarly, Yinghao Li uses projected gradients to cluster data and train specialized "expert" adapters in ELREA (Ensembles of Low-Rank Expert Adapters), resolving conflicts where different data points try to push the model in opposing directions.

Why It Works: The Low-Rank Hypothesis

The success of gradient sketching suggests a fundamental property of deep learning: the essential information for identifying influential samples resides in a low-dimensional subspace.

While a model may have billions of parameters, the "signal" of how a specific fact or skill is learned is highly structured. As Andrea Schioppa argues in Efficient Sketches for Training Data Attribution, explicit sketching allows us to bypass the "memory wall" because the loss landscape's local geometry is much simpler than the parameter count suggests. By projecting gradients, we aren't just saving memory—we are filtering out the high-dimensional noise to focus on the directional updates that actually drive learning.

Papers in this version

Showing 60 of 110 papers.

History & citationVersion 1 · 2026-10-04

Split into other directions · Permanent link

View frozen version 1

Cite this direction

Latest version (a living page):

@misc{lacuna_gradient_sketching_for_scalable_data_att_4aca3390,
  title = {Gradient Sketching for Scalable Data Attribution},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/gradient-sketching-for-scalable-data-attribution/rdr_4aca3390442b4e78ac83566c29c14b5b},
  note = {Latest version of a living research direction; cite a version for a fixed text. Accessed 2026-12-03},
}

This exact version (version 1, frozen text):

@misc{lacuna_gradient_sketching_for_scalable_data_att_4aca3390_v1,
  title = {Gradient Sketching for Scalable Data Attribution},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/gradient-sketching-for-scalable-data-attribution/rdr_4aca3390442b4e78ac83566c29c14b5b/v/1},
  note = {Version 1, frozen 2026-10-04. Accessed 2026-12-03},
}