techlist.io

Zero Shot Learning

3 posts

OpenAI2021-01-044 min readCurated summary

CLIP: Connecting text and images

# CLIP: Connecting Text and Images OpenAI's CLIP (Contrastive Language–Image Pre-training) is a neural network that learns visual concepts from text paired with images found on the internet, rather than from manually labeled datasets. Because it is trained to match images with natural-language descriptions, it can be applied to new image classification tasks simply by supplying the category names, without task-specific training. The authors argue this zero-shot approach produces benchmark results that better reflect real-world performance, since the model is never optimized directly for the benchmark. ## Problems with Standard Computer Vision Models - Labeled vision datasets are expensive to build and cover only a fixed set of predetermined concepts. ImageNet required over 25,000 workers to annotate 14 million images across 22,000 categories. - Standard models are narrow. An ImageNet model handles its 1,000 categories well but needs a new dataset, a new output head, and fine-tuning for any other task. - Benchmark scores overstate real-world performance. Models that look superhuman on benchmarks often fail on stress tests, which the authors attribute to models effectively "studying for the test." ## How CLIP Works - CLIP is trained on a proxy task: given an image, predict which of 32,768 randomly sampled text snippets was actually paired with it. - Solving this forces the model to learn many visual concepts and associate them with their names. - For classification, the category names are turned into text prompts (e.g., "a photo of a dog" vs. "a photo of a cat"), and the model picks the prompt most likely to match the image. ## Background and Prior Work - Zero-data learning has been studied for over a decade, but natural language as a flexible prediction space was a key insight. - Socher et al. (2013) showed a model trained on CIFAR-10 could predict two unseen classes by using word vector embeddings. - DeVISE (2013) extended this to generalize beyond ImageNet's 1,000 training classes. - Li et al. (2016/2017) were the most direct inspiration. They trained on 30 million Flickr photos with their titles, descriptions, and tags, reaching 11.5% zero-shot accuracy on ImageNet. - Recent work such as VirTex, ICMLM, and ConVIRT explored related language-supervised objectives using Transformers, with ConVIRT applying a contrastive objective to medical imaging. ## Key Results **Efficiency** - A contrastive objective (matching images to text) was 4x to 10x more efficient than an image-to-text approach for zero-shot ImageNet classification in small to medium experiments. - Switching from a standard ResNet to a Vision Transformer gave a further 3x compute efficiency gain. - The best model trained on 256 GPUs for 2 weeks. **Flexibility** - Zero-shot performance was measured across more than 30 datasets, including fine-grained object classification, geo-localization, video action recognition, and OCR. - With linear probes, the best CLIP model outperformed the best public ImageNet model (Noisy Student EfficientNet-L2) on 20 of 26 transfer datasets. - Fitting a linear classifier on ImageNet raised CLIP's ImageNet test accuracy by nearly 10%, but gave no average gain across seven other robustness datasets. This supports the authors' "cheating hypothesis." - CLIP closes the robustness gap by up to 75% while matching the original ResNet-50's ImageNet accuracy zero-shot, without using any of its 1.28M labeled training examples. ## Limitations - CLIP struggles with abstract or systematic tasks such as counting objects or estimating distance to the nearest car, where it is only slightly better than random guessing. - It lags task-specific models on fine-grained classification, such as car models, aircraft variants, and flower species. - Generalization is limited. On handwritten MNIST digits, zero-shot CLIP reaches 88% accuracy versus 99.75% for humans. - Performance can be sensitive to wording, sometimes requiring trial-and-error "prompt engineering." ## Broader Impacts - Class design strongly affects bias. With FairFace race labels and a few offensive terms, about 32.3% of images of people aged 0–20 were classified into the offensive category. Adding a "child" class reduced this to about 8.7%. - Celebrity identification reached 59.2% top-1 accuracy among 100 candidates and 43.3% among 1,000. This is not competitive with production systems, but it raises privacy and surveillance concerns that the authors flag for further research. ## Conclusion The authors show that task-agnostic pre-training on internet-scale natural language, which drove recent progress in NLP, can also improve computer vision. Like the GPT models, CLIP learns many tasks during pre-training and transfers to them zero-shot. The authors also argue that zero-shot evaluation gives a more representative measure of a model's capability.

OpenAI2019-02-133 min readCurated summary

Better language models and their implications

# Better Language Models and Their Implications OpenAI introduces GPT-2, a 1.5 billion parameter transformer language model trained only to predict the next word across 40GB of internet text. It produces coherent paragraphs and performs basic reading comprehension, translation, question answering, and summarization without task-specific training. Because of concerns about malicious uses such as fake news, impersonation, and spam, OpenAI withholds the full model and releases a smaller version as an experiment in staged, responsible disclosure. ## Model Design and Training - GPT-2 is a transformer-based model with 1.5 billion parameters, a direct scale-up of GPT with more than 10x the parameters and more than 10x the training data. - It was trained on WebText, a new dataset of about 8 million web pages. The authors scraped outbound Reddit links with at least 3 karma, using human curation as a quality signal. - The training objective is simply to predict the next word given all previous words. Because the data is diverse, this objective implicitly contains demonstrations of many tasks. ## Capabilities and Zero-Shot Results - Given a prompt, the model generates long, coherent continuations that adapt to the style and content of the input. Sample quality was roughly 50% reasonable for well-represented topics, and worse for technical or esoteric ones. - Without any domain-specific training, GPT-2 reached state-of-the-art results on several language modeling benchmarks, including LAMBADA (63.24% accuracy, down from a previous record of 59.23%), Winograd Schema Challenge (70.70%), and WikiText-2 perplexity (18.34, down from 39.14). - On question answering, reading comprehension, summarization, and translation, it showed promising but non-state-of-the-art results, suggesting these tasks can benefit from unsupervised learning given enough data and compute. - Known failure modes include repetitive text, world-modeling errors (such as fires under water), and unnatural topic switches. ## Policy Concerns - Plausible beneficial uses include writing assistants, better dialogue agents, unsupervised translation, and improved speech recognition. - Plausible malicious uses include generating misleading news, impersonating people online, automating abusive content and spam or phishing. - The authors argue that such models lower the cost of producing convincing fake content, so the public will need to become more skeptical of online text, much as with deepfake images. ## Staged Release Strategy - The full model, training code, and weights were withheld. A smaller 117M version and sampling code were released first. - The May 2019 interim update released a 345M version as the next stage, while sharing the 762M and 1.5B versions with partners in the AI and security communities. - The team also released an output dataset of about 250,000 samples per model and hyperparameter setting, plus a WebText subset and baseline detection analysis, to support research into detection and misuse. - The authors frame this as an experiment in publication norms, drawing on practices from biotechnology and cybersecurity, and they promised a fuller analysis of societal implications after six months. ## Conclusion The post argues that large language models are becoming powerful enough to pose real misuse risks, so AI labs should weigh publication decisions carefully. Staged release and partner sharing are presented as a way to give the community time to study detection, bias, and misuse before broader release.