이 페이지에서10 min read
개요
That shared space lets software classify, search and filter images with plain-language descriptions, and CLIP-style encoders became the visual front end of many text-to-image and multimodal chat systems.
주요 시사점
- CLIP trains an image encoder and a text encoder together so matching images and captions end up close in one shared embedding space.
- OpenAI trained CLIP on 400 million web image-text pairs with a batch size of 32,768.
- The best CLIP model reached 76.2% zero-shot ImageNet accuracy, matching a supervised ResNet-50 without using ImageNet's labeled training images.
- CLIP scores how well text matches an image; it does not generate images or captions by itself.
- Stable Diffusion v1 uses a CLIP text encoder, and LLaVA uses a CLIP image encoder feeding a language model.
- The CLIP paper documents weak spots in counting, fine-grained categories and handwritten digits, scoring 88% on MNIST.
심층 분석
CLIP, short for Contrastive Language-Image Pre-training, is a pair of neural networks described by OpenAI researchers in the paper "Learning Transferable Visual Models From Natural Language Supervision", posted to arXiv on 26 February 2021. One network, the image encoder, turns a picture into a fixed-length list of numbers called an embedding. The other, the text encoder, turns a sentence into an embedding of the same length. Training pulls the embedding of an image toward the embedding of its real caption and pushes mismatched pairs apart. CLIP does not draw images or write captions. It scores how well a piece of text describes an image, and that single ability supports classification, search, content filtering and the conditioning of image generators. A vision-language model (VLM) is the broader family of systems that process images and text together, and CLIP is the encoder much of that family was built on.
The training data came from the web. The authors assembled 400 million image-text pairs from publicly available internet sources, keeping pairs whose text contained one of 500,000 search queries and capping each query at about 20,000 pairs. In every training step a batch of N pairs (32,768 in the paper) passes through both encoders. Each output is projected by a single linear layer into the shared space and normalized to unit length. The model then computes the cosine similarity of every image with every text, an N by N grid. The N true pairs sit on the diagonal and every other cell is a negative example. A cross-entropy loss asks each row to pick its correct caption and each column to pick its correct image, and the two losses are averaged. A learned temperature scales the similarities before the softmax; the paper initializes it to the equivalent of 0.07 and clips it so logits are never multiplied by more than 100.
Zero-shot classification reuses that scoring ability without any task-specific training, which is what zero-shot means. To sort an image into 1,000 categories, write one short sentence per category, such as "a photo of a dog", embed all of them with the text encoder, embed the image, and choose the sentence with the highest similarity. The paper points out that the text embeddings behave like the weights of a linear classifier, so they are computed once and cached. Wording matters. Prompt engineering combined with an ensemble of 80 context templates improved ImageNet accuracy by almost 5 percentage points over bare class names, with the ensemble alone adding 3.5 points.
The headline results set the template for later work. OpenAI trained five ResNet and three Vision Transformer (ViT) image encoders for 32 epochs each. The largest ResNet, RN50x64, took 18 days on 592 V100 GPUs; the largest ViT took 12 days on 256 V100 GPUs. The best model, ViT-L/14 given one extra epoch at 336-pixel resolution, reached 76.2% zero-shot top-1 accuracy on ImageNet, matching the original supervised ResNet-50, and 95% top-5. On seven natural distribution-shift test sets, including ImageNet Sketch and ObjectNet, zero-shot CLIP models shrank the gap between ImageNet accuracy and shifted accuracy by up to 75%. The paper also showed smooth scaling: average zero-shot error across 39 evaluations followed a log-log linear trend over a 44x range of compute.
Milestones followed quickly. Stable Diffusion v1 used a frozen CLIP ViT-L/14 as its text encoder. The OpenCLIP project reproduced the recipe on open data such as LAION-2B and DataComp-1B. Google's SigLIP paper (March 2023) swapped the softmax loss for a pairwise sigmoid loss and, combined with locked-image tuning, reported 84.5% zero-shot ImageNet accuracy after two days on four TPUv4 chips. LLaVA (April 2023) turned CLIP into the eyes of a chat assistant: features from a pretrained CLIP ViT-L/14 pass through a projection matrix into the Vicuna language model, which was then tuned on 158,000 machine-generated instruction-following samples. Its authors report an 85.1% relative score against GPT-4 on a synthetic benchmark and 92.53% on ScienceQA when combined with GPT-4. In this design CLIP no longer makes the final decision; it supplies visual features that a large language model reads alongside text.
Compared with a supervised classifier trained on a fixed label list, CLIP trades some peak accuracy on any one benchmark for flexibility, because any category that can be described in words is a valid label. The paper measured why the contrastive design was chosen: matching whole captions learned zero-shot ImageNet transfer 4x more efficiently than predicting a bag-of-words version of the caption, which was itself 3x more efficient than a transformer predicting the exact caption. ViTs were about 3x more compute-efficient than ResNets as CLIP image encoders. Fine-tuning a CLIP model on ImageNet raised ImageNet accuracy by 9.2% but erased most of its robustness advantage on shifted data. Against SigLIP, standard CLIP needs a softmax normalized over the whole batch, while the sigmoid loss treats each image-text pair as an independent yes-or-no decision and, per its authors, outperforms softmax by a large margin below batch sizes of 16,000.
The limitations are documented in the paper itself. Zero-shot CLIP is weak at fine-grained distinctions such as car models, flower species and aircraft variants, at counting objects, and at unfamiliar tasks such as estimating the distance to the nearest car, where it can be near chance. It scored 88% on MNIST handwritten digits, below logistic regression on raw pixels, because almost no digit-like images appear in its training data, and 51% on full street-number recognition (SVHN). Because CLIP learned to read text in images, OpenAI researchers described typographic attacks in the March 2021 Distill article "Multimodal Neurons in Artificial Neural Networks", where written words in a photo can steer the classification. Web-scraped captions also carry the associations and gaps of their sources, so outputs should be audited before use in sensitive settings.
In practice, running CLIP is cheap and training it is not. Classification costs one image-encoder pass per image plus one text-encoder pass per label, and label embeddings are reused across all images. Search systems store image embeddings in a vector index and compare each query by cosine similarity. Training from scratch is the expensive part: the original runs used hundreds of V100 GPUs for up to 18 days, and a batch of 32,768 forced the similarity computation to be sharded across GPUs. SigLIP found that a batch of about 32,000 is sufficient and that gains fade as batches grow toward one million, which lowers the bar for smaller labs. Most practitioners start from released weights, such as OpenAI's checkpoints or OpenCLIP models, and add a small trained linear layer when zero-shot accuracy is not enough.
04실제 사례
Zero-shot classification of one photo with CLIP
Load a released CLIP checkpoint, for example an OpenAI ViT-B/32 or an OpenCLIP model, together with its image preprocessing and tokenizer.
Write one prompt per candidate label, such as 'a photo of a cat', 'a photo of a dog' and 'a photo of a car'.
Run the prompts through the text encoder and L2-normalize the three resulting embeddings; cache them for reuse.
Resize and crop the photo with the model's preprocessing, run it through the image encoder, and L2-normalize the embedding.
Compute the dot product between the image embedding and each text embedding, multiply by the model's learned scale, and apply a softmax.
Read off the label with the highest probability, then add more template wordings and average their embeddings to see whether the prediction stabilizes.
그것이 보여주는 것
A probability for each label, computed without any task-specific training. To check it, run a small labeled set of your own images through the same steps and compare accuracy with and without prompt ensembling; the CLIP paper reports that ensembling helps on ImageNet.
실제 구현
Stable Diffusion v1-4 conditions its image generator on a frozen, pretrained CLIP ViT-L/14 text encoder, so the prompt a user types becomes CLIP text embeddings before any denoising starts.
LLaVA (2023) connects a pretrained CLIP ViT-L/14 image encoder to the Vicuna language model through a simple projection matrix, letting a chat model answer questions about photos.
Zero-shot image classification: the original CLIP paper reports 76.2% top-1 ImageNet accuracy from class names alone, without training on any of ImageNet's 1.28 million labeled images.
Text-to-image search over a photo collection: every image is embedded once, a query such as 'a red bicycle in snow' is embedded at search time, and results are ranked by cosine similarity.
Open reproductions such as OpenCLIP train CLIP-style models on public datasets; its ViT-bigG-14 trained on LAION-2B reports 80.1% zero-shot ImageNet accuracy in the project README.
CLIP과 Vision-Language 모델의 미래
Several research directions grew directly out of CLIP's documented weaknesses. Data quality is one: the OpenCLIP project reports that the same architecture trained on different public datasets, for example LAION-2B versus DataComp-1B, reaches noticeably different zero-shot accuracy, so dataset curation has become a research topic of its own. Loss design is another: the 2023 SigLIP paper showed that a sigmoid loss decouples batch size from normalization and found little benefit beyond batches of about 32,000, shifting attention from raw scale to efficiency. The largest shift is in how the encoders are used. Since LLaVA's April 2023 release, a common recipe is to keep a contrastively trained image encoder and project its features into a large language model, so open questions now include how to preserve fine detail, text in images and spatial relations that a single global embedding discards. The weaknesses listed in the 2021 paper, such as counting, fine-grained categories and typographic attacks, remain useful test cases for any new vision-language model, and published evaluations rather than marketing claims are the reliable way to judge whether a newer system has closed them.
실천에 옮기기
왜 중요한가요?
- 속도와 규모. Visual AI는 대규모 검사, 감지 및 태그 지정 작업을 자동화할 수 있습니다.
- 빌드 선택. 크리에이티브 팀은 수동 수정 횟수를 줄여 컨셉의 프로토타입을 더 빠르게 제작할 수 있습니다.
- 팀과 워크플로우. 이전에는 처리하기 어려웠던 이미지 및 비디오 신호를 작업에 사용할 수 있습니다.
조심하세요
- 출처가 불분명할 경우 이미지 권리 및 동의는 법적 위험이 될 수 있습니다.
- 모델 성능은 조명, 인구통계, 환경에 따라 달라질 수 있습니다.
- 신뢰도 임계값을 모니터링하지 않으면 거짓양성이 발견되지 않을 수 있습니다.
다음 단계
- 정밀도, 재현율, 오류 비용에 대한 허용 기준을 정의합니다.
- 실제 생산 조건과 일치하는 데이터로 테스트합니다.
- 신뢰도가 낮거나 영향력이 큰 예측에 대해 인적 검토를 추가합니다.
- 모델 드리프트를 추적하고 카메라 또는 데이터 세트가 변경된 후 재검증합니다.
출처 및 추가 자료
- arXiv (OpenAI)Learning Transferable Visual Models From Natural Language Supervision
- arXiv (Google)Sigmoid Loss for Language Image Pre-Training
- arXiv (NeurIPS 2023)Visual Instruction Tuning
- LLaVA project pageLLaVA: Large Language and Vision Assistant
- GitHub (mlfoundations)OpenCLIP: An open source implementation of CLIP
- DistillMultimodal Neurons in Artificial Neural Networks
- Hugging FaceCompVis/stable-diffusion-v1-4 model card
계속 탐색하세요
무료 뉴스레터
일일 AI 브리핑 받기
매주 평일 아침마다 3개의 검증된 AI 스토리를 일반 영어로 작성합니다. 무료이며, 광고 없음.
매주 평일마다 한 번 이메일을 받습니다. 한 번 클릭으로 구독 해지. 주소를 판매하거나 공유하지 않습니다.
자신을 테스트해 보세요
Take the CLIP and Vision-Language Models quiz
모든 답변에 즉각적인 피드백과, 과정을 통과하면 검증 가능한 ID가 있는 공유 가능한 인증서를 제공합니다.
무료 AI 교육을 지원합니다. AI Understanding는 501(c)(3) 비영리 단체입니다 — 광고 없음, 유료 장벽 없음, 영원히. 기부하기
자주 묻는 질문
What is CLIP and Vision-Language Models?
CLIP (Contrastive Language-Image Pre-training) is a 2021 OpenAI model that trains an image encoder and a text encoder to place matching pictures and captions close together in one shared vector space. That shared space lets software classify, search and filter images with plain-language descriptions, and CLIP-style encoders became the visual front end of many text-to-image and multimodal chat systems.
CLIP의 핵심 아이디어는 무엇인가요?
CLIP은 이미지와 텍스트를 하나의 공유 벡터 공간으로 매핑하므로 유사성을 직접 측정할 수 있습니다.
CLIP은 어떤 교육 접근 방식을 사용합니까?
CLIP은 대조 목표를 사용합니다. 올바른 이미지-캡션 쌍은 가까이 당겨지고 일치하지 않는 쌍은 떨어져 나옵니다.
What does zero-shot classification mean in the original CLIP transfer setup?
CLIP has substantial pretraining; zero-shot is scoped to the target classification evaluation.
CLIP은 이미지와 캡션이 일치하는지 어떻게 측정하나요?
CLIP은 각각을 벡터로 인코딩하고 코사인 유사성을 계산합니다. 유사성이 높을수록 의미론적으로 더 밀접하게 일치함을 의미합니다.
CLIP은 대략 얼마나 많은 데이터를 학습했나요?
CLIP은 인터넷에서 수집된 약 4억 개의 이미지-캡션 쌍을 통해 학습하여 광범위한 시각적 언어 지식을 제공합니다.