Skip to contents

Bi-encoder dot products with a STABLE top-k; indices are 0-BASED.

Usage

morie_kamath_dense_passage_retrieval(q_embed, p_embeds, k)

Arguments

q_embed

Query embedding.

p_embeds

Passage rows.

k

Depth.

Value

List with estimate, top_k_indices, top_k_scores, scores.

Examples

morie_kamath_dense_passage_retrieval(q_embed = 5L, p_embeds = c(1, 2, 3, 4, 5, 6, 7, 8), k = 5L)
#> $estimate
#> [1] 40
#> 
#> $top_k_indices
#> [1] 7 6 5 4 3
#> 
#> $top_k_scores
#> [1] 40 35 30 25 20
#> 
#> $scores
#> [1]  5 10 15 20 25 30 35 40
#> 
#> $k
#> [1] 5
#> 
#> $n
#> [1] 8
#> 
#> $method
#> [1] "dense passage retrieval top-k (Kamath Ch 7)"
#>