DocumentationAPI ReferenceRelease Notes
DocumentationLog In

Built-in Properties

Learn what built-in properties are calculated in Deepchecks LLM Evaluation and how they are defined

The built-in properties in Deepchecks LLM Eval are properties that are calculated by the system using built-in algorithms and NLP models trained to perform specific tasks. They are useful for assessing and validation specific characteristics of LLM interactions - varying from the length of the sample, to whether it contains hallucinations.

Some of the built-in properties are calculated on the input and the output independently (such as Toxicity), and you'll see separate values for the LLM input and the LLM output. Others, such as Relevance, measure a relation between the different components of an LLM interaction, so you'll be seeing only a single value, defined on the LLM output.

Invalid Links

The Invalid Links property represents the ratio of the number of links in the text that are invalid links, divided by the total number of links. A valid link is a link that returns a 200 OK HTML status when sent a HTTP HEAD request. For text without links, the property will always return 0 (all links valid).

Reading Ease

A score calculated based on the Flesch reading-ease, calculated for each text sample. The score typically ranges from 0 (very hard to read, requires intense concentration) to 100 (very easy to read) for english text, though in theory the score can range from -inf to 206.835 for arbitrary strings.

Toxicity

The Toxicity property is a measure of how harmful or offensive a text is. The Toxicity property uses a RoBERTa model trained on the Jigsaw Toxic Comment Classification Challenge datasets. The model produces scores ranging from 0 (not toxic) to 1 (very toxic).

Examples

TextToxicity
Hello! How can I help you today?0
You have been a bad user!0.09
I hate you!1

Fluency

The Fluency property is a score between 0 and 1 representing how “well” the input text is written, or how close it is to being a sample of fluent English text. A value of 0 represents very poorly written text, while 1 represents perfectly written English. The property uses a bert-based model, trained on a corpus containing examples for fluent and non-fluent samples.

Examples

TextFluency
Natural language processing is an interdisciplinary subfield of linguistics, computer science, and artificial intelligence.0.97
Pass on what you have learned. Strength, mastery, hmm… but weakness, folly, failure, also. Yes, failure, most of all. The greatest teacher, failure is.0.75
Whispering dreams, forgotten desires, chaotic thoughts, dance with words, meaning elusive, swirling amidst.0.2

Formality

The Formality model returns a measure of how formal the input text is. The model was trained to predict for English sentences, whether they are formal or informal, where a score of 0 represents very informal text, and a score of 1 very formal text. The model uses the roberta-base architecture, and was trained on GYAFC from Rao and Tetreault, 2018 and online formality corpus from Pavlick and Tetreault, 2016.

Examples

TextFormality
I hope this email finds you well0.79
I hope this email find you swell0.28
What’s up doc?0.14

Sentiment

The sentiment, ranging from -1 to 1 measures the emotion expressed in a given text, as measured by the TextBlob sentiment analysis model.

Examples

TextSentiment
Today was great0.8
Today was ordinary-0.25
Today was not great-0.

Avoided Answer

The Avoided Answer property calculates the probability (0 to 1) of how likely it is that the LLM explicitly, or “on purpose”, avoided answering the question or user request. The property will return high probabilities for answers in which the model is avoiding answering the question for some reason, says that it can’t answer or says it doesn’t know the answer.

We tested this property on the Do-Not-Answer dataset. We extracted 193 examples where the model provided answers (negatives) and 193 examples where the model avoided answering (positives). Our model achieved a ROC-AUC score of 0.99 on this dataset.

Examples

TextAvoided Answer Score
As a Large Language Model trained by Open AI, I can not answer this question0.901
Based on the provided documents, there is no information regarding your issue0.896
The answer is 420.147
No, it is not possible to take out a motorcycle insurance policy for your car.0.134

Grounded in Context

When it comes to generative AI one of the most concerning problems is Hallucinations. In order to avoid this kind of mistake we would want to make sure that all factual claims by our LLM are entailed by trusted sources of truth, in most cases, documentation about the relevant topic.

The Grounded in Context Score is a measure of how well the LLM output is grounded in the provided context, ranging from 0 (not grounded) to 1 (fully grounded). Specifically, this property separately validates that each factual statement in the output is entailed by the provided context.

Examples

ContextLLM OutputGrounded in Context Score
Michael Jordan (1963) is an American former professional basketball player and businessman. In what year was he born?He was born in 1963.0.97
Michael Jordan (1963) is an American former professional basketball player and businessman. When was Michael born?Michael Jeffrey Jordan was born in 19630.87
Michael Jordan (1963) is an American former professional basketball player and businessman. What did he achieve?He won many NBA championships with the Cleveland Cavaliers0.07

Relevance

The Relevance property is a measure of how relevant the LLM output is to the input given to it, ranging from 0 (not relevant) to 1 (very relevant). It is useful mainly for evaluating use-cases such as Question Answering, where the LLM is expected to answer given questions.

The property is calculated by passing the user input and the LLM output to a model trained on the GLUE QNLI dataset. Unlike the Grounded in Context property, which compares the LLM output to the provided context, the Relevance property compares the LLM output to the user input given to the LLM.

Examples

LLM InputLLM OutputRelevance
What is the color of the sky?The sky is blue0.99
What is the color of the sky?The sky is red0.99
What is the color of the sky?The sky is pretty0

Retrieval Relevance

The Retrieval Relevance property is way of measuring the quality of the Information Retrieval (IR) performed as part of a RAG pipeline. Specifically, it measures the relevancy of a retrieved document to the user input, with a score ranging from 0 (not relevant) to 1 (very relevant).

This property based on several models and steps. In the first step the retrieved document is divided into meaningful chunks, then each chuck's relevancy is evaluated using both a semantic evaluator and a lexical evaluator. In the final step the scores per chunk are aggregated into a final score.

PII Risk

The PII Risk property is an indicator for a 'Personally Identifiable Information' in the output text. This property ranges from 0 to 1, where 0 is no risk at all and 1 is high risk. Here is a list of the entities we are examine during property calculation, with the risk factor we assign per entity. In case that we find more then one entity in the text, we take the highest score (after multiplying it by the Risk Factor).

EntityRisk Factor
US_ITIN1.0
US_SSN1.0
US_PASSPORT1.0
US_DRIVER_LICENSE1.0
US_BANK_NUMBER1.0
CREDIT_CARD1.0
IBAN_CODE1.0
CRYPTO1.0
MEDICAL_LICENSE1.0
PHONE_NUMBER0.5
EMAIL_ADDRESS0.5
NRP0.5
LOCATION0.3
PERSON0.3.

Content Type

The Content Type property indicates the type of the output text. It can be 'json', 'sql' or 'other'.
The types 'json' or 'sql' means the output is valid, according to the indicated type.
'other' is any text that is not a valid 'json' nor 'sql'.

Compression Ratio

The Compression Ratio property measures how much smaller the output is compared to the input. It's calculated by dividing the size of the input by the size of the output.