zer0int/CLIP-adversarial-typographic-attack_text-image

Dataset

CLIP-adversarial-typographic-attack_text-image

3

3 commits

2 linked in READMEs

updated Dec 7, 2024

See the code

README

CLIP-adversarial-typographic-attack_text-image

A typographic attack dataset for CLIP. For adversarial training & model research / XAI (research) use.

  • First 47 are random and self-made images, rest are from dataset: SPRIGHT-T2I/spright_coco. Of which:
  • Images are selected for pre-trained OpenAI/CLIP ViT-L/14 features; for highly salient 'text related' concepts via Sparse Autoencoder (SAE).
  • Labels via CLIP ViT-L/14 gradient ascent -> optimize text embeddings for cosine similarity with image embeddings.
  • Alas a text AND image aligned typographic attack dataset (texts optimized for CLIP cosine similarity, not human interpretability).
  • Texts are unfiltered "as-is" / as sampled from CLIP. Contains potentially offensive labels due to nature of dataset. Use responsibly!
  • Only text files included - because nobody wants to download embedding.pt pickle files (and for good reason).
  • You can use my provided code to safely batch-generate gradient ascent embeddings yourself: github.com/zer0int/CLIP-gradient-ascent-embeddings
  • PS: The code works with my .safetensors CLIP fine-tunes / custom fine-tunes as well. Feedback or contribution on GitHub very welcome! 👍

Example of gradient ascent labeling process with images that are, quite apparently, well-chosen for typographic vulnerability exploitation via the SAE:

image/png

adversarial
attack
CLIP
typographic

Contributors

zer0int

3 commits

zer0int/CLIP-adversarial-typographic-attack_text-image

Dataset

CLIP-adversarial-typographic-attack_text-image

3

3 commits

2 linked in READMEs

updated Dec 7, 2024

See the code

README

CLIP-adversarial-typographic-attack_text-image

A typographic attack dataset for CLIP. For adversarial training & model research / XAI (research) use.

  • First 47 are random and self-made images, rest are from dataset: SPRIGHT-T2I/spright_coco. Of which:
  • Images are selected for pre-trained OpenAI/CLIP ViT-L/14 features; for highly salient 'text related' concepts via Sparse Autoencoder (SAE).
  • Labels via CLIP ViT-L/14 gradient ascent -> optimize text embeddings for cosine similarity with image embeddings.
  • Alas a text AND image aligned typographic attack dataset (texts optimized for CLIP cosine similarity, not human interpretability).
  • Texts are unfiltered "as-is" / as sampled from CLIP. Contains potentially offensive labels due to nature of dataset. Use responsibly!
  • Only text files included - because nobody wants to download embedding.pt pickle files (and for good reason).
  • You can use my provided code to safely batch-generate gradient ascent embeddings yourself: github.com/zer0int/CLIP-gradient-ascent-embeddings
  • PS: The code works with my .safetensors CLIP fine-tunes / custom fine-tunes as well. Feedback or contribution on GitHub very welcome! 👍

Example of gradient ascent labeling process with images that are, quite apparently, well-chosen for typographic vulnerability exploitation via the SAE:

image/png

adversarial
attack
CLIP
typographic

Contributors

zer0int

3 commits