
Prefix-tuning objective (Kamath Eq 3.12)
Source:R/kamath_llm2_native.R
morie_kamath_ch3_prefix_tuning_obj.RdA SUM of log p_phi(z_i | h_<i) over the target index set. Y_idx is
0-BASED, as in Python.
Examples
morie_kamath_ch3_prefix_tuning_obj(function(z, hp) 0.5, "s:",
list("a", "b"), list(0, 1))
#> $estimate
#> [1] -1.386294
#>
#> $per_position
#> [1] -0.6931472 -0.6931472
#>
#> $positions_scored
#> [1] 0 1
#>
#> $prompt
#> [1] "s:"
#>
#> $n
#> [1] 2
#>
#> $method
#> [1] "prefix-tuning objective (Kamath Eq 3.12)"
#>