## 3 Materials and Methods
**Recall**, also termed sensitivity, quantifies the capability of AVI to correctly identify all actual positive instances within the data:  
\[\frac{TP}{(TP+FN)}. \tag{4}\]  
Recall, defined in Equation (4), is particularly significant for AVI's safety-critical tasks, such as PII leakage or toxic output detection. A high recall value indicates the system's effectiveness in identifying the majority of targeted undesirable items, thereby minimizing the risk of missed threats or unmitigated harmful content. (TP and FN are defined under Equation (2)). The **F1-score** serves as a consolidated metric that harmonizes Precision and Recall, proving particularly valuable in scenarios where an equitable balance between minimizing false positives and false negatives is critical:  
\[\frac{2(Precision*Recall)}{(Precision+Recall)}. \tag{5}\]  
Equation (5) presents the F1-score. This metric is often preferred for evaluating AVI's classification modules, especially when dealing with imbalanced class distributions (common in safety applications) as it simultaneously considers both Precision and Recall. A high F1-score reflects a robust classifier capable of maintaining a good balance between avoiding false alarms and detecting relevant instances. **Specificity** is employed to assess the proficiency of AVI in correctly identifying actual negative instances, such as legitimate or safe content:  
\[\frac{TN}{(TN+FP)}. \tag{6}\]  
Specificity, calculated as per Equation (6), is important for AVI as it measures the system's ability to correctly permit non-problematic content. High specificity ensures that legitimate user interactions are not unduly impeded by the filtering mechanisms,complementing Recall by demonstrating accurate handling of the negative (i.e., safe) class. (TN and FP are defined under Equation (2)). In addition to these metrics, Receiver Operating Characteristic (ROC) curves and the Area Under the Curve (AUC) may also be employed for a more comprehensive evaluation of the trade-offs between true positive rate (Recall) and false positive rate across different classification thresholds, particularly for the binary classification tasks performed by AVI's modules. For the evaluation of the **Response Assessment Module's** (RAM) efficacy in detecting factual inaccuracies or nonsensical statements in LLM-generated outputs, the **Hallucination Detection Accuracy** metric is utilized. This metric focuses specifically on the correct identification of such undesirable generations:  
Figure 1:0  
As defined in Equation (7), this metric computes the ratio of hallucinated statements correctly identified by RAM (Correctly_Identified_Hallucinations) to the total count of actual hallucinations present within the evaluated set of LLM responses (Total_Actual_Hallucinations). This value effectively represents the recall score for the \"hallucination\" class, quantifying the proportion of extant hallucinations successfully detected by the AVI system. Further **Response Assessment Quality Metrics** are employed, particularly when the Contextualization Engine (CE/RAG) is active. These include (1) **Faithfulness Metrics**: to evaluate the degree to which the LLM's response adheres to the provided RAG context, potentially utilizing Natural Language Inference (NLI) models to assess entailment or contradiction [43]. High faithfulness ensures that the LLM leverages the retrieved context accurately and does not generate statements unsupported by or conflicting with it. (2) **RAG Quality Metrics**: to assess the performance of the RAG module itself, metrics such as **Context Relevance**, often measured by the average semantic similarity (e.g., using SBERT [44]) between the user query and the retrieved documents, indicating whether the CE fetched pertinent information; **Context Recall**, the proportion of all truly relevant documents from the knowledge base that were successfully retrieved by the CE for a given query.