Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Context Relevancy v2 #59

Merged
merged 10 commits into from
Jul 14, 2023
Merged

Context Relevancy v2 #59

merged 10 commits into from
Jul 14, 2023

Conversation

shahules786
Copy link
Member

@shahules786 shahules786 commented Jul 12, 2023

What

Added support for new context relevancy metrics

Why

The earlier used context_relevancy metric was found to have a poor correlation with actual results.

How

New paradigm leverages candidate sentence extraction with self-consistency checks to ensure far better results even with larger context lengths.

Screenshots

Screenshot 2023-07-13 at 10 47 52 AM

@shahules786 shahules786 self-assigned this Jul 12, 2023
@shahules786 shahules786 requested a review from jjmachan July 13, 2023 05:28
@shahules786 shahules786 marked this pull request as ready for review July 13, 2023 06:49
Comment on lines +101 to +104
questions, contexts = dataset["question"], dataset["contexts"]
for q, c in zip(questions, contexts):
prompt = CONTEXT_RELEVANCE.format(q, "\n".join(c))
prompts.append(prompt)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't this need batching. If there are more than 20 (questions, contexts) pairs openAI will return an error?


return score_ds
return dataset.add_column(f"{self.name}", scores) # type: ignore
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we type ignoring here? just curious

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A warning for not passing the dataset fingerprint argument, The same is done in the Faithfulness class.

model_name: str = "t5-base"
batch_size: int = 15
agreement_metric: str = "bert_score"
strictness: int = 2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does the strictness param do? would be great to have doc string at this point I guess

@shahules786 shahules786 requested a review from jjmachan July 14, 2023 05:55
@shahules786
Copy link
Member Author

@jjmachan Added the required changes.

@jjmachan jjmachan merged commit 2661290 into explodinggradients:main Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants