Skip to contents

Pick the highest reward-model score among N samples. best_index is 0-BASED.

Usage

morie_kamath_best_of_n_sampling(
  samples,
  rewards = NULL,
  reward_fn = NULL,
  x = NULL
)

Arguments

samples

Candidate responses.

rewards

Optional scores.

reward_fn

Optional function (x, y).

x

Prompt.

Value

List with estimate, best, best_index, reward_spread.

Examples

morie_kamath_best_of_n_sampling(list("a", "b", "c"), rewards = c(0.1,
    0.9, 0.4))
#> $estimate
#> [1] 0.9
#> 
#> $best
#> [1] "b"
#> 
#> $best_index
#> [1] 1
#> 
#> $rewards
#> [1] 0.1 0.9 0.4
#> 
#> $reward_spread
#> [1] 0.8
#> 
#> $n
#> [1] 3
#> 
#> $method
#> [1] "best-of-N sampling (Kamath Ch 5)"
#>