Skip to main content
Version: v1.0 (Raw Transcripts)

Transcript: What is an embedding model?

Version 1: Source Transcript

This document represents the raw lecture transcript recorded from the video lecture. For architectural study notes and system design documentation, see Version 2.

Full Transcript​

Embedding models are machine learning algorithms that turn data like text or images into arrays of numbers known as vectors or embeddings. These vectors in turn encode the meaning of text, images, and other unstructured data. But what do we mean when we say that vectors encode meaning? People naturally understand text by picking up on meaning, context, and tone. The same goes for images. We can recognize them even if the lighting or angle change. Computers on the other hand fundamentally work really well with numbers and mathematical operations. If you want computers to understand deeper meaning, context or semantics, we need to find techniques that allow us to encode this information as numbers as well. It's not an easy task to solve. Though linguistics or image recognition is extremely complicated because meaning and context often depend on subtle clues that change with culture, situation, or even personal experience. Words can have multiple meanings and images can be interpreted in many ways depending on what's around them or what's expected. For instance, the same word can have multiple meanings. Charge in she was charged with an expensive fine is different from charging I need to charge my phone. Besides that, meaning can completely flip when you combine words together. While bad usually means something negative, not bad means the actual opposite. But what researchers from Google understood and wrote about back in 2013 was that you don't need to know the exact meaning of words to understand if they're related to each other. You just need to look at the words around them and calculate what's the probability of those words appearing together. For example, if you see the word king often appearing near words like queen, crown, and royal, and the word car showing up next to drive and engine, you can guess that king and queen are related. in so car and truck. Even if you don't know the actual meaning of these words, then all you need to do is to place the related words close to each other in a shared space so that their connections can be reflected by how near they are to each other. For images, a similar technique can be applied. Images that share similar features, shapes, or colors can be placed together. For instance, you don't need to know every car in the world to recognize a new one because they all share similar visual characteristics. All you need to do is place the related images close to each other in a shared space so that again their similarity is reflected by how year they are in this space as well. And the best way to represent points in a shared space mathematically is by using vectors. Now imagine that you have an algorithm that can perform this learning task much faster. By fitting this algorithm large amounts of text, for instance, it will be able to look at millions of sentences, learn which words often appear close to each other, and place the vector representations of those words close to each other in a multi-dimensional vector space. The result of this learning algorithm is the embedding model itself that you can then use to generate the vector representation of any word and compare them to the vectors of other words or images, if you will. This embedding models, especially when combined with vector databases like Reddius that allow you to efficiently store and search through vectors, open an array of possible applications like powering recommendation systems, helping detect a fraud, improving search accuracy and even helping support AI applied applications with semantic caching that speeds up and reduces the costs of LLM calls. And the cool thing is that you don't need to worry about training these embedding models yourself. Plenty are available out of the box for you to use with diverse use cases in mind. Some of them, like the ones from Hugging Face, you can host yourself, while others are available as APIs like the ones provided by OpenAI. And finally, if you want to see how easy it is to get started with embedding models, vector databases, and many sample applied AI use cases, don't forget to check out our ReadAI resources GitHub repository that is filled with lots of recipes that help you get started with AI fast. My name is Rafael Deio. Thank you for watching and as always stay curious.

Timestamped Segments​

  • [00:00] Embedding models are machine learning algorithms that turn data like text or images into arrays of numbers known as vectors or embeddings. These vectors in turn encode the meaning of text, images, and other unstructured data. But what do we mean when we say that vectors encode meaning? People naturally understand text by picking up on meaning, context, and tone. The same goes for images. We can recognize them even if the lighting or angle change. Computers on the other hand fundamentally work really well with numbers and mathematical operations. If you want computers to understand deeper
  • [00:33] meaning, context or semantics, we need to find techniques that allow us to encode this information as numbers as well. It's not an easy task to solve. Though linguistics or image recognition is extremely complicated because meaning and context often depend on subtle clues that change with culture, situation, or even personal experience. Words can have multiple meanings and images can be interpreted in many ways depending on what's around them or what's expected.
  • [01:02] For instance, the same word can have multiple meanings. Charge in she was charged with an expensive fine is different from charging I need to charge my phone. Besides that, meaning can completely flip when you combine words together. While bad usually means something negative, not bad means the actual opposite. But what researchers from Google understood and wrote about back in 2013 was that you don't need to know the exact meaning of words to understand if they're related to each other. You just need to look at the words around them and calculate what's
  • [01:35] the probability of those words appearing together. For example, if you see the word king often appearing near words like queen, crown, and royal, and the word car showing up next to drive and engine, you can guess that king and queen are related. in so car and truck. Even if you don't know the actual meaning of these words, then all you need to do is to place the related words close to each other in a shared space so that their connections can be reflected by how near they are to each other. For images, a similar technique can be applied. Images that share similar
  • [02:08] features, shapes, or colors can be placed together. For instance, you don't need to know every car in the world to recognize a new one because they all share similar visual characteristics. All you need to do is place the related images close to each other in a shared space so that again their similarity is reflected by how year they are in this space as well. And the best way to represent points in a shared space mathematically is by using vectors. Now imagine that you have an algorithm that
  • [02:40] can perform this learning task much faster. By fitting this algorithm large amounts of text, for instance, it will be able to look at millions of sentences, learn which words often appear close to each other, and place the vector representations of those words close to each other in a multi-dimensional vector space. The result of this learning algorithm is the embedding model itself that you can then use to generate the vector representation of any word and compare them to the vectors of other words or images, if you will. This embedding models, especially when combined with
  • [03:13] vector databases like Reddius that allow you to efficiently store and search through vectors, open an array of possible applications like powering recommendation systems, helping detect a fraud, improving search accuracy and even helping support AI applied applications with semantic caching that speeds up and reduces the costs of LLM calls. And the cool thing is that you don't need to worry about training these embedding models yourself. Plenty are available out of the box for you to use with diverse use cases in mind. Some of them, like the ones from Hugging Face,
  • [03:46] you can host yourself, while others are available as APIs like the ones provided by OpenAI. And finally, if you want to see how easy it is to get started with embedding models, vector databases, and many sample applied AI use cases, don't forget to check out our ReadAI resources GitHub repository that is filled with lots of recipes that help you get started with AI fast. My name is Rafael Deio. Thank you for watching and as always stay curious.