TEA: Text Encoder Alignment for Robust Concept Erasure in Text-to-Image Models
The paper proposes TEA, a lightweight and model-agnostic framework that achieves robust concept erasure in text-to-image models by fine-tuning the text encoder to align concept-containing prompts with safe anchors, thereby eliminating adversarial vulnerabilities without inference-time overhead or degradation of benign generation quality.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine a world where computers can paint pictures from nothing but a sentence. You type "a cat sitting on a moonlit roof," and a machine, trained on millions of images and captions, creates a stunning, realistic scene in seconds. This technology, known as a text-to-image model, has opened doors for artists and designers, turning imagination into visual reality. However, this same power carries a risk. Just as a skilled forger can mimic a style, a clever user can trick these computers into creating harmful or inappropriate images by using sneaky, rephrased instructions that bypass the safety filters built into the system. The computer sees the words, but it misses the intent, generating content that was never meant to be seen.
For years, scientists have tried to fix this by teaching the computer to forget specific bad ideas, a process called concept erasure. Some methods try to scrub the bad data out before the computer learns, while others try to stop the bad images from appearing only at the moment they are being made. But these solutions often have a catch: they are either too slow to be useful on a large scale, they make the computer worse at drawing good pictures, or they require constant, heavy computing power every time someone asks for an image. The goal has always been to find a way to permanently remove the ability to create harmful content without slowing the machine down or ruining its artistic talent.
A team of researchers has now proposed a new approach that tackles this problem by changing how the computer understands language, rather than how it paints. They call their method TEA, which stands for Text Encoder Alignment. In these image-making systems, there are two main parts working together. The first part is the text encoder, which acts like a translator, turning your written sentence into a set of numbers that the computer can understand. The second part is the generative backbone, which takes those numbers and actually draws the picture. Previous attempts to stop bad images often involved tweaking the drawing part, which is like trying to fix a leak in a house by painting over the walls; it is messy and often ineffective because the problem lies in how the instructions were translated in the first place.
The researchers realized that the key to stopping harmful images lies in the translator. They found that the computer's ability to recognize a specific bad concept, such as nudity, is concentrated in the text encoder. To fix this, they created a training process that only adjusts this translator, leaving the drawing part completely untouched. They started with a pair of sentences: one that contained the harmful idea, like "a nude woman in a forest," and another that was almost identical but safe, like "a woman in a forest." They then taught the translator to make the numbers for the bad sentence look exactly the same as the numbers for the safe sentence.
To do this, they used a clever game of cat and mouse. They set up a small computer program, a discriminator, whose job was to tell the difference between the numbers coming from the bad sentence and the safe one. The main translator tried to fool this discriminator by changing its own settings so that the two sentences produced identical numbers. At the same time, the researchers made sure the translator didn't forget how to handle normal, safe sentences. They did this by checking that the safe sentences still looked like they did before the changes were made. This ensured that the computer would still be able to draw beautiful, harmless pictures of forests and women, just without the ability to draw the specific harmful version.
The results of this method were striking. When tested against a variety of tricky attempts to trick the computer, including those designed by experts to bypass safety systems, this new approach stopped the harmful images almost completely. In tests where other methods failed to stop the bad content or made the computer worse at drawing good pictures, this method succeeded in both. It worked on older versions of the technology and also on the newest, most advanced systems, proving that the idea holds up across different types of image generators. Perhaps most importantly, because the drawing part of the computer was never changed, the system did not slow down at all. It took the same amount of time to create an image as it did before, with no extra computing power needed every time a user asked for a picture.
The researchers also tested whether this method could remove other types of unwanted concepts, such as specific artistic styles. They found that it could successfully stop the computer from copying the style of specific artists, including Van Gogh and Kelly McKernan, when asked, while still allowing it to paint in other styles. This suggests that the method is not just a one-trick pony for removing nudity, but a flexible tool that can be used to remove any specific idea the user does not want the computer to generate. By focusing on the translation step and using a simple, efficient training process, the team has shown that it is possible to make these powerful tools safer without sacrificing their speed or their ability to create art.
This work represents a significant step forward in making artificial intelligence safer and more reliable. It moves away from the idea of constantly monitoring and blocking outputs, and instead builds safety directly into the way the computer understands language. The method is lightweight, requiring only a short period of training, and it leaves the rest of the system exactly as it was. For anyone relying on these tools to create content, this means a future where the computer can be trusted to follow instructions without accidentally crossing the line into harmful territory, all while keeping its creative spark intact. The researchers have made their code available, allowing others to test and build upon this approach, ensuring that the path to safer image generation remains open for further discovery.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.