A third-order optimization method for improving the relevance of RAG answers
Ragas'Answer Relevancy Assessment (ARA)Indicators provide quantitative tools for optimization:
- Evaluation Principles:Cosine similarity is computed by generating the problem in reverse and comparing the semantic similarity with the original problem using text-embedding-ada-002
- Operational Steps:
- Prepare the test dataset (question-answer pairs)
- Calling the answer_relevancy module in ragas.metrics
- Analysis 0.8+ is excellent, 0.6-0.8 needs to be optimized, below 0.6 needs to be refactored
- Optimization Strategies:
- Enhanced problem rephrasing (paraphrase) training data
- Adjust the temperature parameter of the generated model
- Add Relevance Enhancement Prompt Template
The article case shows an answer_relevancy score of 0.835 for meal analysis, which is a good level and can be further improved by adding synonym mapping for specialized terms.
This answer comes from the articleRagas: assessing RAG recall QA accuracy and answer correlationThe































