Grounded
Answer Similarity
Evaluate your LLM models on their ability to generate text that is similar to a given reference answer.
Answer similarity validation refers to the ability to evaluate and validate text output from LLM models based on how similar it is to a given reference answer. This includes using various similarity measures to assess the similarity between the generated text and the reference answer.
Required Parameters
Parameter | Description |
---|---|
expected_response | The expected correct response |
response | The actual response to be evaluated |
Optional Configuration
Parameter | Description |
---|---|
comparator | The method to use for comparison |
failure_threshold | The threshold below which the evaluation fails |
Available Comparators
Comparator | Description |
---|---|
Comparator.COSINE | Measures similarity based on vector angle between text embeddings |
Comparator.LEVENSHTEIN | Calculates edit distance between strings, normalized to [0,1] |
Comparator.JARO_WINKLER | String similarity that favors strings matching from the beginning |
Comparator.JACCARD | Measures overlap between word sets using intersection over union |
Comparator.SORENSEN_DICE | Similar to Jaccard but gives more weight to overlapping terms |