CLIP score (Hessel, Holtzman, Forbes, Le Bras and Choi, 2021) is the cosine similarity between an image embedding and a text embedding in the shared space that a contrastively trained model (Radford and co-authors, 2021) learns.
I cannot train such a model here, so I built the simplest object with the same interface. ImageEncoderRidge maps the 64 pixels to the 12-dimensional prompt-embedding space by ridge regression, and the score is the cosine of that image embedding with the prompt embedding. It shares one property with the real thing that matters for this section: it is a fixed function of the image and the prompt, differentiable and cheap, so it can be optimized.
On real test images the score is 0.902 with the right prompt and 0.369 with a wrong one, and the best of the ten prompts is the right one for 0.775 of the images (zero-shot accuracy). That is a working scorer. Then the score is gamed in three ways that need no adversary beyond a model that is trained to please it.
First, a model can beat real data. Diffusion samples at score 0.925, above the real images. Second, a model with no diversity at all does even better: the class-mean images score 0.974. Third, gradient ascent on the pixels, starting from gray, reaches a score between 0.9993 and 1.0000 for all ten prompts. The optimized images are far from the data: the median distance to the nearest training image is 2.82, against 1.01 for real test images, and only 0.019 of their pixels are saturated (within 0.01 of 0 or 1), against 0.585 for real digits. The logistic classifier on pixels agrees with the intended digit on 10 of 10, which is unsurprising because it is also nearly linear in pixels, while the independent MLP agrees on 7 of 10. The score alone cannot tell a handwritten digit from a smooth pattern that happens to point in the same direction in embedding space.
The principle: an alignment score is evidence about alignment only for samples produced by a process that was not optimized against it. A model trained, tuned, reranked or guided with the scorer needs a different scorer for evaluation, preferably a human study.
Continue with the book
Explore the full treatment, worked examples, and exercises in Applied AI for Generation and Control.
Companion article for Applied AI for Generation and Control, published by Choral Software. Article text and original examples © 2026 Choral Software. All rights reserved.
