feat: add reference-free FluencyLLMEval and CoherenceLLMEval descriptors#1834
Open
mostaphaelansari wants to merge 2 commits intoevidentlyai:mainfrom
Open
Conversation
…ors (evidentlyai#1801) Add two new LLM-as-a-judge descriptors that evaluate text quality without requiring a reference dataset: - FluencyLLMEval: detects grammatically broken or unnatural responses (FLUENT / NOT_FLUENT) - CoherenceLLMEval: detects logically inconsistent or disorganised responses (COHERENT / INCOHERENT) Changes: - src/evidently/legacy/descriptors/llm_judges.py: add FluencyLLMEval and CoherenceLLMEval V1 classes with full prompt criteria - src/evidently/descriptors/generated_descriptors.py: add public factory functions for both descriptors - src/evidently/descriptors/__init__.py: export both descriptors - tests/features/test_llm_judge.py: add tests for pipeline execution and public import path Closes evidentlyai#1801
…dings, and FAISS retrieval.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #1801
Adds two new reference-free LLM-as-a-judge descriptors that evaluate text quality without requiring a reference dataset or ground-truth answer.
FluencyLLMEvalFLUENT/NOT_FLUENTCoherenceLLMEvalCOHERENT/INCOHERENTMotivation
Many real-world LLM monitoring setups don't have a golden reference to compare against. This PR fills that gap for two common quality dimensions — language fluency and logical coherence — following the same LLM-judge approach already used for
ToxicityLLMEval,BiasLLMEval,PIILLMEval, andDeclineLLMEval(all of which are reference-free).Changes
src/evidently/legacy/descriptors/llm_judges.pyFluencyLLMEval: binary classification prompt (FLUENT/NOT_FLUENT) that checks grammar, natural phrasing, and readabilityCoherenceLLMEval: binary classification prompt (COHERENT/INCOHERENT) that checks logical organization and consistencysrc/evidently/descriptors/generated_descriptors.pyinclude_score,include_reasoning,uncertainty,alias,tests)src/evidently/descriptors/__init__.pyFluencyLLMEvalandCoherenceLLMEvaltests/features/test_llm_judge.pytest_fluency_llm_eval: runs full pipeline viaMockLLMWrapper(no API key required)test_coherence_llm_eval: runs full pipeline viaMockLLMWrapper(no API key required)test_reference_free_evals_importable: verifies public import path fromevidently.descriptorsTests
All existing tests continue to pass, and 3 new tests were added:
Usage
Both descriptors also support
include_score=True,include_reasoning=True, anduncertaintyoptions.