VG
All work

Retrieval rebuild

From stream timeouts to sub-second hybrid search, measured on a 71-question golden set.

Average retrieval latency
was 5–8 s, now 0.6 s
Recall@10
was 0.53, now 0.98
MRR
0.89

Measured on a 71-question golden set, which I re-ran by hand before every release.

Problem

Saroya AI, built at TinyCheque, an AI-first venture studio, is a mobile app where creators build an AI avatar that users chat with. The original retrieval layer ran queries on a FalkorDB graph database that took 5–8 seconds each, long enough to time out streams; many sessions ended with no answer at all.

What I did

I replaced the graph-database retrieval with Postgres: pgvector for vector similarity and full-text search on the same instance, merged by reciprocal rank fusion (RRF), which scores each result by summing 1/(k + rank) across the ranked lists, so no score normalisation is needed. mem0, kept from the first version, gives the avatar long-term memory of each user across chats.

How I measured it

I built a 71-question golden set covering the creator content types and user query patterns in the tester release. I re-ran it by hand before every release, and once to compare the old system with the new one.

MetricBefore (graph DB)After (pgvector + RRF)
Average retrieval latency5–8 s, timeouts0.6 s
Recall@100.530.98
MRRnot measured0.89

Architecture

A query runs two searches in parallel on one Postgres instance, and RRF merges them. mem0 is a separate memory step: it adds what the avatar remembers about the user, and the response streams back.

Diagram scrolls sideways
QueryVector similaritypgvectortsvector + GINFull-textRRFLong-term memorymem0Response

Limitations

The 71-question set covers the content types in the current tester release; as creator content diversifies it will need to grow. The architecture is specific to Saroya AI and has not been tested on other retrieval workloads. Source code is confidential. The 71 questions were drafted with AI and each one reviewed by me. Search was tuned on the same set, with nothing held out, so 0.98 is likely optimistic.

Contact

Now, October 2026: looking for applied-AI and backend roles in India, the UK or Germany. Available immediately.