diff --git a/content/develop/data-types/vector-sets/memory.md b/content/develop/data-types/vector-sets/memory.md index af56e9d44b..1008c08379 100644 --- a/content/develop/data-types/vector-sets/memory.md +++ b/content/develop/data-types/vector-sets/memory.md @@ -64,11 +64,19 @@ High-dimensional vectors increase storage: - 300 components at `FP32` = 1200 bytes/vector - 300 components at `Q8` = 300 bytes/vector -You can reduce this using the `REDUCE` option during [`VADD`]({{< relref "/commands/vadd" >}}), which applies random projection. - -```bash -VADD vset REDUCE 100 VALUES 300 ... item1 -``` +You can reduce this using the `REDUCE` option during [`VADD`]({{< relref "/commands/vadd" >}}), which applies [random projection](https://en.wikipedia.org/wiki/Random_projection): + +{{< clients-example vecset_tutorial add_reduce >}} +>VADD setNotReduced VALUES 300 ... element +(integer) 1 +> VDIM setNotReduced +(integer) 300 + +>VADD setReduced REDUCE 100 VALUES 300 ... element +(integer) 1 +> VDIM setReduced +(integer) 100 +{{< /clients-example >}} This projects a 300-dimensional vector into 100 dimensions, reducing size and improving speed at the cost of some recall. diff --git a/content/develop/data-types/vector-sets/performance.md b/content/develop/data-types/vector-sets/performance.md index 9b0f07ea17..46566d9745 100644 --- a/content/develop/data-types/vector-sets/performance.md +++ b/content/develop/data-types/vector-sets/performance.md @@ -41,6 +41,29 @@ Quantization greatly impacts both speed and memory: - `NOQUANT` (`FP32`): Full precision, slower performance, highest memory use Use the quantization mode that best fits your tradeoff between precision and efficiency. +The examples below show how the different modes affect a simple vector. +Note that even with `NOQUANT` mode, the values change slightly, +due to floating point rounding. + +{{< clients-example vecset_tutorial add_quant >}} +> VADD quantSetQ8 VALUES 2 1.262185 1.958231 quantElement Q8 +(integer) 1 +> VEMB quantSetQ8 quantElement +1) "1.2643694877624512" +2) "1.958230972290039" + +> VADD quantSetNoQ VALUES 2 1.262185 1.958231 quantElement NOQUANT +(integer) 1 +> VEMB quantSetNoQ quantElement +1) "1.262184977531433" +2) "1.958230972290039" + +> VADD quantSetBin VALUES 2 1.262185 1.958231 quantElement BIN +(integer) 1 +> VEMB quantSetBin quantElement +1) "1" +2) "1" +{{< /clients-example >}} ## Deletion performance