Skip to contents

L_txt-gen(LLM(P_X, F_T), t), minimised over the prompt candidates. argmin is 0-BASED.

Usage

morie_kamath_ch9_input_alignment_loss(P_X, F_T, t, llm = NULL, loss_fn = NULL)

Arguments

P_X

Prompt features: a matrix, or a list of candidate matrices.

F_T

Text features.

t

Target.

llm

Model function.

loss_fn

Loss function.

Value

List with estimate, argmin, losses.

Examples

morie_kamath_ch9_input_alignment_loss(list(matrix(c(1, 2), 1),
    matrix(0, 1, 2)), "ft", "t", llm = function(p, f) sum(p),
    loss_fn = function(pr, t) abs(pr - 1))
#> $estimate
#> [1] 1
#> 
#> $argmin
#> [1] 1
#> 
#> $losses
#> [1] 2 1
#> 
#> $n_candidates
#> [1] 2
#> 
#> $n
#> [1] 2
#> 
#> $method
#> [1] "input-alignment text-generation objective (Kamath Eq 9.2)"
#>