PG Vector Search Stopped Working On Newest Embedding Model

Hi, I’m not sure if I’m doing something wrong.

Until now I was using pgvector with text-embedding-ada-002 with no problem. I’m using Prisma to create my database and writing the raw SQL queries myself.

But, after I switched to the new model (text-embedding-3-small) and RE-INDEXED all stored data the SQL results are returning empty :face_with_monocle:.

The Query looks the same, the vectors are the same size as the db expects (1536).

Literally switch the model back and re-index the database fixes the issue.

I’m want to use the new model to get the best and faster result.

What can I be doing wrong here?

I’ve just done this migration on two databases in Production, (both using pgvector) and the only issue I hit was with the similarity search - the thresholds need to be changed.

I had a cosine distance threshold filter set at 0.8 which worked great with gen 2, but with 3rd gen no results were coming up.

You have to lower this value to almost half to get results as the 3rd gen is more picky!

4 Likes

That’s indeed the correct solution. Thanks for the fast response!

1 Like