LEACE
Concept erasure aims to remove specified features from a representation. It can improve fairness (e.g. preventing a classifier from using gender or race) and interpretability (e.g. removing a concept to observe changes in model behavior). We introduce LEAst-squares Concept Erasure (LEACE), a closed-form method which provably prevents all linear classifiers from detecting a concept while changing the representation as little as possible, as measured by a broad class of norms. We apply LEACE to large language models with a novel procedure called concept scrubbing, which erases target concept information from every layer in the network. We demonstrate our method on two tasks: measuring the reliance of language models on part-of-speech information, and reducing gender bias in BERT embeddings. Our code is available at https://github.com/EleutherAI/concept-erasure.
1. Overview
LEACE, or LEAst-squares Concept Erasure, is a closed-form method for removing a target concept from a learned representation.
Suppose a model produces a representation , and each representation is associated with a concept label .
Examples include:
- : a BERT sentence embedding, : gender
- : a token-level hidden state, : part-of-speech tag
The goal is to construct a transformed representation that satisfies two conditions:
- No linear predictor can recover from .
- remains as close as possible to the original representation .
LEACE achieves this without adversarial training or iterative optimization. It computes the erasure transformation directly from means and covariance matrices.
2. Problem Setup
A predictor is written as
where denotes its parameters.
The predictor belongs to a function class
and its performance is measured by a loss
The best achievable expected loss is
This quantity represents how well the strongest predictor in can predict from .
A representation is called guarded when even the best allowed predictor cannot outperform an input-independent constant predictor.
For linear guardedness, the predictor family consists of affine functions:
3. Key Theoretical Result
The central result of the paper is the following equivalence:
if and only if
which is also equivalent to
In other words, a concept is unavailable to every linear predictor exactly when all concept classes have the same mean representation.
This converts concept erasure from an adversarial learning problem into a linear-algebra problem. Instead of repeatedly training classifiers, it is sufficient to eliminate the cross-covariance between and .
4. Affine Erasure Condition
LEACE considers affine transformations of the form
The transformed representation linearly guards if and only if
Because a constant bias does not affect covariance,
where
Therefore, the erasure condition is
Equivalently, the concept-related subspace must lie inside the nullspace of .
5. Least-Squares Objective
Many matrices satisfy the erasure condition, but some destroy more information than others.
LEACE chooses the feasible transformation that minimizes the expected edit:
subject to
Here,
where is a positive semidefinite matrix defining the geometry of the edit.
The method is optimal not only for ordinary Euclidean distance, but for a broad family of inner-product-induced norms.
6. LEACE Transformation
Let
and
Define the whitening operator
In the whitened space, the concept-related directions are contained in
Let
be the orthogonal projector onto that subspace.
The final LEACE transformation is
The procedure can be interpreted as:
- Center the representation.
- Whiten it.
- Project it onto the concept-correlated subspace.
- Unwhiten the projected component.
- Subtract that component from the original representation.
Thus, LEACE removes the component responsible for the linear predictability of .
LEACE projection in 3 steps. First the data is whitened, ensuring equal variance in all directions. It is then orthogonally projected onto , guaranteeing linear guardedness. Finally, we unwhiten the data so that its covariance structure mimics the original.
7. Why the Projection Is Oblique
LEACE is generally not an orthogonal projection in the original representation space.
The constraint
restricts the nullspace of , not its output range. Therefore, the method is free to choose an output geometry that minimizes distortion.
The resulting matrix is idempotent:
but it is generally not symmetric:
It is therefore an oblique projection.
This allows LEACE to preserve more of the original data variance than a naive orthogonal projection while still achieving complete linear guardedness.
8. Experimental Results
The paper evaluates LEACE on BERT representations from the Bias in Bios dataset.
After removing gender information:
while the gender-related TPR gap decreases from
This indicates that LEACE substantially reduces gender-associated behavior while preserving most profession-related information.
The paper also reports that LEACE reaches perfect linear erasure with a smaller representation edit than INLP and RLACE, while being roughly two orders of magnitude faster than RLACE.
9. Concept Scrubbing
The paper extends LEACE to deep networks through concept scrubbing.
Instead of erasing a concept from only one layer, concept scrubbing applies LEACE sequentially to every layer.
For each layer :
- Compute the current hidden states .
- Fit LEACE using and .
- Erase the concept from .
- Pass the edited hidden states to the next layer.
This must be done sequentially because an intervention at an early layer changes the hidden-state distribution of all later layers.
When the authors remove part-of-speech information from every layer of LLaMA and Pythia models, language-modeling performance degrades much more than it does under random subspace removal.
The authors interpret this as evidence that these models strongly rely on linearly encoded part-of-speech information.
10. Main Limitation
The phrase “perfect concept erasure” refers only to perfect linear erasure.
LEACE guarantees
but it does not guarantee
A nonlinear predictor may still recover from differences in variance, higher-order moments, or nonlinear geometry.
Therefore,
LEACE removes the concept-correlated component of a representation in whitened space and constructs the least-distorted representation from which no linear predictor can recover the target concept.