zeusdb-vector-database 0.11.0__tar.gz → 0.13.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/Cargo.lock +5 -38
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/Cargo.toml +1 -2
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/PKG-INFO +107 -37
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/README.md +106 -36
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/bindings/python/src/conversion.rs +32 -9
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/bindings/python/src/hnsw_index/mod.rs +54 -14
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/core/src/admit.rs +55 -52
- zeusdb_vector_database-0.13.0/crates/core/src/bitmap.rs +407 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/core/src/columns.rs +680 -170
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/core/src/error.rs +122 -8
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/core/src/frame.rs +55 -5
- zeusdb_vector_database-0.13.0/crates/core/src/graph/dump.rs +3621 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/core/src/graph/fuzz.rs +203 -22
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/core/src/graph/mod.rs +347 -142
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/core/src/graph/mutable/insert.rs +16 -9
- zeusdb_vector_database-0.13.0/crates/core/src/graph/mutable/layout_tests.rs +85 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/core/src/graph/mutable/mod.rs +636 -240
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/core/src/graph/store.rs +7 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/core/src/graph/structure.rs +157 -40
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/core/src/graph/test_graph.rs +1 -1
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/core/src/graph/traverse.rs +9 -9
- zeusdb_vector_database-0.13.0/crates/core/src/ids.rs +1319 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/core/src/journal.rs +68 -67
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/core/src/lib.rs +24 -12
- zeusdb_vector_database-0.13.0/crates/core/src/metadata.rs +856 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/core/src/operation.rs +159 -6
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/core/src/space.rs +172 -67
- zeusdb_vector_database-0.13.0/crates/core/src/storage/fs.rs +656 -0
- zeusdb_vector_database-0.13.0/crates/core/src/storage/mod.rs +174 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/Cargo.toml +4 -1
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/apply.rs +38 -22
- zeusdb_vector_database-0.13.0/crates/hnsw/src/collection/close_up_tests.rs +2089 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/construct.rs +30 -17
- zeusdb_vector_database-0.13.0/crates/hnsw/src/collection/dense.rs +2537 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/durability_tests.rs +7 -3
- zeusdb_vector_database-0.13.0/crates/hnsw/src/collection/features_tests.rs +612 -0
- zeusdb_vector_database-0.13.0/crates/hnsw/src/collection/id_range_tests.rs +887 -0
- zeusdb_vector_database-0.13.0/crates/hnsw/src/collection/identity_tests.rs +750 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/insert.rs +1624 -379
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/int8_tests.rs +32 -24
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/journal_tests.rs +137 -22
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/mod.rs +340 -71
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/mutation_tests.rs +192 -2
- zeusdb_vector_database-0.13.0/crates/hnsw/src/collection/numbering_tests.rs +369 -0
- zeusdb_vector_database-0.13.0/crates/hnsw/src/collection/page.rs +411 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/persist.rs +273 -163
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/persist_tests.rs +543 -36
- zeusdb_vector_database-0.13.0/crates/hnsw/src/collection/positions_tests.rs +2650 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/query.rs +3 -5
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/query_tests.rs +12 -8
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/replay_tests.rs +566 -13
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/search.rs +32 -41
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/spaces_tests.rs +2 -2
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/stats.rs +63 -36
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/training.rs +109 -57
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/journal.rs +60 -29
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/lib.rs +4 -4
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/locks.rs +8 -2
- zeusdb_vector_database-0.13.0/crates/hnsw/src/persistence/features.rs +344 -0
- zeusdb_vector_database-0.13.0/crates/hnsw/src/persistence/framed.rs +498 -0
- zeusdb_vector_database-0.13.0/crates/hnsw/src/persistence/legacy.rs +429 -0
- zeusdb_vector_database-0.13.0/crates/hnsw/src/persistence/tests.rs +1414 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/persistence.rs +1277 -752
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/rerank.rs +41 -20
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/sparse/Cargo.toml +11 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/sparse/src/calibrate.rs +4 -4
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/sparse/src/index.rs +626 -81
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/sparse/src/lib.rs +11 -2
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/sparse/src/persist.rs +274 -38
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/sparse/src/search.rs +518 -34
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/sparse/src/verify.rs +42 -21
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/pyproject.toml +1 -1
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/src/zeusdb_vector_database/__init__.py +1 -1
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/src/zeusdb_vector_database/vector_database.py +2 -3
- zeusdb_vector_database-0.11.0/crates/core/src/graph/dump.rs +0 -1754
- zeusdb_vector_database-0.11.0/crates/core/src/ids.rs +0 -685
- zeusdb_vector_database-0.11.0/crates/core/src/metadata.rs +0 -349
- zeusdb_vector_database-0.11.0/crates/hnsw/src/collection/dense.rs +0 -981
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/LICENSE +0 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/NOTICE +0 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/bindings/python/Cargo.toml +0 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/bindings/python/src/durability.rs +0 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/bindings/python/src/hnsw_index/construct.rs +0 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/bindings/python/src/hnsw_index/input.rs +0 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/bindings/python/src/hnsw_index/query.rs +0 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/bindings/python/src/lib.rs +0 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/bindings/python/src/logging.rs +0 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/bindings/python/src/tokenizer.rs +0 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/core/Cargo.toml +0 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/core/src/checksum.rs +0 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/core/src/distance.rs +0 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/core/src/filter.rs +0 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/core/src/fusion.rs +0 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/core/src/graph/guard_tests.rs +0 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/core/src/graph/levels.rs +0 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/core/src/int8.rs +0 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/core/src/kill.rs +0 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/core/src/pq.rs +0 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/core/src/rng.rs +0 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/core/src/test_vectors.rs +0 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/crash_tests.rs +0 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/collection/input.rs +0 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/hnsw/src/flusher.rs +0 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/sparse/src/corpus.rs +0 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/text/Cargo.toml +0 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/text/src/dictionary.rs +0 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/text/src/lib.rs +0 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/text/src/tokenizer.rs +0 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/crates/text/src/vectorize.rs +0 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/src/zeusdb_vector_database/logging_config.py +0 -0
- {zeusdb_vector_database-0.11.0 → zeusdb_vector_database-0.13.0}/src/zeusdb_vector_database/py.typed +0 -0
|
@@ -26,26 +26,6 @@ version = "1.5.1"
|
|
|
26
26
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
27
27
|
checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
|
|
28
28
|
|
|
29
|
-
[[package]]
|
|
30
|
-
name = "bincode"
|
|
31
|
-
version = "2.0.1"
|
|
32
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
33
|
-
checksum = "36eaf5d7b090263e8150820482d5d93cd964a81e4019913c972f4edcc6edb740"
|
|
34
|
-
dependencies = [
|
|
35
|
-
"bincode_derive",
|
|
36
|
-
"serde",
|
|
37
|
-
"unty",
|
|
38
|
-
]
|
|
39
|
-
|
|
40
|
-
[[package]]
|
|
41
|
-
name = "bincode_derive"
|
|
42
|
-
version = "2.0.1"
|
|
43
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
44
|
-
checksum = "bf95709a440f45e986983918d0e8a1f30a9b1df04918fc828670606804ac3c09"
|
|
45
|
-
dependencies = [
|
|
46
|
-
"virtue",
|
|
47
|
-
]
|
|
48
|
-
|
|
49
29
|
[[package]]
|
|
50
30
|
name = "bitflags"
|
|
51
31
|
version = "2.13.1"
|
|
@@ -871,24 +851,12 @@ version = "1.0.24"
|
|
|
871
851
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
872
852
|
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
|
873
853
|
|
|
874
|
-
[[package]]
|
|
875
|
-
name = "unty"
|
|
876
|
-
version = "0.0.4"
|
|
877
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
878
|
-
checksum = "6d49784317cd0d1ee7ec5c716dd598ec5b4483ea832a2dced265471cc0f690ae"
|
|
879
|
-
|
|
880
854
|
[[package]]
|
|
881
855
|
name = "valuable"
|
|
882
856
|
version = "0.1.1"
|
|
883
857
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
884
858
|
checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65"
|
|
885
859
|
|
|
886
|
-
[[package]]
|
|
887
|
-
name = "virtue"
|
|
888
|
-
version = "0.0.18"
|
|
889
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
890
|
-
checksum = "051eb1abcf10076295e815102942cc58f9d5e3b4560e46e53c21e8ff6f3af7b1"
|
|
891
|
-
|
|
892
860
|
[[package]]
|
|
893
861
|
name = "wasm-bindgen"
|
|
894
862
|
version = "0.2.127"
|
|
@@ -1034,7 +1002,7 @@ dependencies = [
|
|
|
1034
1002
|
|
|
1035
1003
|
[[package]]
|
|
1036
1004
|
name = "zeusdb-vector-core"
|
|
1037
|
-
version = "0.
|
|
1005
|
+
version = "0.13.0"
|
|
1038
1006
|
dependencies = [
|
|
1039
1007
|
"rand",
|
|
1040
1008
|
"rand_chacha",
|
|
@@ -1047,9 +1015,8 @@ dependencies = [
|
|
|
1047
1015
|
|
|
1048
1016
|
[[package]]
|
|
1049
1017
|
name = "zeusdb-vector-hnsw"
|
|
1050
|
-
version = "0.
|
|
1018
|
+
version = "0.13.0"
|
|
1051
1019
|
dependencies = [
|
|
1052
|
-
"bincode",
|
|
1053
1020
|
"chrono",
|
|
1054
1021
|
"rand",
|
|
1055
1022
|
"rayon",
|
|
@@ -1063,7 +1030,7 @@ dependencies = [
|
|
|
1063
1030
|
|
|
1064
1031
|
[[package]]
|
|
1065
1032
|
name = "zeusdb-vector-python"
|
|
1066
|
-
version = "0.
|
|
1033
|
+
version = "0.13.0"
|
|
1067
1034
|
dependencies = [
|
|
1068
1035
|
"chrono",
|
|
1069
1036
|
"numpy",
|
|
@@ -1078,7 +1045,7 @@ dependencies = [
|
|
|
1078
1045
|
|
|
1079
1046
|
[[package]]
|
|
1080
1047
|
name = "zeusdb-vector-sparse"
|
|
1081
|
-
version = "0.
|
|
1048
|
+
version = "0.13.0"
|
|
1082
1049
|
dependencies = [
|
|
1083
1050
|
"serde",
|
|
1084
1051
|
"tempfile",
|
|
@@ -1088,7 +1055,7 @@ dependencies = [
|
|
|
1088
1055
|
|
|
1089
1056
|
[[package]]
|
|
1090
1057
|
name = "zeusdb-vector-text"
|
|
1091
|
-
version = "0.
|
|
1058
|
+
version = "0.13.0"
|
|
1092
1059
|
dependencies = [
|
|
1093
1060
|
"serde",
|
|
1094
1061
|
"zeusdb-vector-core",
|
|
@@ -27,7 +27,7 @@ resolver = "2"
|
|
|
27
27
|
members = ["crates/*", "bindings/*"]
|
|
28
28
|
|
|
29
29
|
[workspace.package]
|
|
30
|
-
version = "0.
|
|
30
|
+
version = "0.13.0"
|
|
31
31
|
edition = "2021"
|
|
32
32
|
# The same licence pyproject.toml declares, LICENSE holds and NOTICE restates.
|
|
33
33
|
# cargo-deny reads this field. The wheel's metadata is unaffected, because
|
|
@@ -78,7 +78,6 @@ rand_chacha = "0.10"
|
|
|
78
78
|
# run time component, so it adds nothing to the wheel beyond the code it
|
|
79
79
|
# generates.
|
|
80
80
|
wide = "1"
|
|
81
|
-
bincode = "2.0.1"
|
|
82
81
|
chrono = { version = "0.4.41", features = ["serde"] } # <-- For timestamps
|
|
83
82
|
# Modern structured logging
|
|
84
83
|
tracing = "0.1"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: zeusdb-vector-database
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.13.0
|
|
4
4
|
Classifier: Programming Language :: Rust
|
|
5
5
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
6
|
Requires-Dist: numpy>=2.2.6,<3.0.0
|
|
@@ -820,7 +820,7 @@ storage_mode_description: raw_only
|
|
|
820
820
|
| `quantized_codes_memory_mb` | The map holding a second copy of every product quantized code, which grows with the record count. `0.00` on a scalar index, whose rows live in the graph alone |
|
|
821
821
|
| `codebook_memory_mb`, `sdc_table_memory_mb`, `centroid_norm_memory_mb` | The trained product quantization tables, fixed by `dim`, `subvectors` and `bits` |
|
|
822
822
|
| `scale_memory_mb` | The scales of a scalar index, `dim` floats once per index |
|
|
823
|
-
| `index_bookkeeping_memory_mb` | The id store that finds a record, the per-record metadata, the declared columns, the live sets, the index level metadata and, on a product quantized index, the table of the code map |
|
|
823
|
+
| `index_bookkeeping_memory_mb` | The id store that finds a record, the per-record metadata, the declared columns, the live sets, the table that finds each record's graph node, the index level metadata and, on a product quantized index, the table of the code map |
|
|
824
824
|
| `reserved_memory_mb` | The part of `total_memory_mb` no record has been written into. It is committed and not resident, and it is exactly what `shrink_to_fit()` returns |
|
|
825
825
|
| `total_memory_mb` | The sum of the memory figures above, `reserved_memory_mb` being inside that sum rather than beside it, plus `sparse_memory_mb` and `dictionary_memory_mb` where the index declares a sparse space |
|
|
826
826
|
| `quantization_type` | `pq`, `int8`, or `none` on an unquantized index |
|
|
@@ -832,14 +832,14 @@ On a quantized index it also carries `quantization_active`, `quantization_traine
|
|
|
832
832
|
|
|
833
833
|
| mode | reported | reserved | written | resident | reported / resident |
|
|
834
834
|
|---|---:|---:|---:|---:|---:|
|
|
835
|
-
| no quantization | 513.
|
|
836
|
-
| `quantized_with_raw` |
|
|
837
|
-
| `quantized_only` |
|
|
838
|
-
| `int8` |
|
|
835
|
+
| no quantization | 513.71 MiB | 204.54 | 309.17 | 311.55 | 1.65 |
|
|
836
|
+
| `quantized_with_raw` | 544.06 | 219.50 | 324.56 | 344.26 | 1.58 |
|
|
837
|
+
| `quantized_only` | 32.07 | 0.47 | 31.60 | 49.84 | 0.64 |
|
|
838
|
+
| `int8` | 90.11 | 0.47 | 89.64 | 92.30 | 0.98 |
|
|
839
839
|
|
|
840
840
|
**Size infrastructure from the resident figure, and compare two configurations by `total_memory_mb` minus `reserved_memory_mb`**, which is what each has written and is free of where each landed in its doubling cycle. The two rows that hold raw vectors report far above what they hold, because at `dim=1536` the store holding the vectors is reserved under a byte budget well short of the declaration and then grows by doubling, so its last doubling left capacity for far more records than the index holds; `shrink_to_fit()` hands that back once the inserts are done. The `quantized_only` row reports below what it holds, because the map that keys a code by id costs two small heap blocks a record and the allocator charges each block more than the index asked for.
|
|
841
841
|
|
|
842
|
-
`index_bookkeeping_memory_mb` is proportional to the record count and independent of the dimension. At 100,000 records with short decimal ids and no metadata it reads
|
|
842
|
+
`index_bookkeeping_memory_mb` is proportional to the record count and independent of the dimension. At 100,000 records with short decimal ids and no metadata it reads 40.4 bytes a record, being 20 for the id store, 16 for the per-record metadata entry and 4 for the table that finds the record's graph node. A uuid costs 35 more, a record carrying metadata costs 40 bytes a field beside the text of its string values, and a `quantized_only` product quantized index adds the code map's table and its copy of the id at 69 bytes a record. The figure steps with the id store's table rather than climbing smoothly, so it reads 45.7 bytes a record at 115,000 records, where the table has just doubled.
|
|
843
843
|
|
|
844
844
|
**Figures the keys give by arithmetic.** None of these is a key, because each is a division over two that are:
|
|
845
845
|
|
|
@@ -1148,7 +1148,7 @@ Clearing an empty index returns `0` and is not an error. The generated ID counte
|
|
|
1148
1148
|
|
|
1149
1149
|
#### ♻️ Return the graph's spare capacity
|
|
1150
1150
|
|
|
1151
|
-
An index built by inserting grows its graph buffers geometrically, so the last growth leaves the largest of them holding close to twice what they use. `shrink_to_fit()` returns that slack to the allocator and reports the bytes it released
|
|
1151
|
+
An index built by inserting grows its graph buffers geometrically, so the last growth leaves the largest of them holding close to twice what they use. `shrink_to_fit()` returns that slack to the allocator, with the entries that the id store, the per-record metadata and the declared columns reserved and no record has written, and reports the bytes it released. `get_stats()["reserved_memory_mb"]` prices the same bytes before the call is made.
|
|
1152
1152
|
|
|
1153
1153
|
```python
|
|
1154
1154
|
fresh = vdb.create("hnsw", dim=8, expected_size=300)
|
|
@@ -1172,7 +1172,7 @@ True
|
|
|
1172
1172
|
0
|
|
1173
1173
|
```
|
|
1174
1174
|
|
|
1175
|
-
The index above declared 300 records and was given 500, so its graph grew and left slack behind, and `reserved_memory_mb` named it before the call: the call returns exactly that figure and the key reads `0.00` afterwards. `index`, the index used throughout this section, returns
|
|
1175
|
+
The index above declared 300 records and was given 500, so its graph and its stores grew and left slack behind, and `reserved_memory_mb` named it before the call: the call returns exactly that figure and the key reads `0.00` afterwards. `index`, the index used throughout this section, returns no graph slack, because `compact()` was called on it earlier and compaction already shrinks the graph it rebuilds. It returns the entries its stores reserved for the 10,000 records its `expected_size` declares, since it holds far fewer.
|
|
1176
1176
|
|
|
1177
1177
|
**No node, edge or distance is touched**, so every search returns the same page with the same scores.
|
|
1178
1178
|
|
|
@@ -1417,11 +1417,11 @@ Measured resident, one index per interpreter, 50,000 records of real embeddings
|
|
|
1417
1417
|
|
|
1418
1418
|
| dataset | dim | unquantized | `quantized_only` | `quantized_with_raw` | `int8` |
|
|
1419
1419
|
|---|---:|---:|---:|---:|---:|
|
|
1420
|
-
| dbpedia-openai | 1,536 |
|
|
1421
|
-
| sift-128 | 128 | 42.
|
|
1422
|
-
| glove-100 | 100 | 37.
|
|
1420
|
+
| dbpedia-openai | 1,536 | 311.6 MiB | 49.8 MiB, 0.16x | 344.3 MiB, 1.10x | 92.3 MiB, 0.30x |
|
|
1421
|
+
| sift-128 | 128 | 42.6 MiB | 29.9 MiB, 0.70x | 54.7 MiB, 1.28x | 24.2 MiB, 0.57x |
|
|
1422
|
+
| glove-100 | 100 | 37.3 MiB | 29.9 MiB, 0.80x | 50.9 MiB, 1.37x | 23.0 MiB, 0.62x |
|
|
1423
1423
|
|
|
1424
|
-
**Pick `quantized_only` when memory is the constraint and `quantized_with_raw` when accuracy is, and read [Scalar Quantization](#-scalar-quantization) before either.** What `quantized_only` saves is set by the share of a record that is the vector, and that share falls with the dimension:
|
|
1424
|
+
**Pick `quantized_only` when memory is the constraint and `quantized_with_raw` when accuracy is, and read [Scalar Quantization](#-scalar-quantization) before either.** What `quantized_only` saves is set by the share of a record that is the vector, and that share falls with the dimension: 20% at `dim=100`, 30% at `dim=128` and 84% at `dim=1,536` on the rows above. `get_stats()` prices your own index on your own records, which is the figure to size against.
|
|
1425
1425
|
|
|
1426
1426
|
`create()` warns when `quantized_only` cannot repay its fixed tables at the `expected_size` you declared, naming the record count above which it starts saving. Raise `expected_size` if your estimate was low, or drop `quantization_config`. `quantized_with_raw` never repays them, so it gets the warning that names the mode instead.
|
|
1427
1427
|
|
|
@@ -1580,11 +1580,11 @@ Recall at 10 against exact search on 100,000 records, and resident memory on 50,
|
|
|
1580
1580
|
|
|
1581
1581
|
| dataset | dim | unquantized | `quantized_only` | `int8` |
|
|
1582
1582
|
|---|---:|---:|---:|---:|
|
|
1583
|
-
| dbpedia-openai | 1,536 | 0.9929,
|
|
1584
|
-
| sift-128 | 128 | 0.9988, 42.
|
|
1585
|
-
| glove-100 | 100 | 0.8858, 37.
|
|
1583
|
+
| dbpedia-openai | 1,536 | 0.9929, 311.6 MiB | 0.4893, 49.8 MiB | 0.9861, 92.3 MiB |
|
|
1584
|
+
| sift-128 | 128 | 0.9988, 42.6 MiB | 0.4038, 29.9 MiB | 0.9827, 24.2 MiB |
|
|
1585
|
+
| glove-100 | 100 | 0.8858, 37.3 MiB | 0.2647, 29.9 MiB | 0.8788, 23.0 MiB |
|
|
1586
1586
|
|
|
1587
|
-
A scalar index gives up two hundredths of recall for a third to two thirds of the memory, and searching it is no slower than searching an unquantized one. A trained index writes `int8_scales.zdbint8` and `int8_rows.zdbint8` in place of the two `pq_` files
|
|
1587
|
+
A scalar index gives up two hundredths of recall for a third to two thirds of the memory, and searching it is no slower than searching an unquantized one. A trained index writes `int8_scales.zdbint8` and `int8_rows.zdbint8` in place of the two `pq_` files.
|
|
1588
1588
|
|
|
1589
1589
|
**A value beyond the range its dimension's sample reached is clipped, not refused.** `quantization_saturated_values` counts every clipped value, and a rate that climbs as records arrive says the sample no longer covers the data.
|
|
1590
1590
|
|
|
@@ -1601,7 +1601,7 @@ The persistence system supports:
|
|
|
1601
1601
|
✅ **Quantization support**, both raw and quantized storage modes, including the trained codebook or scales
|
|
1602
1602
|
✅ **Training state recovery**, so an index saved mid-collection resumes collecting
|
|
1603
1603
|
✅ **Sparse spaces**, the postings and the term dictionary, under `spaces/<name>/`
|
|
1604
|
-
✅ **
|
|
1604
|
+
✅ **A format version and a list of features**, so a directory holding something this build cannot read is refused, naming it, rather than misread
|
|
1605
1605
|
✅ **Atomic saves**, so a reader sees the whole previous index or the whole new one
|
|
1606
1606
|
✅ **A digest per artefact**, checked on load, so a file that has changed since it was written is refused
|
|
1607
1607
|
✅ **A journal**, opened beside the directory on request, so every mutation since the last save is replayed when the directory opens
|
|
@@ -1718,9 +1718,9 @@ The `.save()` method creates a directory containing all index components:
|
|
|
1718
1718
|
|
|
1719
1719
|
```
|
|
1720
1720
|
my_index.zdb/
|
|
1721
|
-
├── manifest.json # Index metadata, file inventory and, if journaled, the journal record
|
|
1721
|
+
├── manifest.json # Index metadata, its features and identity, the file inventory and, if journaled, the journal record
|
|
1722
1722
|
├── config.json # HNSW configuration and index level metadata
|
|
1723
|
-
├── mappings.bin #
|
|
1723
|
+
├── mappings.bin # Every record's id and internal id (framed binary)
|
|
1724
1724
|
├── metadata.json # Per-record metadata (JSON format)
|
|
1725
1725
|
├── vectors.bin # Raw vectors (whenever the index holds any)
|
|
1726
1726
|
├── quantization.json # Quantization configuration and training state (if enabled)
|
|
@@ -1739,13 +1739,13 @@ my_index.zdb.zdbwal # The journal, beside the directory (if journaled)
|
|
|
1739
1739
|
|
|
1740
1740
|
`<name>` is the space's `name`, which defaults to `sparse`. `terms.zdbdict` is written only where the space was declared with a tokenizer. The journal is a sibling of the directory rather than a file inside it, and [Journaling an Index](#-journaling-an-index---journal_to) says why.
|
|
1741
1741
|
|
|
1742
|
-
`manifest.json` lists every file the save wrote under `files_included` and is the last file written, so it is the inventory of what the directory does hold. Beside the list, `file_digests` records each artefact's length and a digest of its contents, and for a journaled index a `journal` record names the sibling file, the collection id both share and the sequence the checkpoint holds.
|
|
1742
|
+
`manifest.json` lists every file the save wrote under `files_included` and is the last file written, so it is the inventory of what the directory does hold. Beside the list, `file_digests` records each artefact's length and, for each JSON artefact, a digest of its contents, and for a journaled index a `journal` record names the sibling file, the collection id both share and the sequence the checkpoint holds. `features` names what the directory holds, see [What a Directory Holds](#-what-a-directory-holds---features), and `identity` names the index it belongs to, its place among that index's saves and the save it came from, see [Identifying a Directory](#-identifying-a-directory---identity).
|
|
1743
1743
|
|
|
1744
1744
|
A directory saved by 0.6.0 or earlier holds `hnsw_index.hnsw.graph` and `hnsw_index.hnsw.data` in place of `hnsw_index.zdbgraph`. Opening it still works: the graph is rebuilt once from the stored records, and the next `.save()` writes the single file.
|
|
1745
1745
|
|
|
1746
1746
|
**`load()` refuses a directory that does not hold what its manifest names.** It checks `files_included` before it reads anything, and the graph dump is the one exempt artefact, because every record carries what the graph is built from. A directory missing any other file will not open, and the refusal names the file and says what it held. Restore it from a copy; the missing file cannot be rebuilt from the ones that remain. A file the manifest does not name is neither read nor complained about.
|
|
1747
1747
|
|
|
1748
|
-
**It also refuses a file that is present and has changed.** Each artefact is checked against the length
|
|
1748
|
+
**It also refuses a file that is present and has changed.** Each artefact is checked against the length `file_digests` records for it, and each JSON artefact against its digest, before anything parses it, so a file edited in place is refused with its name in the message, and a JSON artefact's refusal names both digests. Every binary artefact, being `mappings.bin`, `vectors.bin`, the two `pq_` files, the two scalar artefacts, a sparse space's two files and the graph dump, carries its own header and payload checksums, so the manifest records only its length. A dump that disagrees is rebuilt rather than refused, and any of the others is refused by its own frame.
|
|
1749
1749
|
|
|
1750
1750
|
A directory saved before 0.8.0 carries no digests, so nothing is verified and it loads exactly as it did.
|
|
1751
1751
|
|
|
@@ -1869,7 +1869,88 @@ The journal is `<path>.zdbwal`, a sibling of the directory rather than a file in
|
|
|
1869
1869
|
|
|
1870
1870
|
`get_stats()` reports five `journal_` keys on a journaled index, being the four the example prints and `journal_interval_ms`, which is present under `"interval"` alone.
|
|
1871
1871
|
|
|
1872
|
-
**Nothing checkpoints for you.** An index that is never checkpointed opens by replaying every record in its journal, each at the cost of the `add()` that wrote it, so a directory with a million records in the journal takes minutes to open where its checkpoint takes seconds. `journal_records` passing the record count is a reasonable trigger. A
|
|
1872
|
+
**Nothing checkpoints for you.** An index that is never checkpointed opens by replaying every record in its journal, each at the cost of the `add()` that wrote it, so a directory with a million records in the journal takes minutes to open where its checkpoint takes seconds. `journal_records` passing the record count is a reasonable trigger. A checkpoint is a save, so each one moves `identity`'s generation on by one, while the journal's own sequence counts records.
|
|
1873
|
+
|
|
1874
|
+
### 🪪 Identifying a Directory - .identity
|
|
1875
|
+
|
|
1876
|
+
Every save records what the directory is, under `identity` in `manifest.json`, and an index reports the same four values as its `identity` property.
|
|
1877
|
+
|
|
1878
|
+
| Key | What it is |
|
|
1879
|
+
|---|---|
|
|
1880
|
+
| `collection_id` | The index's id, 32 hexadecimal digits, drawn when the index is created and kept through every save and load. A journaled index's journal names the same id in its header |
|
|
1881
|
+
| `generation` | How many saves the index had made when it wrote, or read, its last directory. A new index is at 0, its first save writes 1, and each save writes one more |
|
|
1882
|
+
| `snapshot` | The id of the directory the index last saved or read, drawn at that save, or `None` before the first |
|
|
1883
|
+
| `parent` | The `snapshot` that directory was saved from, or `None` on a first save |
|
|
1884
|
+
|
|
1885
|
+
```python
|
|
1886
|
+
index = vdb.create("hnsw", dim=4, expected_size=100)
|
|
1887
|
+
index.add({"ids": ["a", "b"], "embeddings": [[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0]]})
|
|
1888
|
+
print(index.identity["generation"], index.identity["snapshot"])
|
|
1889
|
+
|
|
1890
|
+
index.save("identified.zdb")
|
|
1891
|
+
first = index.identity
|
|
1892
|
+
print(first["generation"], first["parent"])
|
|
1893
|
+
|
|
1894
|
+
loaded = vdb.load("identified.zdb")
|
|
1895
|
+
print(loaded.identity == first)
|
|
1896
|
+
|
|
1897
|
+
loaded.save("identified.zdb")
|
|
1898
|
+
print(loaded.identity["generation"], loaded.identity["parent"] == first["snapshot"])
|
|
1899
|
+
print(loaded.identity["collection_id"] == first["collection_id"])
|
|
1900
|
+
```
|
|
1901
|
+
|
|
1902
|
+
*Output*
|
|
1903
|
+
|
|
1904
|
+
```
|
|
1905
|
+
0 None
|
|
1906
|
+
1 None
|
|
1907
|
+
True
|
|
1908
|
+
2 True
|
|
1909
|
+
True
|
|
1910
|
+
```
|
|
1911
|
+
|
|
1912
|
+
Of two directories of one index, the higher `generation` is the later save. A copy taken before the last save is one generation behind the directory saved after it, and that directory names the copy's `snapshot` as its `parent`. Two directories naming the same `parent` under different snapshots were each saved from the same state, which is what a copy opened and saved in its own place looks like. `clear()` keeps all four, since a cleared index is the same index, and `get_stats()` does not carry them.
|
|
1913
|
+
|
|
1914
|
+
A directory saved by 0.11.0 or earlier records no identity and opens as it always did. A journaled one takes the id its journal names, and any other is given one when it is opened. Its next save records that id at generation 1.
|
|
1915
|
+
|
|
1916
|
+
### 📋 What a Directory Holds - features
|
|
1917
|
+
|
|
1918
|
+
Every save lists what the directory holds under `features` in `manifest.json`, each feature marked `compatible` or `incompatible`, and `load()` reads the list before anything else in the directory.
|
|
1919
|
+
|
|
1920
|
+
```python
|
|
1921
|
+
import json
|
|
1922
|
+
|
|
1923
|
+
index = vdb.create("hnsw", dim=4, expected_size=100)
|
|
1924
|
+
index.add({"ids": ["a", "b"], "embeddings": [[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0]]})
|
|
1925
|
+
index.save("plain.zdb")
|
|
1926
|
+
|
|
1927
|
+
texts = vdb.create("hnsw", dim=4, expected_size=100, sparse={"name": "text", "tokenizer": "simple"})
|
|
1928
|
+
texts.add({"ids": ["a"], "embeddings": [[1.0, 0.0, 0.0, 0.0]], "texts": ["hello world"]})
|
|
1929
|
+
texts.journal_to("texts.zdb")
|
|
1930
|
+
|
|
1931
|
+
for path in ("plain.zdb", "texts.zdb"):
|
|
1932
|
+
with open(f"{path}/manifest.json") as f:
|
|
1933
|
+
manifest = json.load(f)
|
|
1934
|
+
print(path, manifest["format_version"], manifest["features"])
|
|
1935
|
+
```
|
|
1936
|
+
|
|
1937
|
+
*Output*
|
|
1938
|
+
|
|
1939
|
+
```
|
|
1940
|
+
plain.zdb 4.0.0 {'identity': 'compatible'}
|
|
1941
|
+
texts.zdb 4.0.0 {'identity': 'compatible', 'journal': 'incompatible', 'sparse': 'incompatible', 'text': 'incompatible'}
|
|
1942
|
+
```
|
|
1943
|
+
|
|
1944
|
+
| Feature | Listed when the directory holds | Mark |
|
|
1945
|
+
|---|---|---|
|
|
1946
|
+
| `identity` | its identity, which every save records | compatible |
|
|
1947
|
+
| `pq` | product quantization, trained or not | incompatible |
|
|
1948
|
+
| `int8` | scalar quantization, trained or not | incompatible |
|
|
1949
|
+
| `sparse` | a sparse space | incompatible |
|
|
1950
|
+
| `text` | a text layer on that space | incompatible |
|
|
1951
|
+
| `journal` | a journal beside the directory | incompatible |
|
|
1952
|
+
|
|
1953
|
+
A release that meets a feature it does not know refuses the directory with a message naming the feature, unless the directory marks it `compatible`, in which case the release opens the directory without it and its next save leaves the feature out. A later feature is a new name in this list rather than a new format version, so a directory holding nothing a release does not know keeps opening on that release. A directory saved by 0.11.0 or earlier lists no features and opens as it did.
|
|
1873
1954
|
|
|
1874
1955
|
<br />
|
|
1875
1956
|
|
|
@@ -1885,20 +1966,9 @@ The journal is `<path>.zdbwal`, a sibling of the directory rather than a file in
|
|
|
1885
1966
|
|
|
1886
1967
|
- **Same volume.** The staging directory is a sibling of the target, so both are on the target's volume and the move is a rename rather than a copy.
|
|
1887
1968
|
|
|
1888
|
-
- **Version compatibility.**
|
|
1889
|
-
|
|
1890
|
-
| Directory holds | Version written | Opens on |
|
|
1891
|
-
|---|---|---|
|
|
1892
|
-
| a dense space alone | 1.1.0 | every release that reads 1.x |
|
|
1893
|
-
| a dense space with scalar quantization | 1.2.0 | this release or later |
|
|
1894
|
-
| a sparse space | 2.0.0 | 0.10.0 or later |
|
|
1895
|
-
| a sparse space and scalar quantization | 2.1.0 | this release or later |
|
|
1896
|
-
| a journal | 3.0.0 | this release or later |
|
|
1897
|
-
| a journal and scalar quantization | 3.1.0 | this release or later |
|
|
1898
|
-
|
|
1899
|
-
A different major version is refused with a message naming the newer release. The scalar versions are minors because an older reader refuses such a directory on the first field of its `quantization.json` it does not know, rather than opening it wrongly.
|
|
1969
|
+
- **Version compatibility.** Every directory this release saves declares format version 4.0.0 and lists its features, see [What a Directory Holds](#-what-a-directory-holds---features). This release reads any 1.x, 2.x, 3.x or 4.x, so a directory an earlier release saved opens here, and saving it again writes 4.0.0. A 4.0.0 directory holds `mappings.bin`, `vectors.bin` and the two `pq_` files inside a frame with checksums of its own, where earlier releases wrote them in the bincode crate's encoding, so 0.5.0 to 0.11.0 refuse it at the version check with a message naming the newer release, and 0.3.0 to 0.4.1, which read no format version, refuse it when they decode its `mappings.bin`.
|
|
1900
1970
|
|
|
1901
|
-
- **Integrity checks on load.**
|
|
1971
|
+
- **Integrity checks on load.** Five run, in this order: the format version, then the features against the ones this release knows, then `files_included` against the directory, then each artefact against its recorded length and, for a JSON artefact, its digest, a binary artefact verifying its own checksums as it is read, then the restored record count against the count in `config.json`. Once `config.json` and `quantization.json` are read, the features a 4.0.0 directory lists are held to what it holds. A directory holding a sparse space adds two, being every record the space holds against the id mappings, and every term id the postings carry against the length of the dictionary. A journaled directory adds the journal's own, being the collection id in its header against the manifest's, its first record against the sequence the checkpoint holds, a record in its middle whose bytes changed after it was written, and every replayed record against the index it lands on. A directory recording an identity adds its own, being every id 32 hexadecimal digits and the generation 1 or more, and, where it is journaled, the collection id its journal record names against the identity's. A trained scalar directory adds the bounds of its two artefacts, being one finite positive scale per declared dimension, and one row per record the mappings hold in increasing internal id order. A 4.0.0 directory adds the bounds of its binary artefacts, being every internal id `vectors.bin` and `pq_codes.bin` name one that `mappings.bin` holds, one vector of the declared width for every record `mappings.bin` holds where the directory holds `vectors.bin`, one code of the declared width for each record coded, and a codebook of the shape `quantization.json` describes.
|
|
1902
1972
|
|
|
1903
1973
|
- **`save()` and `load()` are silent.** Every step they used to print to stdout is a `debug` log line instead, so a library caller sees nothing on stdout. Set `ZEUSDB_LOG_LEVEL=debug` to see the steps.
|
|
1904
1974
|
|
|
@@ -2507,7 +2577,7 @@ sparse_memory_mb 0.00
|
|
|
2507
2577
|
| `sparse_weighting` | `dot` or `bm25` |
|
|
2508
2578
|
| `sparse_records` | Records the space holds, which may be fewer than the index holds |
|
|
2509
2579
|
| `sparse_postings` | Live entries across every record, one per distinct term per record |
|
|
2510
|
-
| `sparse_dead_postings` | Occurrences left by removed records
|
|
2580
|
+
| `sparse_dead_postings` | Occurrences left by removed records. `compact()`, `rebuild()` and quantization training drop them, and so does a removal once the records removed since the last drop outnumber both 4,096 and the records held. A saved directory holds none |
|
|
2511
2581
|
| `sparse_memory_mb` | What the postings and their index hold |
|
|
2512
2582
|
| `sparse_tokenizer` | `simple` or `external`, on a text layer alone |
|
|
2513
2583
|
| `term_count` | Distinct terms the dictionary holds, on a text layer alone |
|