[Feature]: IVF_TIEREDQ index type, with a learned variable-bit codec (25–44% less index memory than `IVF_RABITQ` at equal recall)

Aperta
#909 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@richyreachy ci sta già lavorando.

Dal 17/11/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

feature
Problem / Motivation

I wrote TieredQ (MIT), a new vector quantizer that learns a rotation from the data (PCA) and spreads a bit budget unevenly over the rotated dimensions, from 0 to 8 bits each. The budget can be any number of bits per vector, not only whole bits per dimension. Its codes are scanned with fast-scan lookup kernels (AVX-512, AVX2 and NEON), and it ships its own IVF index. TieredQ codec can save up to ~50% RAM usage compared to RaBitQ or TurboQuant and thus is a good candidate for local setups with limited RAM or large scale setups.

I'd like to know whether you'd consider an IVF index type based on it for zvec, next to IVF_RABITQ, and how you'd want it integrated.

Proposed Solution

Results against zvec 0.8.0 IVF_RABITQ

Setup:

  • DBpedia Gemini-768: 99,000 base rows, 1,000 held-out queries, inner-product top-10 truth.
  • 256 coarse lists. Each engine trains its own through its shipped Python API.
  • zvec: IvfRabitqIndexParam(metric_type=IP, nlist=256, total_bits=1..7), no refiner.
  • TieredQ: TieredQIVFIndex at fractional budgets close to zvec's sizes.
  • One query per Python call, pinned to one core.
  • Index memory is each index's compressed size: zvec's *.qindex.* files against TieredQ's storage_bytes. These are
    index sizes, not measured process RAM. zvec's full FP32 copy is not counted.

On an AVX-512 host (Skylake-X), the least index memory reaching each recall@10 target:

recall@10 zvec bits/vector TieredQ bits/vector ratio
0.80 1,953 1,084 0.56×
0.90 2,721 1,879 0.69×
0.95 3,490 2,498 0.72×
0.97 4,259 3,215 0.75×
0.98 5,027 3,282 0.65×
0.99 5,794 4,082 0.70×
  • At equal memory, TieredQ has equal or higher recall at every nprobe. At full probe: 1 bit 0.860 against 0.741,
    2 bits 0.941 against 0.862, 3 bits 0.969 against 0.924.
  • Speed at equal recall is mixed. TieredQ is faster at recall ≤ 0.85 (1.6×) and at 0.99 (1.5×). zvec's fastest
    configurations are 1.1–1.25× faster from 0.90 to 0.98, using more memory.
  • On a 4-vCPU AVX2 VM (AMD EPYC Milan), the memory saving held (25–46%), but zvec was 1.4–3.8× faster from recall 0.90
    up. Those runs predate TieredQ's current scan kernels, and I haven't remeasured them yet.
  • On Faiss, at the same partition, TieredQ's IVF needs 16–40% less RAM than IndexIVFRaBitQ at matched recall, on
    1.34M × 768 and 8.84M × 1024 sets
    (results).

How it would differ from IVF_RABITQ

  • Trained codec. RaBitQ is data-oblivious; TieredQ learns a model (PCA basis, bit allocation, a small set of
    centroids) from a sample, about 32K rows. A collection, or each segment, would train once and store the model with
    the index. Rows added later are encoded with the existing model.
  • No residuals. Codes don't depend on their list, so moving, merging or compacting rows doesn't re-encode them.
  • Fractional budgets. A user can pick a memory budget (e.g. 1.25 bits/dim) instead of whole bits.

Questions

  1. Would you consider a TieredQ-based IVF index type in zvec? If so, as part of the core library, or through an
    extension point?
  2. How should a trained codec fit zvec's segments: one model per collection, or one per segment, retrained when a
    segment is rebuilt?
  3. Which benchmarks would you want to see before a PR: larger collections, measured process RAM, or specific
    hardware?

I'm happy to answer any questions and do the integration and to maintain it.

Alternatives Considered

Alternatives are RaBitQ and TurboQuant as mentioned above.

Affected Area

{"label" => "C++ Core (storage, indexing)"}

Lingua principale
C++
Stelle
16.3k
Fork
1k
Merge medio
2g 10h
PR unite (30g)
32

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di alibaba/zvec

Tutte le issue di alibaba/zvec

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.