Watch: gemini-embedding-2 reaches its 3,072-dimension BEIR SciFact plateau at 768d, and float16 cuts storage in half with zero loss

BEIR SciFact retrieval benchmark (5,183 documents, 300 human-labeled queries) for gemini-embedding-2 from 64 to 3,072 dimensions in float32 and float16, paired with measured PostgreSQL pgvector HNSW storage costs.

Transcript

When building vector search systems, we often default to the maximum dimensions available. But tests with Gemini Embedding Two show we can dramatically cut costs without losing accuracy.

While the model supports over three thousand dimensions, it actually hits its performance ceiling at just seven hundred sixty-eight.

Even better, we can convert these vectors from thirty-two-bit to sixteen-bit floats. This cuts storage and index sizes in half with absolutely zero loss in retrieval quality.

If we truncate the vectors down to just two hundred fifty-six dimensions, we still retain over ninety-seven percent of our peak search accuracy. Yet, the vector size is twenty-four times smaller than the uncompressed, full-dimensional version.

In databases like PostgreSQL, keeping indexes in RAM is crucial for fast queries. Tripling our dimensions from two hundred fifty-six to seven hundred sixty-eight triples the memory footprint, but only yields a minor two percent gain in accuracy.

For most search engines, the sweet spot lies in these smaller, sixteen-bit vectors. We get fast, highly accurate search results at a fraction of the database cost.