
Zero-shot learning: LLM generalizes to unseen tasks from prompt only
Source:R/geron_w4d_native.R
morie_geron_zero_shot.RdScores labels under model(prompt, labels) or model(prompt) with no weight updates; softmax-normalises. If null_prompt given, subtracts the null-prompt scores before normalising (contextual calibration).
Value
list with probabilities, scores, raw_scores, labels, predicted (0-based), predicted_label, margin, entropy, calibrated, estimate, n, method.
Examples
scores <- c(negative = 0, positive = 1)
morie_geron_zero_shot(function(p) scores, "Review: it was great. Sentiment:")
#> $probabilities
#> [1] 0.2689414 0.7310586
#>
#> $scores
#> [1] 0 1
#>
#> $raw_scores
#> [1] 0 1
#>
#> $labels
#> [1] "negative" "positive"
#>
#> $predicted
#> [1] 1
#>
#> $predicted_label
#> [1] "positive"
#>
#> $margin
#> [1] 0.4621172
#>
#> $entropy
#> [1] 0.5822031
#>
#> $calibrated
#> [1] FALSE
#>
#> $estimate
#> [1] 0.7310586
#>
#> $n
#> [1] 2
#>
#> $method
#> [1] "Zero-shot label scoring with softmax normalisation"
#>