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 Precision Calculation #1905

Open
ishachinniah-hds opened this issue Feb 5, 2025 · 2 comments
Open

Context Precision Calculation #1905

ishachinniah-hds opened this issue Feb 5, 2025 · 2 comments
Labels
module-metrics this is part of metrics module question Further information is requested

Comments

@ishachinniah-hds
Copy link

[✓ ] I checked the documentation and related resources and couldn't find an answer to my question.

Your Question
I wanted to get some clarification on how Context Precision is calculated - I thought it compares the retrieved context chunks to the user input to determine the precision / relevance of the retrieved context. However, the documentation suggests that the context chunks are compared to the response generated by the llm - so is it calculating whether the retrieved context is used by the llm in generating a response?

Documentation
LLM Based Context Precision
The following metrics uses LLM to identify if a retrieved context is relevant or not.
Context Precision without reference
LLMContextPrecisionWithoutReference metric can be used when you have both retrieved contexts and also reference contexts associated with a user_input. To estimate if a retrieved contexts is relevant or not this method uses the LLM to compare each of the retrieved context or chunk present in retrieved_contexts with response.

Follow-up
Is there a metric that checks to see the relevance of the retrieved context based on the user input?

@ishachinniah-hds ishachinniah-hds added the question Further information is requested label Feb 5, 2025
@sahusiddharth
Copy link
Collaborator

Hi @ishachinniah-hds,

I wanted to get some clarification on how Context Precision is calculated - I thought it compares the retrieved context chunks to the user input to determine the precision / relevance of the retrieved context. However, the documentation suggests that the context chunks are compared to the response generated by the LLM - so is it calculating whether the retrieved context is used by the LLM in generating a response?

Yes, you are absolutely right. The Context Precision metric compares the retrieved context chunks with the response generated by the LLM to check if they were useful in forming the response.

Is there a metric that checks to see the relevance of the retrieved context based on the user input?

If you're looking to check the relevance of the retrieved context based on the user input, you can create a custom metric. For a binary metric, you could use Aspect Critic (Simple Criteria Scoring). If you're looking for something more detailed, you can consider using RubricsScore (Rubric-based Metrics).

Let me know how it works for you.

@sahusiddharth sahusiddharth added the module-metrics this is part of metrics module label Feb 6, 2025
@ishachinniah-hds
Copy link
Author

Hi @sahusiddhart,

Thank you for the clarification. I will consider creating a custom metric for use if necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module-metrics this is part of metrics module question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants