Skip to content

[Feature Request] Add per-list scan limit for parallel_mode=1/2 #4848

@Tickdack

Description

@Tickdack

Problem

max_codes only works with parallel_mode=0/3. For single-query scenarios, parallel_mode=1 is preferred, but there's no way to limit scan depth per inverted list.

Use Case

In real-time search with dynamic data, hot events can cause some inverted lists to grow to millions of vectors (vs. hundreds expected). This causes severe latency spikes when queries hit these lists.

Proposed Solution

Add max_codes_per_list parameter to limit scan depth per individual list, working with all parallel modes.

// In SearchParametersIVF
size_t max_codes_per_list = 0;  // 0 = no limit

Why not existing solutions?

  • max_codes + parallel_mode=0: Loses intra-query parallelism
  • Reduce nprobe: Too coarse, hurts recall
  • Retrain index: Doesn't handle dynamic hot spots

Implementation

Minimal change (~10 lines). Happy to contribute a PR if this approach is acceptable.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions