TEA: Text Encoder Alignment for Robust Concept Erasure in Text-to-Image Models

Alireza Dehghanpour Farashah, Zhuan Shi, Negar Rostamzadeh, Golnoosh Farnadi
8/15/2026
cs.CV
diffusion-flow

Official code: alirezafarashah/TEA (3 stars, last commit 2026-08-18).

Abstract

Text-to-image diffusion models can be misused to generate harmful content through adversarial or paraphrased prompts that bypass built-in safety mechanisms. Existing concept erasure methods often suffer from limited robustness against adversarial prompts, degradation of benign generation quality, or reliance on inference-time interventions that introduce persistent computational overhead.

Show full abstract

To address these limitations, we formulate concept erasure as a domain alignment problem in the text representation space. We propose a lightweight Text Encoder Alignment framework (TEA) that fine-tunes only the text encoder while keeping the generative backbone fully frozen. Given concept--anchor prompt pairs, our method trains a discriminator to distinguish token-level representations of concept-containing prompts from those of safe anchor prompts, while updating the text encoder to make these representations indistinguishable. TEA introduces zero inference-time overhead and requires only a small number of fine-tuning steps, making it highly efficient to deploy at scale. Despite this efficiency, TEA achieves state-of-the-art erasure robustness against black-box and white-box adversarial attacks on Stable Diffusion v1.4, while preserving generation quality on benign prompts. Furthermore, TEA is model-agnostic and achieves the lowest attack success rate on Stable Diffusion v3.5, extending concept erasure to a Rectified Flow Transformer architecture with T5 conditioning where prior methods remain largely unexplored. Code is available at \href{https://github.com/alirezafarashah/TEA.git}{https://github.com/alirezafarashah/TEA.git}

View on arXivView PDF

Code Implementations(1)

[Preprint] TEA: Text Encoder Alignment for Robust Concept Erasure in Text-to-Image Models

30Aug 13, 20263 months ago

Similar Papers

Cite this paper

@article{farashah2026tea,
  title  = {TEA: Text Encoder Alignment for Robust Concept Erasure in Text-to-Image Models},
  author = {Alireza Dehghanpour Farashah and Zhuan Shi and Negar Rostamzadeh and Golnoosh Farnadi},
  year   = {2026},
  eprint = {2608.15341},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2608.15341v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2608.15341.svg)](https://codeofpaper.com/paper/2608.15341)

Discussion