Hello, I'm Rijul. I'm building git-lrc, a micro AI code reviewer that runs on every commit. It's free and source-available on GitHub. Star git-lrc to help more developers discover the project. Do give it a try and share your feedback
Imagine you have 100,000 notes and you want to find the one most relevant to a question.
Reading every note one by one works, but it is obviously not efficient.
This is one of the problems FAISS helps solve.
The Problem: Finding Similar Information
Imagine you have a huge pile of notes.
100,000 of them.
Some say:
Python is a programming language.
Others:
Docker packages applications into containers.
And others:
PostgreSQL is a relational database.
Now you ask:
What can I use to run applications in isolated environments?
You want to find the note about Docker.
One simple approach would be:
Question
↓
Read note 1
Read note 2
Read note 3
...
Read note 100,000
But this is not efficient.
There is another problem with ordinary keyword search.
Your question says:
"run applications in isolated environments"
But the document says:
"Docker packages applications into containers"
There may not be many exact words in common.
Yet the meaning is related.
This is where semantics come into the picture.
And to work with semantic similarity, we use embeddings.
Turning Notes Into Numbers
An embedding model can turn text into a vector.
For example:
"Docker packages applications into containers"
↓
Embedding model
↓
[0.21, -0.73, 0.44, ...]
Another document:
"Kubernetes manages containers"
↓
[0.19, -0.70, 0.48, ...]
And another:
"Chocolate cake recipe"
↓
[-0.81, 0.12, -0.34, ...]
The important idea is:
Similar meanings tend to produce similar vectors.
So if we imagine these vectors in a vector space, documents related to Docker and Kubernetes may be closer together, while something about chocolate cake would be much farther away.
So the basic solution is simple:
Find the vectors closest to the query vector.
But then scale becomes a problem.
What happens when we go from:
10,000 documents → 100,000 → 1 million → 10 million?
You could calculate the distance between your question and all 10 million vectors.
That's possible, but it can become expensive.
This is the problem FAISS helps solve.
FAISS: Finding Similar Things Fast
FAISS stands for Facebook AI Similarity Search.
It is a library developed by Meta for efficient similarity search over vectors.
You give FAISS thousands or millions of vectors:
Vector 1
Vector 2
Vector 3
...
Vector 1,000,000
Then you give it a query vector:
Query vector
And ask:
Give me the 5 vectors most similar to this one.
FAISS can return something like:
Closest:
Vector 83721
Vector 192837
Vector 92837
Vector 1827
Vector 72819
The important thing to notice is what FAISS is actually searching.
It is searching vectors, not text.
But How Does That Find the Actual Document?
FAISS doesn't necessarily need to store your documents.
Your application might maintain a mapping like this:
ID 0 → "Python is a programming language"
ID 1 → "Docker packages applications into containers"
ID 2 → "PostgreSQL is a database"
ID 3 → "Kubernetes manages containers"
And FAISS stores the corresponding vectors.
So when you ask:
What runs applications in isolated environments?
The query is converted into a vector and searched against the vectors in FAISS.
It might return:
Closest vector IDs:
1
3
Your application can then map those IDs back to the original documents:
1 → Docker packages applications into containers
3 → Kubernetes manages containers
So FAISS helps you efficiently find which vectors are closest, while your application handles the connection between those vectors and the original data.
What FAISS Actually Does
You can notice the wording in its name:
Similarity Search
FAISS is:
- Not a text search engine
- Not an AI model
- Not an embedding model
- Not something that understands English
FAISS doesn't know what Docker is.
It doesn't know what Kubernetes is.
It sees numbers and efficiently searches for vectors that are similar according to the chosen similarity or distance measure.
The embedding model gives the text its numerical representation.
FAISS helps you search those representations efficiently.
FAISS in RAG
If you've read about RAG, you may already know that retrieval is an important part of the process.
A simplified RAG pipeline looks like:
Documents
↓
Embeddings
↓
Vector index
↓
User question
↓
Query embedding
↓
Similarity search
↓
Relevant documents
↓
LLM
FAISS can be used in that retrieval step.
Especially when you have a large number of vectors and need to efficiently find the ones most relevant to a query.
Wrapping Up
FAISS is basically a helper for finding similar vectors efficiently.
With a small number of vectors, you may not need anything particularly sophisticated.
But as the number of vectors grows into hundreds of thousands or millions, the way you perform similarity search starts to matter.
That's where technologies like FAISS become useful.
It takes a seemingly simple problem, "find the vectors closest to this one", and provides efficient ways to do it at scale.
AI agents write code fast. They also silently remove logic, change behavior, and introduce bugs -- without telling you. You often find out in production.
git-lrc fixes this. It hooks into git commit and reviews every diff before it lands. 60-second setup. Completely free.
Any feedback or contributors are welcome! It's online, source-available, and ready for anyone to use.
Give it a ⭐ star on Github

Top comments (0)