You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support code-first vector storage (drop raw floats / ingest pre-quantized codes) for LSM_VECTOR #3162
LSM_VECTOR hard-codes ARRAY_OF_FLOATS input (getKeyTypes()), so we must ingest float32 vectors even when using INT8/BINARY/PQ.
Quantization shrinks only the index files (lsmvecidx, .vecpq, etc.); the float bucket (~5.6 GB for 1M @1024 dimension) is always persisted/mmap’d, so disk and RSS stay high across all quantization modes.
What’s missing
A way to build indexes directly from quantized codes (int8, binary, PQ) without requiring a float property.
A built-in option to drop or rewrite the raw float property after index build to reclaim disk/RSS.
Prior art
Milvus/Qdrant/Weaviate/Pinecone: compression modes with store_raw_vector-style toggles to drop originals.
Faiss IVF_PQ: supports adding precomputed codes; raw vectors optional.
Requested features (phased)
Post-build drop/convert: after index build, allow null/drop of the float property or rewrite it to a compact code representation, then compact.
Codes-first ingestion: allow ARRAY_OF_BYTES/BINARY as key type for LSM_VECTOR; skip re-quantization and load provided codes (and PQ codebooks) directly.
PQ storage toggle: for PQ, permit storing only PQ codes/codebooks as the primary persisted form (no float bucket).
Why it matters (disk + memory)
Removing the float bucket cuts disk by 4–16× and lowers RSS by eliminating the large mmap’d region that currently dominates memory. Today RSS is ~flat across NONE/INT8/BINARY/PQ because the float bucket is always present.
At tens/hundreds of millions of vectors, bucket cost overwhelms the quantized index savings.
Bench context
MSMARCO-1M @1024 dimension: bucket ~5.6 GB across modes; INT8 index ~999 MB; PQ index ~11 MB + .vecpq ~247 MB; BINARY index ~140 MB. Total DB size and peak RSS stay high because floats are always stored/mapped.
API thoughts
New index option: store_raw_vectors=false (default true for compatibility).
New builder path: quantization_input=BYTES plus metadata describing encoding (INT8, BINARY, or PQ with M/K/centroids).
Safe fallback: if raw floats are absent but codes exist, allow search and rebuild without needing floats.
Here’s a concrete plan for ArcadeDB Java changes to support codes-first/dropping floats, with suggested implementation touchpoints:
Allow non-float key types when a “codes input” mode is set
Update getKeyTypes() in LSMVectorIndex.java to return Type.ARRAY_OF_FLOATS by default, but accept Type.BINARY/Type.ARRAY_OF_BYTES when a new metadata flag (e.g., metadata.quantizationInput=BYTES) is set and quantizationType is INT8/BINARY/PRODUCT.
Plumb this flag through metadata and builders: add quantizationInput (enum: FLOATS, BYTES) to LSMVectorIndexMetadata.java with JSON serialization/deserialization, plus setters in TypeLSMVectorIndexBuilder.java and BucketLSMVectorIndexBuilder.java.
In put()/bulk load paths, branch on quantizationInput. If BYTES:
Skip float parsing; treat the property as raw codes and store directly in the index’s code storage (for INT8/BINARY) or populate PQ code arrays and codebooks (for PRODUCT) without re-training.
Validate length matches expected encoded size (e.g., dim bytes for INT8; dim/8 for BINARY; M * code_size for PQ).
If PQ: require codebooks to be provided (e.g., another metadata blob or a side property). Alternatively, disallow BYTES for PQ until codebook ingestion is defined.
Add a “drop raw floats after build” option (simpler, short-term win)
Add storeRawVectors=true|false to metadata (default true). After buildGraphWithChunking finishes, if false, run a post-build pass to null out the vector property for the indexed type and force a compact, so the bucket no longer mmap’s 5.6 GB of floats.
Expose this flag in builders and schema JSON. Guard with a warning: dropping floats means rebuilds can’t re-encode unless codes are present.
PQ-specific storage toggle
For quantizationType=PRODUCT, write PQ codes into .vecpq as today, but if storeRawVectors=false, avoid writing floats to the bucket (or rewrite them to PQ codes in a BINARY property). That requires the index to serve reads from the PQ store and never expect raw floats.
Goal: allow LSM vector indexes to store quantized codes in the bucket (and optionally drop raw float32) so disk/RSS shrink when quantization is enabled.
Config: add an opt-in flag (e.g., storeRawVectors=false or storeQuantizedVectors=true); default stays current (floats kept) for safety.
Ingest path:
INT8/BINARY: write quantized bytes into the bucket instead of floats.
PQ: write PQ codes to the bucket; keep codebooks alongside (as today in .vecpq).
Optionally allow dual storage (floats + codes) if the flag is left true.
Query path: operate on codes; decode to floats only where needed (e.g., re-ranking, graph ops).
Metadata/versioning: bump index metadata to record bucket payload type (floats vs codes); refuse/auto-upgrade incompatible files.
Migration/compat: mixed deployments reject incompatible indexes unless rebuilt; provide a clear error and rebuild guidance.
Testing: build/query/backup/restore across modes (NONE/INT8/BINARY/PQ) with flag on/off; cover mmap sizing/RSS regression; ensure recall parity when decoding is involved.
Decided not to proceed with the “drop raw floats when quantized” work. Keeping both raw vectors and codes in the bucket didn’t pan out, and the build/test path for quantized storage got too fragile (engine test-jar deps, graph vs. inline payloads, etc.). I’m pausing this effort; no code change needed. If we revisit later, we should design a clean storage path for quantized payloads (or a dedicated PQ file) and add end-to-end tests before toggling storeRawVectors off.
Activity
tae898 commentedon Jan 16, 2026
Here’s a concrete plan for ArcadeDB Java changes to support codes-first/dropping floats, with suggested implementation touchpoints:
Allow non-float key types when a “codes input” mode is set
getKeyTypes()in LSMVectorIndex.java to returnType.ARRAY_OF_FLOATSby default, but acceptType.BINARY/Type.ARRAY_OF_BYTESwhen a new metadata flag (e.g.,metadata.quantizationInput=BYTES) is set andquantizationTypeisINT8/BINARY/PRODUCT.quantizationInput(enum: FLOATS, BYTES) to LSMVectorIndexMetadata.java with JSON serialization/deserialization, plus setters in TypeLSMVectorIndexBuilder.java and BucketLSMVectorIndexBuilder.java.put()/bulk load paths, branch onquantizationInput. If BYTES:M * code_sizefor PQ).Add a “drop raw floats after build” option (simpler, short-term win)
storeRawVectors=true|falseto metadata (default true). AfterbuildGraphWithChunkingfinishes, if false, run a post-build pass to null out the vector property for the indexed type and force a compact, so the bucket no longer mmap’s 5.6 GB of floats.PQ-specific storage toggle
quantizationType=PRODUCT, write PQ codes into.vecpqas today, but ifstoreRawVectors=false, avoid writing floats to the bucket (or rewrite them to PQ codes in a BINARY property). That requires the index to serve reads from the PQ store and never expect raw floats.Metadata plumbing
LSMVectorIndexMetadata: add fieldsquantizationInput,storeRawVectors, (optionally)pqCodebooklocation if ingesting precomputed PQ.toJSON()/fromJSON()inLSMVectorIndexinclude the new fields; adjustsetMetadata()to honor them.Validation
quantizationInput=BYTESunlessquantizationType != NONE.storeRawVectors=falseand no codes present, mark index INVALID with a clear error.Docs/API
quantizationInput="BYTES"orstoreRawVectors=false.tae898 commentedon Jan 16, 2026
@lvca
I think this can solve the problem that no matter what quantization we use, the memory consumption is the same.
See #3140 (comment)
tae898 commentedon Jan 16, 2026
@lvca
Can you assign this to me? I wanna try to solve it myself.
lvca commentedon Jan 16, 2026
All yours ;-)
tae898 commentedon Jan 16, 2026
storeRawVectors=falseorstoreQuantizedVectors=true); default stays current (floats kept) for safety..vecpq).tae898 commentedon Jan 17, 2026
Decided not to proceed with the “drop raw floats when quantized” work. Keeping both raw vectors and codes in the bucket didn’t pan out, and the build/test path for quantized storage got too fragile (engine test-jar deps, graph vs. inline payloads, etc.). I’m pausing this effort; no code change needed. If we revisit later, we should design a clean storage path for quantized payloads (or a dedicated PQ file) and add end-to-end tests before toggling storeRawVectors off.
chore(deps): bump gremlin.version from 3.7.3 to 3.7.4 [skip ci]