Ever know for sure that a file is somewhere on your computer, but can’t remember where you saved it or what you named it?
That’s exactly the problem Google’s new embedding model solves.
Google has once again managed to build an AI model that solves people’s real problems.
This time, though, it’s not a huge language model for generating text or writing code. Instead, it’s a small, local embedding model that helps us find and group content. I’m talking about Gemini Embedding 2, Google’s new embedding model.
In this post, we’ll look at:
Whether it’s images, videos, text files or any other files: with this model, they become easy to find, no matter how disorganised your computer is.
Before we look at Google’s new embedding model in detail, we first need to understand what an embedding model is and how it works.
Most of us already know generative AI models, such as ChatGPT or Claude. These AI models receive an input text with a question and generate an answer based on that input.
These large language models are trained to process large amounts of text and to generate new text based on the input instructions.
Embedding models, on the other hand, have a completely different goal. They take input texts or input images and turn them into long lists of numbers, which are called vectors.
Some of you might still remember vectors from math class.
These lists of numbers, or vectors, are called embeddings. They represent the meaning of the inputs in a multidimensional space.
Very similar inputs sit very close to each other in this space. Inputs that are completely different sit far apart.
Let’s look at this with an example. Say we have two documents on our computer.
The first one is titled “Tips on feeding dogs”. The second one is titled “Which food is best for my four-legged friend?”
Even though the two documents have different file names, we know that both are about a similar topic. Classic search, which only works based on how similar the words are, would miss this connection. Search based on embedding models would not.
In an embedding-based search, every text and every image has its own embedding vector, which represents the meaning of that input in the multidimensional space.
When we then type a new search query, we simply turn it into an embedding vector as well and place it in our multidimensional space.
Then we just check which existing vectors are closest to that point and return the matching images, videos or texts. These are most likely also the results that are most relevant to our search.
That’s what makes embedding models so interesting for search. Unlike classic search systems, these models focus on the meaning of the content, not on the similarity of letters or individual pixels.
However, embedding models have always had one big problem in the past: comparing different modalities with each other, such as text, images, videos or audio files.
In AI research, this challenge is called the modality gap.
The modality gap describes the problem that different modalities can be very far apart in the mathematical space, even though they mean the same thing.
Let’s understand this with the example of a barking dog.
We have a photo of a barking dog, a video of a barking dog, an audio file of its bark, and the sentence “The dog barks”.
If we now create the embeddings for these different modalities with their respective embedding models, those embeddings end up far apart because of the modality gap, even though they all express the same meaning: a dog is barking. Because of this, it used to be extremely hard to find related content across different modalities.
And this is exactly where Google’s new AI model, Gemini Embedding 2, comes in.
Instead of using separate embedding models for text, images, video and audio, Google combines all of these abilities in one single model.
What’s special about this model is that all modalities are mapped into the same mathematical space, no matter what the input modality is.
The content with the same meaning sits very close together in this multidimensional space.
This small but important difference from other embedding models helps us improve our search dramatically.
For example, if we search for a barking dog, we don’t just get text results, but also the audio file, the video and the matching image. Google has already built Gemini Embedding 2 into its AI Edge Gallery, where you can search your photos and videos with simple search prompts using this model.
But if you don’t want to use a Google product, you can also simply download Gemini Embedding 2 and use it locally on your computer to search your files efficiently.
Since the model only has 740 million parameters, it runs on almost any laptop.
However, just having the model installed on our computer doesn’t help us much yet, because we also need to integrate it into our work environment and workflows.
We could write our own program that uses this model, or we can simply use existing open-source solutions, such as DigUp.
DigUp is a free, open-source app that uses the new Gemini Embedding 2 model to make any file on our computer faster and easier to find.
Anyone can download DigUp by going to the official website, digup.si. Just click Download, get the app and install it like any other program.
Once DigUp is downloaded and installed, we are ready to set it up on our computer locally.
In the beginning, we can choose which folders DigUp should have access to.
What’s important here is that the model still runs completely locally on our computer. That means no data is shared with another AI model in any cloud.
That’s why I leave the selection as it is and let DigUp access all of my files.
In the last window, we see a few basic settings, for example, whether DigUp should start automatically when the computer starts.
We also set it so that new folders aren’t indexed when the battery is low, or no charger is connected, because creating these embeddings is still quite compute-heavy and uses a lot of energy.
After that, we click Done and can try out DigUp.
After waiting a while until DigUp has really created an embedding vector for every single one of our files, we can finally try out our more efficient search.
This works either with the keyboard shortcut or by clicking DigUp in the menu bar and then Search or Open DigUp.
Let’s click Search first. Now I can type in any term, for example, “comic”.
As you can see, none of these images has anything about comics in their names.
They’re just images generated with ChatGPT, sitting in some folder, and there’s really no hint that these are comic images.
The model simply figured that out on its own. This way, we can find all kinds of things on our computer much faster and more efficiently.
Let’s try another image search and type “Azores”. And now you can see all my pictures from the Azores.
Personally, this feature saves me a lot of time finding files on my computer, especially when I am too lazy to sort them properly.
Personally, I’m really impressed by how fast the search is, but also by its quality.
With the classic Apple or Windows search, on the other hand, you sometimes wait forever for results and end up disappointed with what it found, maybe because you simply didn’t name your files very well in the past.
DigUp makes all of this possible based on the Gemini Embedding 2 model alone. And that saves me a lot of work, because I always know that I saved the file somewhere, but I no longer remember exactly where, or what I called it. With this model, none of that matters anymore.
If you’re interested in more about AI, feel free to check out my blog here on Medium. I’d love to see you again in the next post. Until then!
Felix
Never Search Files Again: Forget Windows and MacOS File Search was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.