Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/lighteval/metrics/normalizations.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,21 @@ def _inner_normalizer(text: str) -> str:
class LogProbPMINorm:
"""Performs Pointwise mutual information normalization. log_likelihood_conditioned - log_likelihood_unconditioned.
Useful when answer contains generally unlikely tokens.

This normalization requires the task's `prompt_function` to set `Doc.unconditioned_query` to a
version of the prompt that contains no task-specific context (e.g. an empty string, or just
`"Answer:"`), so that the unconditioned log-likelihood of each choice can be computed:

```python
Doc(
query=f"Question: {question}\\nAnswer:",
choices=choices,
gold_index=gold_index,
unconditioned_query="Answer:",
)
```

If `Doc.unconditioned_query` is not set, this normalization cannot be applied.
"""

name: str = "norm_pmi"
Expand Down