usearch 2.8.7 → 2.8.9

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.
Files changed (113) hide show
  1. package/CITATION.cff +1 -1
  2. package/CMakeLists.txt +3 -3
  3. package/CONTRIBUTING.md +26 -3
  4. package/Cargo.toml +1 -1
  5. package/Dockerfile +16 -0
  6. package/README.md +41 -38
  7. package/VERSION +1 -0
  8. package/binding.gyp +57 -8
  9. package/conanfile.py +1 -1
  10. package/include/usearch/index.hpp +1 -1
  11. package/include/usearch/index_plugins.hpp +28 -24
  12. package/javascript/README.md +64 -12
  13. package/javascript/lib.cpp +11 -3
  14. package/javascript/usearch.js +4 -2
  15. package/javascript/usearch.test.js +15 -0
  16. package/package.json +1 -2
  17. package/setup.py +76 -15
  18. package/simsimd/README.md +14 -13
  19. package/simsimd/include/simsimd/probability.h +2 -2
  20. package/simsimd/package.json +1 -1
  21. package/wasmer.toml +1 -1
  22. package/. npmignore +0 -14
  23. package/.gitignore +0 -95
  24. package/.vscode/launch.json +0 -181
  25. package/.vscode/settings.json +0 -180
  26. package/.vscode/tasks.json +0 -71
  27. package/Package.swift +0 -41
  28. package/csharp/.editorconfig +0 -361
  29. package/csharp/Cloud.Unum.USearch.sln +0 -34
  30. package/csharp/DEV_SETUP.md +0 -51
  31. package/csharp/Directory.Build.props +0 -29
  32. package/csharp/README.md +0 -74
  33. package/csharp/build_and_test.cmd +0 -31
  34. package/csharp/build_and_test.sh +0 -30
  35. package/csharp/nuget/nuget-package.props +0 -33
  36. package/csharp/pack.sh +0 -56
  37. package/csharp/src/Cloud.Unum.USearch.Tests/Cloud.Unum.USearch.Tests.csproj +0 -39
  38. package/csharp/src/Cloud.Unum.USearch.Tests/USearchIndexTests.cs +0 -1013
  39. package/csharp/src/Cloud.Unum.USearch.Tests/Usings.cs +0 -1
  40. package/docs/_static/custom.css +0 -26
  41. package/docs/_static/custom.js +0 -7
  42. package/docs/benchmarks.md +0 -245
  43. package/docs/benchmarks.rst +0 -5
  44. package/docs/c/index.rst +0 -11
  45. package/docs/c/reference.rst +0 -7
  46. package/docs/conf.dox +0 -2668
  47. package/docs/conf.py +0 -53
  48. package/docs/contributing.rst +0 -5
  49. package/docs/cpp/index.rst +0 -11
  50. package/docs/cpp/reference.rst +0 -17
  51. package/docs/csharp/index.rst +0 -6
  52. package/docs/format.md +0 -86
  53. package/docs/format.rst +0 -5
  54. package/docs/golang/index.rst +0 -6
  55. package/docs/index.rst +0 -33
  56. package/docs/java/index.rst +0 -11
  57. package/docs/java/reference.rst +0 -7
  58. package/docs/javascript/index.rst +0 -11
  59. package/docs/javascript/reference.rst +0 -12
  60. package/docs/python/index.rst +0 -11
  61. package/docs/python/reference.rst +0 -42
  62. package/docs/rust/index.rst +0 -6
  63. package/docs/swift/index.rst +0 -6
  64. package/docs/wolfram/index.rst +0 -6
  65. package/golang/README.md +0 -95
  66. package/golang/go.mod +0 -3
  67. package/golang/lib.go +0 -379
  68. package/golang/lib_test.go +0 -108
  69. package/java/README.md +0 -22
  70. package/java/cloud/unum/usearch/Index.java +0 -337
  71. package/java/cloud/unum/usearch/cloud_unum_usearch_Index.cpp +0 -197
  72. package/java/cloud/unum/usearch/cloud_unum_usearch_Index.h +0 -125
  73. package/java/test/IndexTest.java +0 -30
  74. package/objc/USearchObjective.mm +0 -299
  75. package/objc/include/USearchObjective.h +0 -154
  76. package/python/README.md +0 -292
  77. package/python/lib.cpp +0 -1216
  78. package/python/scripts/bench.ipynb +0 -193
  79. package/python/scripts/bench.py +0 -137
  80. package/python/scripts/bench_exact.py +0 -44
  81. package/python/scripts/cluster.ipynb +0 -160
  82. package/python/scripts/index_faiss.py +0 -100
  83. package/python/scripts/join.py +0 -155
  84. package/python/scripts/test_index.py +0 -247
  85. package/python/scripts/test_jit.py +0 -231
  86. package/python/scripts/test_sparse.py +0 -32
  87. package/python/scripts/test_tooling.py +0 -133
  88. package/python/usearch/__init__.py +0 -0
  89. package/python/usearch/client.py +0 -124
  90. package/python/usearch/eval.py +0 -470
  91. package/python/usearch/index.py +0 -1401
  92. package/python/usearch/io.py +0 -113
  93. package/python/usearch/numba.py +0 -121
  94. package/python/usearch/server.py +0 -137
  95. package/rust/README.md +0 -66
  96. package/rust/lib.cpp +0 -136
  97. package/rust/lib.hpp +0 -69
  98. package/rust/lib.rs +0 -610
  99. package/simsimd/CMakeLists.txt +0 -67
  100. package/simsimd/cpp/bench.cxx +0 -206
  101. package/simsimd/package-ci.json +0 -10
  102. package/simsimd/setup.py +0 -86
  103. package/swift/Index+Sugar.swift +0 -153
  104. package/swift/README.md +0 -48
  105. package/swift/Test.swift +0 -37
  106. package/swift/USearch.swift +0 -8
  107. package/wasm/CMakeLists.txt +0 -7
  108. package/wasm/README.md +0 -13
  109. package/wasm/lib.cpp +0 -5
  110. package/wolfram/CMakeLists.txt +0 -18
  111. package/wolfram/README.md +0 -13
  112. package/wolfram/lib.cpp +0 -160
  113. package/wolfram/test.wls +0 -27
@@ -1 +0,0 @@
1
- global using Xunit;
@@ -1,26 +0,0 @@
1
- p.caption {
2
- font-size: 0 !important;
3
- margin: 8px 0px !important;
4
- padding: 0 !important;
5
- border-bottom: 1px solid #8b7f8b12;
6
- }
7
-
8
- article>section>h1:nth-child(1) {
9
- display: none;
10
- }
11
-
12
- .sidebar-brand-text {
13
- cursor: initial;
14
- }
15
-
16
- table>tbody>tr>td {
17
- text-align: center;
18
- }
19
-
20
- table>tbody>tr>td:first-child {
21
- text-align: left;
22
- }
23
-
24
- #overview>p>a>img {
25
- height: 25px !important;
26
- }
@@ -1,7 +0,0 @@
1
- $(document).ready(function () {
2
- const github_logo = `<a style="text-decoration:none;" class="Header-link" href="https://github.com/unum-cloud/usearch/" data-hotkey="g d" aria-label="Homepage " data-turbo="false" data-analytics-event="{&quot;category&quot;:&quot;Header&quot;,&quot;action&quot;:&quot;go to dashboard&quot;,&quot;label&quot;:&quot;icon:logo&quot;}">
3
- <svg style="fill: var(--color-foreground-primary);" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"></path></svg>
4
- </a>`
5
-
6
- $(".sidebar-brand-text").html("Unum · USearch<br/> <span style='font-size:0.8em'>$(VERSION)</span>" + github_logo)
7
- })
@@ -1,245 +0,0 @@
1
- # Benchmarking USearch
2
-
3
- ## Hyper-parameters
4
-
5
- All major HNSW implementation share an identical list of hyper-parameters:
6
-
7
- - connectivity (often called `M`),
8
- - expansion on additions (often called `efConstruction`),
9
- - expansion on search (often called `ef`).
10
-
11
- The default values vary drastically.
12
-
13
- | Library | Connectivity | EF @ A | EF @ S |
14
- | :-------: | :----------: | :----: | :----: |
15
- | `hnswlib` | 16 | 200 | 10 |
16
- | `FAISS` | 32 | 40 | 16 |
17
- | `USearch` | 16 | 128 | 64 |
18
-
19
- Below are the performance numbers for a benchmark running on the 64 cores of AWS `c7g.metal` "Graviton 3"-based instances.
20
- The main columns are:
21
-
22
- - __Add__: Number of insertion Queries Per Second.
23
- - __Search__: Number search Queries Per Second.
24
- - __Recall @1__: How often does approximate search yield the exact best match?
25
-
26
- ### Different "connectivity"
27
-
28
- | Vectors | Connectivity | EF @ A | EF @ S | __Add__, QPS | __Search__, QPS | __Recall @1__ |
29
- | :--------- | :----------: | :----: | :----: | :----------: | :-------------: | ------------: |
30
- | `f32` x256 | 16 | 128 | 64 | 75'640 | 131'654 | 99.3% |
31
- | `f32` x256 | 12 | 128 | 64 | 81'747 | 149'728 | 99.0% |
32
- | `f32` x256 | 32 | 128 | 64 | 64'368 | 104'050 | 99.4% |
33
-
34
- ### Different "expansion factors"
35
-
36
- | Vectors | Connectivity | EF @ A | EF @ S | __Add__, QPS | __Search__, QPS | __Recall @1__ |
37
- | :--------- | :----------: | :----: | :----: | :----------: | :-------------: | ------------: |
38
- | `f32` x256 | 16 | 128 | 64 | 75'640 | 131'654 | 99.3% |
39
- | `f32` x256 | 16 | 64 | 32 | 128'644 | 228'422 | 97.2% |
40
- | `f32` x256 | 16 | 256 | 128 | 39'981 | 69'065 | 99.2% |
41
-
42
- ### Different vectors "quantization"
43
-
44
- | Vectors | Connectivity | EF @ A | EF @ S | __Add__, QPS | __Search__, QPS | __Recall @1__ |
45
- | :----------- | :----------: | :----: | :----: | :----------: | :-------------: | ------------: |
46
- | `f32` x256 | 16 | 128 | 64 | 87'995 | 171'856 | 99.1% |
47
- | `f16` x256 | 16 | 128 | 64 | 87'270 | 153'788 | 98.4% |
48
- | `f16` x256 ✳️ | 16 | 128 | 64 | 71'454 | 132'673 | 98.4% |
49
- | `i8` x256 | 16 | 128 | 64 | 115'923 | 274'653 | 98.9% |
50
-
51
- As seen on the chart, for `f16` quantization, performance may differ depending on native hardware support for that numeric type.
52
- Also worth noting, 8-bit quantization results in almost no quantization loss and may perform better than `f16`.
53
-
54
- ## Utilities
55
-
56
- Within this repository you will find two commonly used utilities:
57
-
58
- - `cpp/bench.cpp` the produces the `bench` binary for broad USearch benchmarks.
59
- - `python/bench.py` and `python/bench.ipynb` for interactive charts against FAISS.
60
-
61
- To achieve best highest results we suggest compiling locally for the target architecture.
62
-
63
- ```sh
64
- cmake -B ./build_release \
65
- -DCMAKE_BUILD_TYPE=Release \
66
- -DUSEARCH_USE_OPENMP=1 \
67
- -DUSEARCH_USE_JEMALLOC=1 && \
68
- make -C ./build_release -j
69
-
70
- ./build_release/bench --help
71
- ```
72
-
73
- Which would print the following instructions.
74
-
75
- ```txt
76
- SYNOPSIS
77
- ./build_release/bench [--vectors <path>] [--queries <path>] [--neighbors <path>] [-b] [-j
78
- <integer>] [-c <integer>] [--expansion-add <integer>]
79
- [--expansion-search <integer>] [--native|--f16quant|--i8quant]
80
- [--ip|--l2sq|--cos|--haversine] [-h]
81
-
82
- OPTIONS
83
- --vectors <path>
84
- .fbin file path to construct the index
85
-
86
- --queries <path>
87
- .fbin file path to query the index
88
-
89
- --neighbors <path>
90
- .ibin file path with ground truth
91
-
92
- -b, --big Will switch to uint40_t for neighbors lists with over 4B entries
93
- -j, --threads <integer>
94
- Uses all available cores by default
95
-
96
- -c, --connectivity <integer>
97
- Index granularity
98
-
99
- --expansion-add <integer>
100
- Affects indexing depth
101
-
102
- --expansion-search <integer>
103
- Affects search depth
104
-
105
- --native Use raw templates instead of type-punned classes
106
- --f16quant Enable `f16_t` quantization
107
- --i8quant Enable `int8_t` quantization
108
- --ip Choose Inner Product metric
109
- --l2sq Choose L2 Euclidean metric
110
- --cos Choose Angular metric
111
- --haversine Choose Haversine metric
112
- -h, --help Print this help information on this tool and exit
113
- ```
114
-
115
- Here is an example of running the C++ benchmark:
116
-
117
- ```sh
118
- ./build_release/bench \
119
- --vectors datasets/wiki_1M/base.1M.fbin \
120
- --queries datasets/wiki_1M/query.public.100K.fbin \
121
- --neighbors datasets/wiki_1M/groundtruth.public.100K.ibin
122
-
123
- ./build_release/bench \
124
- --vectors datasets/t2i_1B/base.1B.fbin \
125
- --queries datasets/t2i_1B/query.public.100K.fbin \
126
- --neighbors datasets/t2i_1B/groundtruth.public.100K.ibin \
127
- --output datasets/t2i_1B/index.usearch \
128
- --cos
129
- ```
130
-
131
-
132
- > Optional parameters include `connectivity`, `expansion_add`, `expansion_search`.
133
-
134
- For Python, jut open the Jupyter Notebook and start playing around.
135
-
136
- ## Datasets
137
-
138
- BigANN benchmark is a good starting point, if you are searching for large collections of high-dimensional vectors.
139
- Those often come with precomputed ground-truth neighbors, which is handy for recall evaluation.
140
-
141
- | Dataset | Scalar Type | Dimensions | Metric | Size |
142
- | :----------------------------------------- | :---------: | :--------: | :----: | :-------: |
143
- | [Unum UForm Creative Captions][unum-cc-3m] | float32 | 256 | IP | 3 GB |
144
- | [Unum UForm Wiki][unum-wiki-1m] | float32 | 256 | IP | 1 GB |
145
- | [Yandex Text-to-Image Sample][unum-t2i] | float32 | 200 | Cos | 1 GB |
146
- | | | | | |
147
- | [Microsoft SPACEV][spacev] | int8 | 100 | L2 | 93 GB |
148
- | [Microsoft Turing-ANNS][turing] | float32 | 100 | L2 | 373 GB |
149
- | [Yandex Deep1B][deep] | float32 | 96 | L2 | 358 GB |
150
- | [Yandex Text-to-Image][t2i] | float32 | 200 | Cos | 750 GB |
151
- | | | | | |
152
- | [ViT-L/12 LAION][laion] | float32 | 2048 | Cos | 2 - 10 TB |
153
-
154
- Luckily, smaller samples of those datasets are available.
155
-
156
- [unum-cc-3m]: https://huggingface.co/datasets/unum-cloud/ann-cc-3m
157
- [unum-wiki-1m]: https://huggingface.co/datasets/unum-cloud/ann-wiki-1m
158
- [unum-t2i]: https://huggingface.co/datasets/unum-cloud/ann-t2i-1m
159
- [spacev]: https://github.com/microsoft/SPTAG/tree/main/datasets/SPACEV1B
160
- [turing]: https://learning2hash.github.io/publications/microsoftturinganns1B/
161
- [t2i]: https://research.yandex.com/blog/benchmarks-for-billion-scale-similarity-search
162
- [deep]: https://research.yandex.com/blog/benchmarks-for-billion-scale-similarity-search
163
- [laion]: https://laion.ai/blog/laion-5b/#download-the-data
164
-
165
- ### Unum UForm Wiki
166
-
167
- ```sh
168
- mkdir -p datasets/wiki_1M/ && \
169
- wget -nc https://huggingface.co/datasets/unum-cloud/ann-wiki-1m/resolve/main/base.1M.fbin -P datasets/wiki_1M/ &&
170
- wget -nc https://huggingface.co/datasets/unum-cloud/ann-wiki-1m/resolve/main/query.public.100K.fbin -P datasets/wiki_1M/ &&
171
- wget -nc https://huggingface.co/datasets/unum-cloud/ann-wiki-1m/resolve/main/groundtruth.public.100K.ibin -P datasets/wiki_1M/
172
- ```
173
-
174
- ### Yandex Text-to-Image
175
-
176
- ```sh
177
- mkdir -p datasets/t2i_1B/ && \
178
- wget -nc https://storage.yandexcloud.net/yandex-research/ann-datasets/T2I/base.1B.fbin -P datasets/t2i_1B/ &&
179
- wget -nc https://storage.yandexcloud.net/yandex-research/ann-datasets/T2I/base.1M.fbin -P datasets/t2i_1B/ &&
180
- wget -nc https://storage.yandexcloud.net/yandex-research/ann-datasets/T2I/query.public.100K.fbin -P datasets/t2i_1B/ &&
181
- wget -nc https://storage.yandexcloud.net/yandex-research/ann-datasets/T2I/groundtruth.public.100K.ibin -P datasets/t2i_1B/
182
- ```
183
-
184
- ### Yandex Deep1B
185
-
186
- ```sh
187
- mkdir -p datasets/deep_1B/ && \
188
- wget -nc https://storage.yandexcloud.net/yandex-research/ann-datasets/DEEP/base.1B.fbin -P datasets/deep_1B/ &&
189
- wget -nc https://storage.yandexcloud.net/yandex-research/ann-datasets/DEEP/base.10M.fbin -P datasets/deep_1B/ &&
190
- wget -nc https://storage.yandexcloud.net/yandex-research/ann-datasets/DEEP/query.public.10K.fbin -P datasets/deep_1B/ &&
191
- wget -nc https://storage.yandexcloud.net/yandex-research/ann-datasets/DEEP/groundtruth.public.10K.ibin -P datasets/deep_1B/
192
- ```
193
-
194
- ### Arxiv with E5
195
-
196
- ```sh
197
- mkdir -p datasets/arxiv_2M/ && \
198
- wget -nc https://huggingface.co/datasets/unum-cloud/ann-arxiv-2m/resolve/main/abstract.e5-base-v2.fbin -P datasets/arxiv_2M/ &&
199
- wget -nc https://huggingface.co/datasets/unum-cloud/ann-arxiv-2m/resolve/main/title.e5-base-v2.fbin -P datasets/arxiv_2M/
200
- ```
201
-
202
- ## Profiling
203
-
204
- With `perf`:
205
-
206
- ```sh
207
- # Pass environment variables with `-E`, and `-d` for details
208
- sudo -E perf stat -d ./build_release/bench ...
209
- sudo -E perf mem -d ./build_release/bench ...
210
- # Sample on-CPU functions for the specified command, at 1 Kilo Hertz:
211
- sudo -E perf record -F 1000 ./build_release/bench ...
212
- perf record -d -e arm_spe// -- ./build_release/bench ..
213
- ```
214
-
215
- ### Caches
216
-
217
- ```sh
218
- sudo perf stat -e 'faults,dTLB-loads,dTLB-load-misses,cache-misses,cache-references' ./build_release/bench ...
219
- ```
220
-
221
- Typical output on a 1M vectors dataset is:
222
-
223
- ```txt
224
- 255426 faults
225
- 305988813388 dTLB-loads
226
- 8845723783 dTLB-load-misses # 2.89% of all dTLB cache accesses
227
- 20094264206 cache-misses # 6.567 % of all cache refs
228
- 305988812745 cache-references
229
-
230
- 8.285148010 seconds time elapsed
231
-
232
- 500.705967000 seconds user
233
- 1.371118000 seconds sys
234
- ```
235
-
236
- If you notice problems and the stalls are closer to 90%, it might be a good reason to consider enabling Huge Pages and tuning allocations alignment.
237
- To enable Huge Pages:
238
-
239
- ```sh
240
- sudo cat /proc/sys/vm/nr_hugepages
241
- sudo sysctl -w vm.nr_hugepages=2048
242
- sudo reboot
243
- sudo cat /proc/sys/vm/nr_hugepages
244
- ```
245
-
@@ -1,5 +0,0 @@
1
- ========================
2
- Benchmarks
3
- ========================
4
-
5
- .. mdinclude:: benchmarks.md
package/docs/c/index.rst DELETED
@@ -1,11 +0,0 @@
1
- =======
2
- C SDK
3
- =======
4
-
5
-
6
- .. mdinclude:: ../../c/README.md
7
-
8
- .. toctree::
9
- :hidden:
10
-
11
- reference
@@ -1,7 +0,0 @@
1
- API Reference
2
- ===============
3
-
4
- ==================
5
- usearch/usearch.h
6
- ==================
7
- .. doxygenfile:: usearch.h