The author asks: > Has the model ever seen cosine similarity? Yes - most of the time, at least for deep learning based semantic search. E.g. for semantic search of text, the majority are using, SentenceTransformers [1], models which have been trained to use cosine similarity. Or e.g. for vector representations of images, people are using models like CLIP [2], which has again been trained to use cosine similarity. (Cosine similarity being used in the training loss, so the whole model is fundamentally "tuned" for cosine similarity.) Articles like these cause confusion, e.g. I've come across people saying: "You shouldn't use cosine similarity", when they've seen SentenceTransformers being used, and linking articles like these, when in fact you very much should be using cosine similarity with those models. [1] https://sbert.net [2] https://arxiv.org/abs/2103.00020
Learning Transferable Visual Models From Natural Language Supervision
Alec Radford, Jong Wook Kim, Chris Hallacy
Show all 12 authors
Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, Ilya Sutskever
2021 · arXiv
- HN score
- 0
- Mentions
- 10
- Readers
- 7
- Months
- 7
From the abstract
State-of-the-art computer vision systems are trained to predict a fixed set of predetermined object categories. This restricted form of supervision limits their generality and usability since additional labeled data is needed to specify any other visual concept. Learning directly from raw text about images is a promising alternative which leverages a much broader source of supervision. We demonstrate that the simple pre-training task of predicting which caption goes with which image is an efficient and scalable way to learn SOTA image representations from scratch on a dataset of 400 million (image, text) pairs collected from the internet. After pre-training, natural language is used to reference learned visual concepts (or describe new ones) enabling zero-shot transfer of the model to downstream tasks. We study the performance of this approach by benchmarking on over 30 different existing computer vision datasets, spanning tasks such as OCR, action recognition in videos, geo-localization, and many types of fine-grained object classification. The model transfers non-trivially to most tasks and is often competitive with a fully supervised baseline without the need for any dataset specific training. For instance, we match the accuracy of the original ResNet-50 on ImageNet zero-shot without needing to use any of the 1.28 million training examples it was trained on. We release our code and pre-trained model weights at https://github.com/OpenAI/CLIP.
Metadata: arXiv. Abstracts retain their original authors’ rights.
In the conversation
Original HN comments, with labels from simple text rules. A label describes the whole comment and may miss context or irony. Read the discussion to make up your own mind. About the labels
10 selected excerpts · 10 total mentions
Where are you getting 2 billion from? The original CLIP paper says: > We demonstrate that the simple pre-training task of predicting which caption goes with which image is an efficient and scalable way to learn SOTA image representations from scratch on a dataset of 400 million (image, text) pairs collected from the internet. [1] OpenCLIP was trained on more images, but the datasets like LAION-2B are kind of low-quality in terms of labeling; I find it plausible that a better dataset could outperform it. I'm pretty sure that the stock images Adobe is drawing from have better labeling already. I agree that this is likely to backfire on artists, but part of that is that I expect the outcome to be that large corporations will license private datasets and open research will starve. [1] https://arxiv.org/abs/2103.00020
From the paper on the CLIP embedder it appears that they use a form of contrastive loss that maximizes the cosine similarity between related images and prompts, but also minimizes the same between unrelated prompts & images. See section 2.3 of the CLIP paper: https://arxiv.org/pdf/2103.00020.pdf Also, the writeup on OpenAI's blog: https://openai.com/blog/clip/
If you have a bit of background in math, I would encourage you to read the CLIP paper: https://arxiv.org/abs/2103.00020 Ultimately, the link between words and their representations comes from the CLIP training. The model generates encodings (vectors) for both an image and its corresponding caption, and then the parameters of these encoders (the functions that generate the vectors) are tuned in order to minimize the angle between the textual and visual encodings that represent the same concept. The core of your question is why minimizing the angle between like vectors is equivalent to learning what the "Platonic ideal" of a given object (in your example, a bowl) is,…
Read the full comment
whether appearing as a textual representation or a visual one. This question is subtle and difficult to answer (if it's even a well-formulated question), but I'd say that the easiest interpretation is that the vector space is composed of a basis of vectors that each represent a distinct feature (which the model learns).
> What is the content of the training set like, that DALL·E 2 has all this info? Web crawling. (https://arxiv.org/pdf/2103.00020.pdf 2.2) > Are there people out there spending thousands of hours just tagging or writing descriptions of training images? "Yes", Google Image Search, Wikipedia captions, Danbooru are all that in some sense. The biases should be obvious if you think about it for a minute and CLIP has even more biases since they removed all kinds of NSFW content, etc. > And does DALL·E just receive the image as-is with its description, or does it get more info (e.g. "this part of the image is the dog")? Only that, but segmentation is a big research area too and it looks like FB has a reproduction with some of that mixed in. https://arxiv.org/abs/2203.13131
> I have discussed in this article three reasons that proves Machine Learning and Data-Driven approaches are not even relevant to NLU This is a pretty hard-line position to take, and given the authors credentials I'm inclined to believe this is somehow poorly worded and not reflective of the thesis he intended with this article. > Languages are the external artifacts that we use to encode the infinite number of thoughts that we might have. > in building larger and larger language models, Machine Learning and Data-Driven approaches are trying to chase infinity in futile attempt at trying to find something that is not even ‘there’ in the data > Ordinary spoken language, we…
Read the full comment
must realize, is not just linguistic data I would be curious to know what the author thinks of multimodal representation learning - which is conceptually promising in that it opens the door for machine learning models to learn relationships that span text, images, video, etc. For example OpenAI's CLIP [1], and other models like it. [1] https://arxiv.org/abs/2103.00020
Waymo is doing actual for customer self driving right now.They need to scale it up a lot, but 5-10 years is a lot of time in AI research. Deep Learning did not exist 10 years ago. Tesla is trying hard too, but it goes with a big dose of bullshiting from Musk. They are a lot more dependent on AI break troughs in DL due to their vision only philosophy. OpenAI research around scaling laws in DL suggest that naive 1000 increase in training compute over CLIP should get us to state of the art vision in zero shot settings i.e. without task specific training data. But they probably can cover 1/3 of that with algorithms improvements. Beyond that machines should really be above…
Read the full comment
human vision across the board besides adversarial settings. Quote https://arxiv.org/abs/2103.00020 : > While scaling has so far steadily improved performance and suggests a route for continued improvement, we estimate around a 1000x increase in compute is required for zero-shot CLIP to reach overall state-of-the-art performance. There is also the question of robust car control, but there should be good progress on it too due to RL research.
Cosine-similarity is a useful metric. The cases where it is useful are models that have been trained specifically to produce a meaningful cosine distance, (e.g. OpenAI's CLIP [1], Sentence Tranformers [2]) - but these are the types of models that the majority of people are using when they use cosine distances. > It's my understanding that the delta between two word embeddings, gives a direction, and the magic is from using those directions to get to new words... it's the directions and distances to nearby objects that matters most Cosine similarity is a kind of "delta" / inverse distance between the represenation of two entities, in the case of these models. [1] https://arxiv.org/abs/2103.00020 [2] https://www.sbert.net/docs/training/overview.html
Hmm, typically the models where people use cosine similarity on embeddings have been deliberately trained such that the cosine similarity is meaningful. It looks like this paper is looking at examples where the models have not been deliberately trained for the cosine similarities, and hence in these situations it would indeed be unreasonable to assume cosine similarities to be a good idea.. (but that's kind of a given?) For example, here's the loss from the CLIP paper [1], which ensures cosine similarities are meaningful: # joint multimodal embedding [n, d_e] I_e = l2_normalize(np.dot(I_f, W_i), axis=1) T_e = l2_normalize(np.dot(T_f, W_t), axis=1) # scaled pairwise…
Read the full comment
cosine similarities [n, n] logits = np.dot(I_e, T_e.T) * np.exp(t) # symmetric loss function labels = np.arange(n) loss_i = cross_entropy_loss(logits, labels, axis=0) loss_t = cross_entropy_loss(logits, labels, axis=1) loss = (loss_i + loss_t)/2 And Sentence Transformers [2] using CosineSimilarityLoss: train_loss = losses.CosineSimilarityLoss(model) # Tune the model model.fit(train_objectives=[(train_dataloader, train_loss)], epochs=1, warmup_steps=100) [1] https://arxiv.org/pdf/2103.00020.pdf [2] https://www.sbert.net/docs/training/overview.html
As far as I know, OpenAI has not made this dataset publicly available. IIRC the dataset is images scraped from instagram and their corresponding captions. Check out the CLIP paper for more details: https://arxiv.org/abs/2103.00020 Theoretically, you could build a web-scraping tool to do something like this, but even storing that data would take an absolutely insane amount of storage. I would assume OpenAI has some deal with Meta to make the creation of datasets like this easier.
Keep following the thread.
More in Computer visionMore from the same topics.
Sparks of Artificial General Intelligence: Early experiments with GPT-4
Sébastien Bubeck, Varun Chandrasekaran, Ronen Eldan +11
Artificial intelligence (AI) researchers have been developing and refining large language models (LLMs) that exhibit remarkable capabilities across a variety of domains and tasks, challenging our understanding of learning and cognition.
Understanding deep learning requires rethinking generalization
Chiyuan Zhang, Samy Bengio, Moritz Hardt +2
Despite their massive size, successful deep artificial neural networks can exhibit a remarkably small difference between training and test performance.
Talent vs Luck: the role of randomness in success and failure
A. Pluchino. A. E. Biondo, A. Rapisarda
The largely dominant meritocratic paradigm of highly competitive Western cultures is rooted on the belief that success is due mainly, if not exclusively, to personal qualities such as talent, intelligence, skills, efforts or risk taking.
End to End Learning for Self-Driving Cars
Mariusz Bojarski, Davide Del Testa, Daniel Dworakowski +10
We trained a convolutional neural network (CNN) to map raw pixels from a single front-facing camera directly to steering commands.