
Autoregressive response losses (Kamath Eq 9.14, 9.17)
Source:R/kamath_llm2_native.R
morie_kamath_ch9_mmllm_autoregressive.RdAutoregressive response losses (Kamath Eq 9.14, 9.17)
Details
One per-sequence NLL serves both Python modules exactly as
km142 calls km145: km145 -> morie_kamath_ch9_mmllm_autoregressive
(-sum log p over one response), km142 -> morie_kamath_ch9_itg_loss
(that sum over the (X, Y) corpus).
Examples
morie_kamath_ch9_mmllm_autoregressive(c(0.5, 0.25), NULL)
#> $estimate
#> [1] 2.079442
#>
#> $mean_nll
#> [1] 1.039721
#>
#> $per_token
#> [1] 0.6931472 1.3862944
#>
#> $sequence_probability
#> [1] 0.125
#>
#> $n
#> [1] 2
#>
#> $method
#> [1] "MMLLM autoregressive response loss (Kamath Eq 9.17)"
#>