Jun-Hyun Bae, Wonyong Jo, Jaehyup Lee, Heechul Jung
Kyungpook National University
Presentation
Abstract
Text-to-image diffusion models utilize cross-attention to integrate textual information into the visual latent space, yet the transformation from text embeddings to latent features remains largely unexplored. We provide a mechanistic analysis of the output-value (OV) circuits within cross-attention layers through spectral analysis via singular value decomposition. Our analysis demonstrates that semantic concepts are encoded in low-dimensional subspaces spanned by singular vectors in OV circuits across cross-attention heads. To verify this, we intervene on concept-related components in the diffusion process, demonstrating that intervention on identified spectral components affects conceptual changes. We further validate these findings by examining visual outputs of isolated subspaces and their alignment with text embedding space. Through this mechanistic understanding, we demonstrate that simply nullifying these spectral components can achieve targeted concept removal with performance comparable to existing methods while providing interpretability.
Overview
Cross-attention์ OV circuit์ด ํ ์คํธ๋ฅผ ์ด๋ป๊ฒ ์๊ฐ ํน์ง์ผ๋ก ๋ณํํ๋์ง ๋ฐํ๊ณ , ์ด๋ฅผ ํ์ฉํด ์ฌํ์ต ์์ด ๊ฐ๋ ์ ์ ๊ฑฐํ๋ ๋ฐฉ๋ฒ์ ์ ์ํ๋ค.
- Spectral Decomposition โ \(\mathbf{W}_{\text{OV}}\) ๋ฅผ SVD๋ก ๋ถํดํ์ฌ ๋ ๋ฆฝ์ ์ธ text-to-visual ๋ณํ ๊ฒฝ๋ก๋ฅผ ์ถ์ถํ๋ค.
- Concept Localization โ “๊ณ ํ ์คํ์ผ”, “nudity” ๋ฑ์ ์๋ฏธ ๊ฐ๋ ์ด ์ ์ฒด spectrum ์ค ์์์ spectral component์ ์ง์ค๋์ด ์์์ ๋ฐ๊ฒฌํ๋ค.
- Spectral Nullification โ ํด๋น component๋ง ์ ๊ฑฐํ๋ฉด ์ฌํ์ต ์์ด๋ ๊ธฐ์กด ๋ฐฉ๋ฒ๊ณผ ๋น์ทํ ์์ค์ targeted concept removal์ด ๊ฐ๋ฅํ๋ค.

๊ฐ ๊ฐ๋ ์ spectral component๋ง ํ์ฑํํ ๊ฒฐ๊ณผ. ์คํ์ผ ๊ฐ๋ (Van Gogh, Picasso)์ ์ง๊ฐยท์๊ฐ ๋ฑ ์๊ฐ ํจํด์ผ๋ก ๋ถํด๋๋ ๋ฐ๋ฉด, ์ฝํ ์ธ ๊ฐ๋ (Nudity)์ ์ธ์ฒด ํํ๋ฅผ ํฌํจํ๋ holisticํ ํํ์ ๋ณด์ธ๋ค. ์ด๋ ๋ชจ๋ธ์ด ๊ฐ๋ ์ ํ์ ๋ฐ๋ผ ์ง์ ์ผ๋ก ๋ค๋ฅธ ์ธ์ฝ๋ฉ ๋ฐฉ์์ ์ฌ์ฉํจ์ ์์ฌํ๋ค.
Method
Cross-attention์์ ํ ์คํธ๋ฅผ ์๊ฐ ํน์ง์ผ๋ก ๋ณํํ๋ ํต์ฌ์ \(\mathbf{W}_{\text{OV}}\) ํ๋ ฌ์ด๋ค. Text embedding์ ์๋ฏธ ์ ๋ณด๋ฅผ ๊ณ ์ ํ ์ถ(semantic axes)์ ๋ฐ๋ผ ์กฐ์งํ๋๋ฐ, \(\mathbf{W}_{\text{OV}}\) ๋ ์ด ์ถ์ ์ ๋ ฌ๋ ์ ์ฐจ์ subspace๋ฅผ ํตํด ๊ฐ๋ ๋ณ ๋ณํ์ ์ํํ๋ค. ์ด ํ๋ ฌ์ SVD๋ก ๋ถํดํ๋ฉด ๊ฐ spectral component๊ฐ text-to-visual์ ๋ ๋ฆฝ๋ ๋ณํ ๊ฒฝ๋ก๊ฐ ๋๋ฉฐ, “๊ณ ํ ์คํ์ผ"์ด๋ “nudity” ๊ฐ์ ์๋ฏธ ๊ฐ๋ ์ ์ ์ฒด spectrum ์ค ์์์ component์ ์ง์ค๋์ด ์๋ค.
ํน์ ๊ฐ๋ ์ ๋ํด high-contribution head๋ ์ ์ฒด์ ์ฝ 10%์ ๋ถ๊ณผํ๋ฉฐ, ํด๋น head์ ์ถ๋ ฅ์ ์ค์ผ์ผ๋งํ๋ฉด ๊ฐ๋ ์ ๊ฐ๋๋ฅผ ์กฐ์ ํ ์ ์๋ค.

"Van Gogh" ๊ฐ๋ ์ high-contribution head(์ ์ฒด์ ~10%) ์ถ๋ ฅ์ $\alpha$๋ก ์ค์ผ์ผ๋ง.
๊ทธ๋ฌ๋ head ์์ค์ ์กฐ์์ ์ ๋ฐ๋์ ํ๊ณ๊ฐ ์๋ค. ํ๋์ attention head๊ฐ ์ฌ๋ฌ ๊ฐ๋ ์ ๋์์ ์ธ์ฝ๋ฉํ๊ณ ์์ผ๋ฏ๋ก(polysemanticity), head ์ ์ฒด๋ฅผ ์ค์ผ์ผ๋งํ๋ฉด ์๋ํ์ง ์์ ๊ฐ๋ ๊น์ง ํจ๊ป ๋ณํ๋ค. Spectral component ๋จ์๋ก ์กฐ์ํ๋ฉด ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ ์ ์์ผ๋ฉฐ, ์คํ์ผ๊ณผ ์ฝํ ์ธ ์ฒ๋ผ ์๋ก ๋ค๋ฅธ ๊ฐ๋ ์ฐจ์์ ๋ถ๋ฆฌํ์ฌ ๋ ๋ฆฝ์ ์ผ๋ก ์กฐ์ ํ ์ ์๋ค.

Spectral modulation (์) vs head-level modulation (์๋). Head ์ ์ฒด๋ฅผ ์กฐ์ํ๋ฉด ๊ฐ๋ ์ธ์ ๊ฒ๋ ๊ฐ์ด ๋ฐ๋์ง๋ง, spectral component ๋จ์๋ก ์กฐ์ํ๋ฉด ํด๋น ๊ฐ๋ ๋ง ์ ๋ฐํ๊ฒ ์ ์ด๋๋ค.
์๋ ๊ทธ๋ฆผ์ ์ ์ฒด head์ ๊ฑธ์น concept contribution์ ๋ถํฌ๋ฅผ ๋ณด์ฌ์ค๋ค. ๋๋ถ๋ถ์ head๋ ํน์ ๊ฐ๋ ์ ๊ฑฐ์ ๊ธฐ์ฌํ์ง ์์ผ๋ฉฐ, ์์์ head๋ง์ด ๋์ ๊ธฐ์ฌ๋ฅผ ๋ณด์ธ๋ค. ๋ํ ๊ฐ์ head ์์์๋ Van Gogh, Monet, Picasso๋ ์๋ก ๋ค๋ฅธ singular vector๋ฅผ ํ์ฑํํ๋ฉฐ, ๋์ ๊ธฐ์ฌ๋ฅผ ํ๋ singular vector๊ฐ ๋ฐ๋์ singular value๊ฐ ํฐ ๊ฒ(๋ฎ์ ์ธ๋ฑ์ค)์ ์๋๋ค. ๊ฐ๋ ๋ง๋ค ๊ณ ์ ํ ํ์ฑํ ํจํด์ ๋ณด์ธ๋ค.

Head๋ณ concept contribution ๋ถํฌ. ์์์ high-contribution head์ ๊ฐ๋ ์ ๋ณด๊ฐ ์ง์ค๋์ด ์๋ค.
Results
Concept Removal Benchmark
Spectral Nullification(SN)์ NSFW ๊ฐ๋ ์ ๊ฑฐ ์ฑ๋ฅ์ 5๊ฐ adversarial prompt ๋ฒค์น๋งํฌ์์ ํ๊ฐํ๋ค. Ring-A-Bell(K16, K38, K77)๊ณผ I2PยทMMAยทP4DยทUnLearnDiffAtk์ ํฌํจํ๋ฉฐ, ํ๊ฐ ๋ฉํธ๋ฆญ์ Attack Success Rate (ASR, ๋ฎ์์๋ก ์ข์)์ด๋ค.
Attack Success Rate (%, โ) across adversarial benchmarks์ ์์ฑ ํ์ง(FIDโ, COCO ์บก์ 1,000๊ฐ). ASR ์ด์ ์ต์ ๊ฐ์ bold, 2์๋ underline. ๋ฐฉ๋ฒ ์ ํ์ ๋ฐฐ๊ฒฝ์์ผ๋ก ๊ตฌ๋ถํ๋ค โ ํ์: training-based, ํ๋: closed-form, ์ด๋ก: inference-time, ์งํ ํ๋: spectral.
| Method | Ring-A-Bell | I2P | MMA | P4D | UnLearn | FID โ | ||
|---|---|---|---|---|---|---|---|---|
| K16 | K38 | K77 | ||||||
| SD v1.4 | 97.89 | 94.74 | 87.37 | 25.03 | 68.10 | 69.76 | 50.70 | โ |
| ESD | 76.84 | 78.95 | 74.74 | 13.04 | 24.80 | 50.24 | 26.06 | 38.95 |
| CA | 88.42 | 88.42 | 84.21 | 19.30 | 58.50 | 63.41 | 44.37 | 26.02 |
| MACE | 89.47 | 95.79 | 93.68 | 25.56 | 66.00 | 68.29 | 50.70 | 33.38 |
| SDID | 95.79 | 91.58 | 84.21 | 23.12 | 62.00 | 66.83 | 48.59 | 39.74 |
| UCE | 22.11 | 18.95 | 21.05 | 8.06 | 41.00 | 38.05 | 21.13 | 34.43 |
| RECE | 10.53 | 9.47 | 7.37 | 4.24 | 25.00 | 21.46 | 9.15 | 40.00 |
| SLD-Medium | 68.42 | 60.00 | 50.53 | 8.38 | 48.70 | 43.90 | 23.94 | 32.09 |
| SLD-Strong | 18.95 | 10.53 | 6.32 | 2.33 | 7.70 | 11.71 | 7.04 | 41.34 |
| SAFREE | 65.26 | 55.79 | 45.26 | 6.26 | 29.90 | 38.54 | 14.79 | 40.71 |
| SN (Ours) | 41.05 | 35.79 | 30.53 | 4.24 | 17.60 | 18.54 | 8.45 | 40.67 |
SN์ I2P์์ RECE์ ๋๋ฅ (4.2%), MMAยทP4DยทUnLearnDiffAtk์์ ๊ฐ๊ฐ 2์๋ฅผ ๊ธฐ๋กํ๋ค. ์ ์ฒด 1์์ธ SLD-Strong์ inference-time guidance๋ก ์์ฑ ๊ณผ์ ์ ๋ฐ์ ๊ฐ์ ํ๋ ๋ฐฉ๋ฒ์ด๋ฉฐ, SN์ ์ถ๊ฐ ํ์ต ์์ด ํ๋ ฌ์ spectral component๋ง ์ ๊ฑฐํ๋ ๊ฒ์ด๋ฏ๋ก ์ ๊ทผ ๋ฐฉ์์ด ๊ทผ๋ณธ์ ์ผ๋ก ๋ค๋ฅด๋ค. ํนํ SN์ด ์ถ๊ฐ ํ์ต ์์ด ํ ์ด๋ธ์ ์ ์๋ training-based ๋ฐฉ๋ฒ๋ค(ESD, CA, MACE, SDID)์ ํฌํจํ์ฌ ๋ชจ๋ ์ฌํ์ต ๊ธฐ๋ฐ ๋ฐฉ๋ฒ์ ๋ฅ๊ฐํ๋ค๋ ์ ์ด ์ฃผ๋ชฉํ ๋งํ๋ค. ์์ฑ ํ์ง ์ธก๋ฉด์์๋ SN์ FID 40.67๋ก ๊ธฐ์กด ๋ฐฉ๋ฒ๋ค๊ณผ ๋๋ฑํ ์์ค์ ์ ์งํ์ฌ, ํ์ง-์ ๊ฑฐ trade-off์์ ๊ฒฝ์๋ ฅ์ ๋ณด์ธ๋ค.

Concept removal ์ฑ๋ฅ(P4D ASR) vs ์์ฑ ํ์ง(CLIP score). SN์ ์ฌํ์ต ์์ด ๊ธฐ์กด ๋ฐฉ๋ฒ๊ณผ ๋น์ทํ trade-off๋ฅผ ๋ฌ์ฑํ๋ค. SLD-Strong์ด ASR์ ๊ฐ์ฅ ๋ฎ์ง๋ง, ์์ฑ ํ์ง๋ ํจ๊ป ํ๋ฝํ๋ค.
Spectral Subspace์ ์๋ฏธ ๊ฒ์ฆ
์๋ณ๋ spectral subspace๊ฐ ์ค์ ๋ก ํด๋น ๊ฐ๋ ์ ์๋ฏธ๋ฅผ ํฌ์ฐฉํ๊ณ ์๋์ง๋ฅผ ๋ ๊ฐ์ง ๋ฐฉ์์ผ๋ก ๊ฒ์ฆํ๋ค.
ํ ์คํธ ๊ณต๊ฐ ์ ๋ ฌ: Concept-specific spectral component๋ก ํ ์คํธ ์ฐจ์ด ๋ฒกํฐ๋ฅผ reconstructionํ ๋ค, CLIP ์ดํ 49,408๊ฐ ํ ํฐ๊ณผ์ cosine similarity๋ฅผ ๋น๊ตํ๋ค. Nudity ๊ฐ๋ ์ ๊ฒฝ์ฐ “nude”, “naked”, “topless”, “erotica”, “nsfw” ๋ฑ์ด ์์์ ์ ๋ ฌ๋๋ฉฐ, spectral subspace๊ฐ ํด๋น ์๋ฏธ๋ฅผ ์ ํํ ํฌ์ฐฉํ๊ณ ์์์ ํ์ธํ ์ ์๋ค.

Concept spectral component๋ก reconstructionํ ๋ฒกํฐ์ CLIP ์ดํ์ cosine similarity. ํด๋น ๊ฐ๋ ์ ํ ํฐ๋ค์ด ์์์ ์ ๋ ฌ๋๋ค.
์ธ๊ณผ์ ๊ฒ์ฆ(t-SNE) ๋ฐ ๊ฐ๋ ๊ฐ ๊ตฌ์กฐ(Jaccard): ๊ฐ๋ ๊ด๋ จ spectral component๋ฅผ ์ ๊ฑฐํ๋ฉด, head output์ t-SNE์์ base/concept prompt ํด๋ฌ์คํฐ๊ฐ ํฉ์ณ์ง๋ค. ์ด๋ ํด๋น component๋ค์ด ์ค์ ๋ก ๊ฐ๋ ์ ์ธ์ฝ๋ฉํ๊ณ ์์์ ๋ณด์ฌ์ฃผ๋ ์ธ๊ณผ์ ์ฆ๊ฑฐ์ด๋ค. Jaccard similarity ๋ถ์์์๋ ์๋ฏธ์ ์ผ๋ก ์ ์ฌํ ๊ฐ๋ (Van GoghโMonet)์ด spectral component๋ฅผ ๋ ๋ง์ด ๊ณต์ ํ๋ฉด์๋, ๊ฐ ๊ฐ๋ ์ ๊ณ ์ ํ spectral signature๋ฅผ ์ ์งํ๋ ๊ฒ์ผ๋ก ๋ํ๋๋ค.

(a) Spectral component ์ ๊ฑฐ ์ ํ์ t-SNE. ์ ๊ฑฐ ํ base/concept ํด๋ฌ์คํฐ๊ฐ ํฉ์ณ์ง๋ค. (b) ๊ฐ๋ ๊ฐ Jaccard similarity. ์ ์ฌํ ๊ฐ๋ ๋ผ๋ฆฌ ๊ฒน์น์ง๋ง, ๊ฐ ๊ฐ๋ ์ ๊ณ ์ ํ signature๋ฅผ ์ ์งํ๋ค.
Qualitative
I2P benchmark์ adversarial prompt์ ๋ํด SN์ ์ ์ฉํ ๊ฒฐ๊ณผ, ๋ถ์ ์ ํ ์ฝํ ์ธ ๊ฐ ํจ๊ณผ์ ์ผ๋ก ์ ๊ฑฐ๋๋ค.

I2P benchmark adversarial prompt ๊ฒฐ๊ณผ. ์ผ์ชฝ: SD v1.4 (SN ์ ์ฉ ์ ), ์ค๋ฅธ์ชฝ: SN ์ ์ฉ ํ.
Scalability & Practical Notes
- SD v2.1: 195๊ฐ cross-attention head, 16๊ฐ layer, 12,480๊ฐ singular vector. Top-20% component nullification์ผ๋ก ๊ฐ๋ ์ ๊ฑฐ.
- SDXL: 70๊ฐ cross-attention layer, 83,200๊ฐ singular vector (6.67๋ฐฐ ์ฆ๊ฐ). ๊ฐ๋ ์ด ๋ ๋๊ฒ ๋ถํฌํ์ฌ 20โ30% ์ ๊ฑฐ๊ฐ ํ์ํ์ง๋ง, subspace localization์ ์ ์ง๋๋ค.
- ๊ณ์ฐ ๋น์ฉ: 4๊ฐ prompt pair์ ๋ํ ์ ์ฒด SVD ๋ถํด๊ฐ A100 GPU์์ 33์ด. ๋ถํด๋ ํ๋ ฌ ์บ์ ํฌ๊ธฐ 2.17GB. ์ถ๊ฐ ํ์ต ์์.