Skip to content

Commit 25e1b55

Browse files
author
Sebastian Sosa
committed
Add deprecation warning
1 parent b467d5b commit 25e1b55

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

attribution/attribution_metrics.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def token_prob_difference(
1717
]
1818
initial_tokens = [content.token for content in initial_logprobs.content]
1919

20-
# Create a list of dictionaries with token and logprob from perturbed_logprobs
20+
# Create a list of dictionaries with token and top logprobs from perturbed_logprobs
2121
perturbed_token_logprobs_list = [
2222
{
2323
top_logprob.token: top_logprob.logprob
@@ -70,11 +70,13 @@ def token_displacement(
7070
return displacement_per_token.mean(), initial_tokens, displacement_per_token
7171

7272

73-
def max_logprob_difference(
73+
# NOTE: this metric does not work. It's left to serve as discussion
74+
def deprecated_max_logprob_difference(
7475
initial_logprobs: openai.types.chat.chat_completion.ChoiceLogprobs,
7576
perturbed_logprobs: openai.types.chat.chat_completion.ChoiceLogprobs,
7677
):
7778
# Get the logprobs of the top 20 tokens for the initial and perturbed outputs
79+
# Warning: this should probably be a list with the top logprobs at each token position instead
7880
initial_top_logprobs = {
7981
logprob.token: logprob.logprob for logprob in initial_logprobs.content
8082
}

0 commit comments

Comments
 (0)