Skip to content

Commit ee39654

Browse files
committed
remove questionable vector search optimizations
new round of benchmarks didn't reveal any benefits from them, quite the opposite. these were old optimizations added in the early phase of vector search development. apparently later changes made them obsolete.
1 parent 9412821 commit ee39654

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

sql/vector_mhnsw.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
static constexpr float NEAREST = -1.0f;
2929

3030
// Algorithm parameters
31-
static constexpr float alpha = 1.1f;
31+
static constexpr float leniency= 1.1f;
3232
static constexpr uint ef_construction= 10;
3333
static constexpr uint max_ef= 10000;
3434
static constexpr size_t subdist_part= 192;
@@ -1179,11 +1179,11 @@ static int select_neighbors(MHNSW_param *p, FVectorNode *target,
11791179
{
11801180
Visited *vec= pq.pop();
11811181
FVectorNode * const node= vec->node;
1182-
const float target_dista= std::max(32*FLT_EPSILON, vec->distance_to_target / alpha);
1182+
const float target_dista= std::max(32*FLT_EPSILON, vec->distance_to_target);
11831183
bool discard= false;
11841184
for (size_t i=0; i < neighbors.num; i++)
11851185
if ((discard= node->distance_greater_than(neighbors.links[i]->vec,
1186-
target_dista, p->mode, &p->acc) <= target_dista))
1186+
target_dista, p->mode, &p->acc) < target_dista))
11871187
break;
11881188
if (!discard)
11891189
target->push_neighbor(p->layer, node);
@@ -1294,7 +1294,6 @@ static int search_layer(MHNSW_param *p, const FVector *target, float threshold,
12941294
Queue<Visited> candidates, best;
12951295
bool skip_deleted;
12961296
uint ef= result_size;
1297-
const float leniency= 1.1f + p->ctx->M/500.0f;
12981297

12991298
if (construction)
13001299
{

0 commit comments

Comments
 (0)