The Math of Love: How Vector Embeddings Calculate Relationship Compatibility
How does an artificial intelligence measure human compatibility? Discover the engineering behind PgVector, cosine similarity, and generative AI vibe checks.
Dating apps have traditionally matched users based on superficial filters: gender, age range, and distance. If you both like hiking and sushi, you get matched. But real-life compatibility is far more complex.
At Dating In Israel, we replace shallow tags with advanced mathematical vector embeddings. Here is an inside look at the technology behind our AI matchmaking engine.
1. What is a Vector Embedding?
In simple terms, a vector embedding is a way of converting complex, human language into a long list of numbers that a computer can calculate.
For example, when you tell our Telegram bot about your lifestyle, career aspirations, and religious views, we don't just search for exact keywords. We send your responses to a neural network model, which converts them into a 3072-dimensional vector (an array of 3,072 numbers).
This vector represents the "semantic space" of who you are. If two people describe similar values using completely different words, their vectors will still point in almost the same mathematical direction.
2. Cosine Similarity: Measuring the Angle of Alignment
To find matches in the database, we use the `pgvector` extension in PostgreSQL.
Instead of writing complex SQL query filters, we measure the cosine distance between your vector and everyone else's vector. Cosine similarity calculates the angle between two multi-dimensional lines:
This allows us to screen thousands of profiles in milliseconds using pure database mathematics.
3. The Generative AI Vibe Check
Once the database filters out candidates who don't pass the 85% vector similarity or basic dealbreakers (e.g. smoker status, location region), we run a final, highly sophisticated step: Generative AI Vibe Check.
We feed the target profile and the top-ranked candidates' traits into Google's Gemini-2.5-flash model. The AI acts as an elite digital matchmaker, reading between the lines:
By combining database vector mathematics with advanced language models, we achieve matches that feel natural, respectful, and highly compatible. Ready to experience it? Complete your chat onboarding now!