ycastor

ycastor

A couple weeks ago i saw the MemVid Project, and though, “Hey, this looks fun”, so i decided to implement something similar in Elixir, so here’s ExMemVid

The core idea is to treat video frames as a data storage medium. Each frame in the video contains a QR code that holds a chunk of text. A separate search index is created using text embeddings to allow for fast, semantic searching of the content stored in the video.

ExMemvid is a proof-of-concept library for storing and retrieving large amounts of text data by encoding it into a video file composed of QR code frames. It leverages modern Elixir libraries for machine learning, video processing, and vector search to provide a unique solution for data storage and semantic retrieval.

How it Works

The core idea is to treat video frames as a data storage medium. Each frame in the video contains a QR code that holds a chunk of text. A separate search index is created using text embeddings to allow for fast, semantic searching of the content stored in the video.

Encoding Process

  1. Text Chunking: The input text is divided into smaller, manageable chunks.
  2. Embedding: A sentence transformer model from Hugging Face (via Bumblebee) generates a vector embedding for each text chunk.
  3. QR Code Generation: Each text chunk is serialized (optionally with Gzip compression) and encoded into a QR code image.
  4. Video Encoding: The QR code images are compiled into a video file, where each image becomes a single frame. The library uses Xav and Evision (OpenCV bindings) for this.
  5. Index Creation: The vector embeddings are stored in an HNSWLib (Hierarchical Navigable Small World) index for efficient similarity search. This index maps the embeddings to their corresponding frame numbers in the video.
  6. Saving: The final video file and the search index are saved to disk.

Retrieval Process

  1. Search Query: The user provides a text query.
  2. Query Embedding: The query is converted into a vector embedding using the same model as the encoding process.
  3. Semantic Search: The HNSWLib index is queried to find the text chunks with embeddings most similar to the query’s embedding.
  4. Frame Identification: The search results from the index provide the frame numbers where the relevant text chunks are stored.
  5. Frame Decoding: The Retriever seeks to the specific frames in the video file, reads the QR codes, and decodes them to retrieve the original text chunks.
  6. Result Aggregation: The retrieved text chunks are returned to the user.

Features

  • Data Archiving: Store large text corpora in a compressed video format.
  • Semantic Search: Go beyond keyword matching with state-of-the-art text embeddings.
  • Configurable: Easily configure everything from the video codec and QR code version to the embedding model.
  • Concurrent: Utilizes Elixir’s concurrency to parallelize embedding and frame decoding tasks.
  • Extensible: The Embedding behaviour allows for swapping out the embedding implementation.
  • Supervised: Built-in supervisors for managing encoder and retriever processes.

https://github.com/edlontech/ex_memvid

Showing Posts 1 to 7

mat-hek

mat-hek

Membrane Core Team

Hi there, is it only for fun? Asking because I can’t understand how it makes sense, honestly :stuck_out_tongue:

mickel8

mickel8

Membrane Core Team

Glad to see that Xav was useful!

ycastor

ycastor OP

It is more of a toy-library, yes. Its memory usage scalability is pretty interesting though, way more efficient when comparing with some common json-embeddings offline storage. I’ll build some benchmarks later.

mat-hek

mat-hek

Membrane Core Team

I’m no expert on LLMs, but from a compression perspective, I don’t see how it can be efficient. Somebody explained it well in an issue, they provided benchmarks too.

urcadox

urcadox

I’m pretty sure it’s just a joke.

The amount of code and the extensive documentation makes it feel like it’s way too much work to put into a joke. But, it’s quite easy to generate this much stuff with an LLM, with… this prompt.

ycastor

ycastor OP

Yep, its a pretty “eccentric” idea, i’m curious about the “v2” haha.

drakkhenn

drakkhenn

Add some steganography and you will get a hit ! :smiley:

— All posts loaded —

Where Next? Top

Trending in Announcing Top

woylie
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries. offset-based pagination with...
New
MRdotB
I needed to reuse React components from my Chrome extension in my Phoenix/LiveView backend. I noticed that for Svelte/Vue, there are live...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
fuelen
Hi all! I want to present a small library which provides a mix task for generating an Entity-Relationship Diagram for Ecto schemas. You...
New
anuaralfetahe
Hello Published a new library - ProcessHub! ProcessHub is a library designed to manage process distribution within the Elixir cluster. ...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
sergio
It’s not that it’s vocabulary is too advanced. It’s something worse. I get lost trying to follow even a paragraph written by Claude. It’...
New
AstonJ
This showed up on my feed.. anyone heard of it? Just hype? Ox Alpha is a reasoning model designed for coding, sustained ag...
New
sorenone
Today we’re releasing Oban for Python. Not an Oban client in Python. Not a pythonx wrapper embedded in Elixir. Nope, it’s a fully operati...
New
akoutmos
@hugobarauna, Dr. Dimitrios Koutmos (my brother) and I (Alex Koutmos) have been hard at work on writing a book on how you can use Elixir ...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews