The bound says how wide the sketch must be, and the answer does not mention the embedding dimension at all. Cost per token is fixed once the accuracy target is fixed, so a long context does not cost more per key.
Details
Formula: with
m >= (4/3)(1 + eps)/eps^2 log(2/delta),
Pr[|Prod(q,k) - <q,k>| > eps ||q|| ||k||] <= delta.
Examples
V <- c(1, 2, 3, 4, 5, 6, 7, 8)
Tqdist(V, V)
#> $m_min
#> [1] 2 0 0 0 0 0 0 0
#>
#> $m_real
#> [1] 1.8483925 0.0000000 -0.2402756 -0.2888113 -0.2932130 -0.2848254 -0.2727103
#> [8] -0.2599302
#>
#> $estimate
#> [1] 2 0 0 0 0 0 0 0
#>
#> $eps
#> [1] 1 2 3 4 5 6 7 8
#>
#> $delta
#> [1] 1 2 3 4 5 6 7 8
#>
#> $method
#> [1] "QJL inner-product distortion bound"
#>
#> attr(,"class")
#> [1] "morie_rich_result" "list"
