Choosing optimal 'segment' size in PQ

In configuring PQ manually using the two phase method, the ‘segments’ parameter is to be configured.

Considering if the vector dimension to be 768. The possible segment values could be 384, 256, 192, 96. How to determine the best ‘segment’ value for configuring PQ manually?

Hi @Jegadeesh!

That’s a nice question.

I had to dig into our repo to find the answer :star_struck:

We have this issue where our core team discuss about it:

and finally this PR that was merged:

So, from the PR:

When the PQConfig contains a zero value in the segments parameter, it folds back to setting the default value. The default value used to be the dimensions. This is far from optimal. In some experiments we identified 6 as a good default number for this setting but still, it has to be an integer divisor of the dimensions. In this PR we set the segments to the closest integer divisor to 6 which is not bigger than 6.

Let me know if that helps :slight_smile: