lance-format / lance-format/lance

Top-level indices part 2: empty vector indices

Open
#4,034 5 comments 0 reactions 1 assignee View on GitHub

@wjones127 is already working on this.

Since May 8, 2026.

A-index enhancement
Dominant language
Rust
Stars
7.1k
Forks
852
Avg merge
3d 18h
Merged PRs (30d)
272

Description

Follow up to #3940

We are trying to make it possible to keep indices even though we don't have enough data to actually train them. In an earlier PR, we are adding a train: bool parameter to let the user choose whether they want to defer training an index. If train=False, then we just create an empty index and it will show num_indexed_rows: 0 in stats. They can later call optimize_indices() to do the actual training.

Vector indices are more complex because of IVF partitions, since we need a minimum amount of data to create them.

Here is the behavior I think we want:

  1. Can pass train=False to create an empty index. No IVF or PQ will be trained. Will save metadata as empty array.
  2. If you call create_index(..., train=True) or optimize_indices():
    • < 256 non-null vectors -> same as train=False
    • 256 <= number of non-null vectors < num_partitions * 256 => train on smaller number of partitions
    • number of non-null vectors >= num_partitions * 256 -> train full index

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.