ragas icon indicating copy to clipboard operation
ragas copied to clipboard

Answer Semantic Similarity gives output not in range 0-1

Open AnnamariaGalante opened this issue 1 year ago • 6 comments

Describe the bug The output of the AnswerSimilarity metric should be in range 0-1, but gives also negative output, and not in range 0-1. This affects also answer correctness metric. If i do not put the param "threshold" to None, the output results binary True/False. Ragas version: 0.0.22 Python version:3.10.6

Code to Reproduce answer_similarity=AnswerSimilarity(llm=ragas_bedrock_model,embeddings= bedrock_embeddings, threshold=None) answer_similarity.score(ds) output: 35.83004634

Expected behavior The score should be between 0 and 1, not specifiyng thresholds values.

AnnamariaGalante avatar Jan 18 '24 12:01 AnnamariaGalante

Are your embeddings normalized? This might be one reason

almajo avatar Jan 18 '24 13:01 almajo

I'm passing to the api the embedding model, not embeddings theirself, so the library should do this.

AnnamariaGalante avatar Jan 18 '24 13:01 AnnamariaGalante

Hi @AnnamariaGalante , thanks for reporting this issue. Does this occur in every sample or is it once in a while issue?

shahules786 avatar Jan 20 '24 03:01 shahules786

Hi @shahules786, It occurs in every sample, using bedrock embeddings. I think this affects answer correctness too.

AnnamariaGalante avatar Jan 20 '24 09:01 AnnamariaGalante

that's interesting, Would you like to help us find out the issue here with bedrock? I think this is due to the embedding not being normalised @AnnamariaGalante

shahules786 avatar Jan 20 '24 19:01 shahules786

@shahules786 how can i help you to fix this issue?

AnnamariaGalante avatar Jan 24 '24 15:01 AnnamariaGalante