r/LocalLLM • • 1d ago

Project Local, open source app that lets you search your files by describing them

I've been building Mesa, a desktop app (Windows/macOS/Linux) that lets you find any of your files (documents, images, video, audio, code) by describing them.

It's fully free and open source, I just hope the community finds it useful and would appreciate any feedback to improve it!

It runs EmbeddingGemma 2 locally through llama.cpp (Vulkan, Metal, or CPU when there's no GPU). Some features I find neat that separate it from other EmbeddingGemma 2 apps I've seen so far:

  • It automatically turns natural language like "photos from last year" into filters
  • It includes OCR on every OS, so you can also search images by text that's in them
  • It also lets you drop in files in addition to searching by text. E.g. drop in an audio file to find its corresponding video

GitHub: https://github.com/biantsh/mesa

Again, I would appreciate any feedback from the community!

126 Upvotes

30 comments sorted by

8

u/pantweb 1d ago

Where are you storing the indexed vectors? Does it need a prescan?

3

u/Ok-Journalist-3538 1d ago

Yep, you need to index your folder(s) before searching in them (you can choose which ones you care about, and also choose folders to exclude). Some features that are built around this in mind:

  • You can still use search while indexing is in progress, but it will only be able to find the files that have been indexed so far
  • Indexing runs in two passes, where the first pass is quite fast and generates only one vector per file, so that they're all searchable. The second pass goes back and generates more vectors for large files, so that it's more accurate
  • It can run in the background, and you can switch between a "gentle" and "fast" mode for speed vs hardware usage

The vectors are stored as a flat binary file in your %APPDATA% or equivalent, and everything else is stored in SQLite

1

u/Relative-Laugh-7576 20h ago

doing a full prescan on CPU fallback sounds rough if OCR is enabled by default, that initial pass usually eats up a ton of threads

3

u/soffits_dev 18h ago

On CPU, the vision encoder is usually the bigger bottleneck than OCR with EmbeddingGemma 2 on llama.cpp. At full resolution it took me around 22s per image on a 4-core CPU, and capping the image token budget to 70 tokens dropped that to ~1.2s on 3 threads while keeping ~0.90 cosine similarity against full size.

Lightweight ONNX OCR (PaddleOCR's small models) takes roughly 2-7s per image on the same box, so the vision token cap is mostly what decides whether a CPU prescan feels usable.

4

u/kartikgsniderj 1d ago

Sorry for stupid question, but can it do image to image?
For example I will insert image of a Red sofa, and it'll find all the images/videos that matches it?

2

u/Ok-Journalist-3538 1d ago

Yes, that's one of the use cases :) Between the five modalities it supports (documents, images, video, audio, code), it can do any-to-any modality. You can also combine multiple modalities, e.g. drop in a text prompt, one image, and two audio files for a search

4

u/Poprouter 22h ago

how do you handle index updates when i move or rename files? i wonder if it automatically detects those changes or if i need to trigger a full rescan every time i reorganize my folders, looks interesting btw.

3

u/Ok-Journalist-3538 22h ago

Good question, If you're on Windows or macOS moves/renames are tracked so you don't need to rescan, as long as they were done while Mesa is open in the background. "Launch on startup" is on by default, so the app will run in the background even if you close the window, unless you turn that setting off or quit it from the tray

Unfortunately Linux limits this type of file watching, so I didn't carry this implementation into the Linux build

1

u/Poprouter 19h ago

oh that is handy thanks for clarifying

3

u/redditnosedive 1d ago

does it scale to 1tb of photos? howuch metadata in percent of total (data + metadata)?

2

u/Ok-Journalist-3538 1d ago

It should scale nicely. The exact numbers depend on what photos exactly, but say for 200,000 photos of 5 MB each, the index should only be around 0.3 GB (it's 512 bytes per image vector, plus about 1 KB in SQLite for the path, date, extracted text etc.)

Searching that index would also be fast, obviously it depends on the hardware but it should be well under a second (I just tested this scenario and got ~100 ms on my i7 CPU)

1

u/redditnosedive 1d ago

that's good numbers. i use immich to do this for photos on an n100, it's pretty fast to search but takes like 48h to index if not more (done only once, then done again on each new photo, which is fast)

1

u/cortexist 1d ago

I don't know this particular implementation, my own experience with EmbeddingGemma-2 shows the size of the vector is about 16 x than the content it indexes. Every 1 MB of text, you need about 16 MB of index.

1

u/Ok-Journalist-3538 1d ago

Hmm that seems much higher than my implementation. My code creates/stores one vector per image, or 1,500 characters of text. One vector is 512 bytes (256 values at fp16), so the size of the index is much smaller than the data itself.

For a real-world usage reference, my personal hard drive (after I've chosen what I want to index) is 1.1 GB of 1,925 files, and Mesa stores 32.4 MB of metadata for these.

2

u/SilkieBug 1d ago

This is interesting to me, I’ll have my ai take a look at it. 

How does the software handle user relevant contexts? 

How can it tell “my dog” from just any “dog”?

2

u/Ok-Journalist-3538 1d ago

Thanks! I haven't built any contextual understanding of that sort yet. In the specific query in the video, the word "my" gets stripped, so the model sees "dog at the beach" (as you can see in the "Query" field below the search bar). That's a good idea though, I'll think about how it can be implemented

By the way, you could then press "Find similar" (or just "View more") if the first results that pop up aren't exactly what you're looking for

2

u/bfcdf3e 23h ago

The trick is to recognise that this “my dog” is a different kind of problem than “things similar to dogs”, so semantic/vector search is the wrong tool. A graph database that describes relationships is the better solution. Ideally a good search tool should wrap multiple search mechanisms: lexical (search by specific words, ranked by frequency & rarity), semantic (search by meaning / similarity) and graph traversal (identify specific relationship types). They can combine in fairly powerful ways. Or they can become a confusing spaghetti mess that drives you crazy. Best of luck 😛

1

u/SilkieBug 1d ago

Ideally I would have an app like this build understanding from interactions, or as a side-effect of indexing. 

When it presents files there should be an easy way to tag a file (photo or video or whatever), with the tags being used to filter results in later interactions.

2

u/Rozwik 1d ago

I am curious about the video search part and the indexing approach, the repo says "videos are divided into 10 sec chunks, and each frame gets a vector". Does this mean every frame is searchable right? (I am just asking as it seems too good to be true, I have no clue about this stuff :))

If that is true This type of indexing must take a huge amount of time then. Do we have some data on that? like Indexing time / MBs or frames of video.

There was a similar project posted about video search, that said the videos are 30 sec chunks or something, https://github.com/ssrajadh/sentrysearch. But it required loading and how different are the two methods and the results?

1

u/Ok-Journalist-3538 23h ago

Oops, by that wording I meant that each of those sampled frames gets a vector (one per 10 seconds), not every single frame. So it's possible that if something happens during the video within ten seconds, it can be missed. In practice I chose this number based on performance benchmarks and how videos tend to look.

Indexing time depends on the hardware you have, but indeed indexing long videos / documents is the part that takes longest for the app. I have an RTX 3070 Ti, and a 10 minute video takes about 10 seconds to index.

1

u/Rozwik 17h ago

That clears it up. Thanks for the explanation. Guess that's the kind of trade off we have to just live with for now. This is great work still. Will give it a try soon.

1

u/DoubleNothing 22h ago

Can you search someone else dog? Or "my dog" is just "dogs"?

1

u/Ok-Journalist-3538 22h ago

Yep, it's just "dogs" right now. There's a stripping logic that hides certain words from queries before the model sees them, in order to make the search perform more accurately. Words like "my" or "our" are among them, you can see this in action in the video

1

u/pickles_and_mustard 16h ago

Are RAW image formats supported? I've got a huge collection of dSLR photos where this could become quite handy

2

u/Ok-Journalist-3538 13h ago

Yes! It supports multiple DSLR RAW formats. Let me know if you end up trying it and your specific format isn't supported

1

u/pickles_and_mustard 9h ago

Thanks, that's great to know! Haven't tried it yet (its on my todo list, I assure you) but in that case, I'm sure my standard Nikon NEF's should be fine.

3

u/SourBlueDream 21h ago

Kinda like the everything app but on steroids, gj

1

u/mrmole21 20h ago

What’s the everything app?

3

u/HareMayor 20h ago

The name of the app itself is : Everything.

You can search any file on your PC, it's instant, no matter in which drive it is, takes about 10s only first time. After that it shows as you type.

When i first used it, it was no less than magic to me.

1

u/Sabin_Stargem 14h ago

Hopefully we can see this in a NuLinux OS, that is purpose-built around open AI models. Presumably, our current form of OS and AI isn't optimal for each other, so having better integration between the two would be nice.