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

SASEvaluator returns score even when predicted answer is None #7842

Open
mrm1001 opened this issue Jun 11, 2024 · 2 comments
Open

SASEvaluator returns score even when predicted answer is None #7842

mrm1001 opened this issue Jun 11, 2024 · 2 comments

Comments

@mrm1001
Copy link
Member

mrm1001 commented Jun 11, 2024

In a RAG pipeline, there are cases where the prompt instructs the LLM to return a placeholder answer if there is missing information in the context, such as "No answer". See an example in our evaluation repository.

In that case, it makes sense to replace the predicted answer in the RAG pipeline with None, instead of computing any metric on the placeholder answer. However, the SASEvaluator returns a score even if None is passed.

Example:

from haystack.components.evaluators import SASEvaluator

sas = SASEvaluator(model="sentence-transformers/all-mpnet-base-v2")
sas.warm_up()
sas.run(predicted_answers=[None, "Whatever"], ground_truth_answers=["Whatever", "Another whatever"])

the output is:

{'score': 0.46286168694496155,
 'individual_scores': [0.26153379678726196, 0.6641895771026611]}

Expected

{'score': 0.6641895771026611,
 'individual_scores': [None, 0.6641895771026611]}
@lbux
Copy link

lbux commented Jun 11, 2024

In that case, it makes sense to replace the predicted answer in the RAG pipeline with None

This is something that I'm manually doing in my workflow, but I would like to see a component for. We have DocumentCleaner, so I think it would make sense to have an AnswerCleaner or a GeneratedAnswerCleaner which can take in a "stop word" parameter to scan the answer for a specific word/phrase.

The handling of 'None' might need to be applied to LLMEvaluator as well. I run a forked version and it accepts 'None' as a parameter and returns an answer. I will try running it on the main Haystack code to see what happens.

@lbux
Copy link

lbux commented Jun 11, 2024

image

The same issue needs to be handled in LLMEvaluators.

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

No branches or pull requests

2 participants