Vector Embedding - Representing All Data

Posted on September 13, 2023
Vector Embedding - Representing All Data

In the web and mobile platforms we encounter every day, there exist various forms of data such as documents, images, audio, video, and numbers. Each is expressed differently and thus stored differently. So, do different types of data have to be stored in different ways? Is there a method to store them in the same format for comparison?

The concept of vector embedding emerges to convert different forms of data into a common format that makes them comparable. A vector embedding is data expressed as an array of numbers like [1, 4, 0]. In other words, all data such as images, documents, and videos can be represented as arrays of numbers. To explain this easily, let's use colors as an example.

All colors can be represented in RGB format, which is a combination of the levels of red, green, and blue. By expressing these three colors from 0 to 255 and combining them, we can represent various colors:

  • Red: [255, 0, 0]
  • Green: [0, 255, 0]
  • Blue: [0, 0, 255]

In other words, color data can be represented as three-dimensional vector data expressed by three numbers. This is also a type of vector embedding. Vector data expressed as arrays of numbers allow for distance calculations between data, and the closer the distance, the more similar the concepts are. (There are various methods for calculating the distance between vectors.)

In summary, vector embedding allows us to quantify how similar objects (or concepts) perceived by people are by substituting their similarity with proximity in vector space. It's the core of machine learning in natural language processing and recommendation algorithms. All data can be converted into vector embeddings through their respective Transformer models.

  • Text Data: Mainly used in natural language processing tasks, words, sentences, and documents are converted into vectors through word embedding. Word2Vec is the most representative embedding conversion model.
  • Image Data: Images can be embedded into high-dimensional vectors to find similarities and patterns.
  • Audio Data: Audio signals can be converted into audio embeddings to recognize voice commands or identify speakers.
  • Video Data: Video frames can be converted into vectors to detect movements, objects, tracking, and video search.

Let's look at another example. How can we classify pictures of dogs, cats, strawberries, and watermelons? Naturally, tigers and lions can be classified as animals, and watermelons and strawberries as fruits.

Suppose we represent these four images as two-dimensional vectors:

  • Cat: [1, 1]
  • Dog: [1, 2]
  • Strawberry: [3, 4]
  • Watermelon: [4, 3]

When we plot these numbers on a two-dimensional plane, we can see that the points representing dogs and cats are close to each other, as are the points representing strawberries and watermelons. We can calculate the distances between the points and classify them based on these distances.

vector embedding

In the above, we explained comparing the same type of data—images—by converting them into vector data. Then, is it possible to compare different types of data? Can we represent the word "cat" and a picture of a cat as vectors to measure their similarity? Absolutely! By embedding text and images into a common space called vector space, we can measure the distance between them. Even if we have only image files (with no tags or descriptions), we can input search queries to find the desired images.

Shall we try it directly in the Aeca Demo? Let's input "a picture of a running dog."

running dogs

Even though the picture has no description, it has found the image that best fits the search term. Not only can we search for images using text like this, but we can also find specific images within videos, or conversely, find documents that describe images. Finding the vector embeddings that are closest in distance is vector search, and storing vector embeddings to enable vector search is what a vector database does.

Read more

How Aeca Simplifies Search Development

Search in web and mobile applications is a core function that shapes a positive user experience. Particularly in commerce services, search goes beyond enhancing user experience and directly impacts company revenue. With the explosive growth of product information and content, search quality—providing timely information that matches the keywords entered by customers—has become a critical factor determining the success or failure of applications and websites. Generally, customers searching for products in commerce services are considered strong potential buyers with a high willingness to pay. It's observed that all actions users take when searching and reacting to search results reflect their purchase intentions, needs, and willingness to spend. Statistically, the conversion rate of users who perform searches is more than twice that of those who don't. Although only less than 20% of the total MAU use search, it's known that over half of the revenue comes from users who have performed a search at least once. Additionally, the churn rate is high for users who fail on their first search, and the conversion rate for customers who re-search is very low. In other words, search is not only a powerful tool to open customers' wallets but also a factor that greatly impacts the sustainability of the service. So, how does search specifically contribute to customer retention, revenue growth, and service improvement?

By Tim Yang|2023-09-12

The Challenges of Developing Search Functionality

Search functionality is essential in modern applications like Coupang, Baemin, and Yanolja, where users search for various items. However, developing search functionality is not straightforward. Especially when users expect Google-level search quality, the technical requirements become complex. There are two primary approaches to developing search functionality: using database query capabilities and using a separate search engine. Database query capabilities are suitable for simple searches, but they have limitations for complex search requirements. On the other hand, using a search engine can provide high-quality search functionality but increases development complexity and maintenance challenges. Therefore, early-stage services need to consider how to effectively implement high-quality search functionality.

By Tim Yang|2023-09-11

Copyright © 2024 Aeca, Inc.

Made with ☕️ and 😽 in San Francisco, CA.