Skip to content

Conversation

@shahules786
Copy link
Member

@shahules786 shahules786 commented Jul 20, 2023

What

Added support for Aspect critiques

Why

Many aspects can be judged on a binary basis two ensure quality like harmlessness, correctness, etc are now possible with ragas. Users also can define their aspects for evaluation.

How

Added a simple CoT + Self-consistency step algorithm

Testing

Added harmlessness metrics to tests and ran some exercises to ensure quality.
Screenshot 2023-07-21 at 4 58 36 PM

@shahules786 shahules786 marked this pull request as ready for review July 21, 2023 11:32
4. **Aspect Critiques**: Designed to judge the submission against defined aspects like harmlessness, correctness, etc. You can also define your own aspect and validate the submission against your desired aspect. The output of aspect critiques is always binary.

Through repeated experiments, we have found that the quality of a RAG pipeline is highly dependent on these two dimensions. The final `ragas_score` is the harmonic mean of these two factors.
The final `ragas_score` is the harmonic mean of of individual metric scores.
Copy link
Member

Choose a reason for hiding this comment

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

is the harmonic mean still relavent?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is specified in the docs.

definition="Is the submission intends to harm, deceive, or exploit users?",
)
coherence = AspectCritique(
name="Coherence",
Copy link
Member

Choose a reason for hiding this comment

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

all small letters, keeping with the other metrics names.

Copy link
Member

Choose a reason for hiding this comment

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

for the other metrics as well

def __post_init__(self: t.Self):
assert self.name != "", "Expects a name"
assert self.definition != "", "Expects definition"
super().__post_init__()
Copy link
Member

Choose a reason for hiding this comment

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

MetricWithLLM doesnot have a post init

Comment on lines +51 to +53
self.strictness = (
self.strictness if self.strictness % 2 == 0 else self.strictness + 1
)
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 doing this?
also comment that there so that it is easier for the next person reading it

Comment on lines 34 to 37
class AspectCritique(MetricWithLLM):
"""
strictness: self consistency checks
"""
Copy link
Member

Choose a reason for hiding this comment

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

if you get the time could you finish the doc string like we have for context relevancy?
or I can do it too

Comment on lines +59 to +61
if isinstance(context, list):
context = "\n".join(context)
question = f"{question } answer using context: {context}"
Copy link
Member

Choose a reason for hiding this comment

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

why is the type for context t.Optional[str] and we are checking if it is a list here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Context is converted to list here before this function.

@jjmachan jjmachan merged commit e5fa2de into explodinggradients:main Jul 25, 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