
Flamingo factorized likelihood and dataset mix (Kamath Eq 9.21-9.22)
Source:R/kamath_llm2_native.R
morie_kamath_ch9_flamingo_factorized.RdFlamingo factorized likelihood and dataset mix (Kamath Eq 9.21-9.22)
Usage
morie_kamath_ch9_flamingo_factorized(y, x = NULL, L = NULL, model = NULL)
morie_kamath_ch9_flamingo_dataset_mix(D_m, lambda_m, x = NULL, y = NULL)Details
One per-sequence NLL serves both Python modules exactly as
km150 calls km149: km149 -> morie_kamath_ch9_flamingo_factorized
(product of per-token conditionals, with its log), km150 ->
morie_kamath_ch9_flamingo_dataset_mix (sum_m lambda_m times the mean
per-sequence NLL of dataset m).
Examples
morie_kamath_ch9_flamingo_factorized(c(0.5, 0.25))
#> $estimate
#> [1] 0.125
#>
#> $log_prob
#> [1] -2.079442
#>
#> $nll
#> [1] 2.079442
#>
#> $per_token
#> [1] 0.50 0.25
#>
#> $n
#> [1] 2
#>
#> $method
#> [1] "Flamingo factorized text likelihood (Kamath Eq 9.21)"
#>