<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by mattiadeleo33 on Medium]]></title>
        <description><![CDATA[Stories by mattiadeleo33 on Medium]]></description>
        <link>https://medium.com/@mattiadeleo33?source=rss-5b3d7b22249a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*24qrrLtSEUaVNwVJiG70XA.jpeg</url>
            <title>Stories by mattiadeleo33 on Medium</title>
            <link>https://medium.com/@mattiadeleo33?source=rss-5b3d7b22249a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 16:02:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mattiadeleo33/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[LLM Evaluator: what AI Scientist must know]]></title>
            <link>https://medium.com/@mattiadeleo33/llm-evaluator-what-ai-scientist-must-know-ca774d381ffe?source=rss-5b3d7b22249a------2</link>
            <guid isPermaLink="false">https://medium.com/p/ca774d381ffe</guid>
            <category><![CDATA[llm-evaluation]]></category>
            <category><![CDATA[llm-agent]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[llmops]]></category>
            <category><![CDATA[agents]]></category>
            <dc:creator><![CDATA[mattiadeleo33]]></dc:creator>
            <pubDate>Fri, 14 Feb 2025 10:40:34 GMT</pubDate>
            <atom:updated>2025-02-14T10:40:34.660Z</atom:updated>
            <content:encoded><![CDATA[<p>Co-writer <a href="https://medium.com/u/a3128294da31">Alice Savino</a></p><h3>Introduction</h3><p>As AI technology evolves, our company is implementing <strong>**AI assistants**</strong> across our systems. These assistants are end-to-end solutions powered by Large Language Models (LLMs), capable of transforming user inputs into contextual, meaningful responses. Whether through single or multiple LLM interactions, custom actions, or data processing, each assistant is designed with a specific purpose — from streamlining customer support to enhancing data analysis. Yet, with the increasing complexity and capabilities of these AI assistants comes a fundamental question: how can we effectively measure their performance and ensure they truly deliver value to our users?</p><p>Evaluating these assistants presents unique challenges compared to traditional machine learning systems. While classical ML models can be assessed through well-defined quantitative metrics like <strong>accuracy</strong> or <strong>F1-score</strong>, evaluating an AI assistant requires a more complex approach that considers qualitative aspects such as <strong>relevance</strong> of responses, <strong>correctness</strong> of content, and <strong>coherence</strong> of user interaction. Although these assistants are powered by <strong>Large Language Models (LLMs)</strong>, their evaluation goes beyond the metrics used to test language models in isolation, as it must consider the assistant’s overall effectiveness in interacting with users..</p><h4>The Challenge of LLM Evaluation</h4><p>Imagine asking an LLM the following question:</p><p><strong>Q:</strong> <em>Who won the FIFA World Cup in 2014?</em></p><p>A correct response would be:</p><p>✅ <strong>A:</strong> <em>Germany won the FIFA World Cup in 2014 by defeating Argentina 1–0 in the final.</em></p><p>However, an LLM might generate a response that sounds plausible but is incorrect:</p><p>❌ <strong>A:</strong> <em>Brazil won the FIFA World Cup in 2014 after a thrilling final against Argentina.</em></p><p>At first glance, this response appears reasonable — it mentions a real event and teams that were present in the tournament. However, upon closer inspection, we can see that it contains factual inaccuracies. This is what makes <strong>LLM evaluation particularly complex</strong>: responses are not strictly binary (right or wrong), and traditional NLP (Natural Language Processing) methods fail to capture subtle errors or misleading information.</p><h4>What This Article Covers</h4><p>To address these challenges, we need to define structured ways to evaluate LLMs-powered assistants. In this article, we will explore:</p><ol><li><strong>Traditional ML Metrics for Evaluation</strong> — Why accuracy and precision are insufficient for LLMs.</li><li><strong>Key LLM-Specific Metrics</strong> — How we measure <strong>relevance, correctness, ROUGE scores, and toxicity</strong>.</li><li><strong>Standardizing Scores for Decision-Making</strong> — Creating a <strong>traffic light system</strong> to assess model performance.</li><li><strong>Application — Automation in Evaluation</strong> — How we integrated this process into a <strong>CI/CD pipeline</strong> for real-time monitoring.</li></ol><p>By the end of this article, you will have a structured approach to assess LLM performance, ensuring that your AI assistants generate high-quality and reliable responses. We will show how to integrate the llm evaluator inside your workflow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lFSc5XPIjRkoWxSEX6CmVQ.png" /><figcaption>LLM evaluator integration</figcaption></figure><h3><strong>Traditional ML Metrics for Evaluation</strong></h3><p>When we are going to develop a ML model, we define a different type of metric able to show us how much a model is “<em>correct</em>”; but what does it mean?<br>In general the classic metric used to answer to this question are Accuracy, Precision, Recall and F1 Score.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/926/1*But5wsDn_IdAhHEIKCT1sg.png" /></figure><p><strong>Accuracy</strong></p><p>Accuracy is the most common metric to be used in everyday talk. Accuracy answers the question <strong>“Out of all the predictions we made, how many were true?”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*x7uC-hBJ3C8LUg2r.png" /></figure><p>As we will see later, accuracy is a blunt measure and can sometimes be misleading.</p><p><strong>Precision</strong></p><p>Precision is a metric that gives you the proportion of true positives to the amount of total positives that the model predicts. It answers the question <strong>“Out of all the positive predictions we made, how many were true?”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/0*oQeDj0b9rfkuMSkY.png" /></figure><p><strong>Recall</strong></p><p>Recall focuses on how good the model is at finding all the positives. Recall is also called true positive rate and answers the question “<strong>Out of all the data points that should be predicted as true, how many did we correctly predict as true?</strong>”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/582/0*9ccZup1Oog4LTpiI.png" /></figure><p>As you can see from the definitions of precision and recall they are tightly connected.</p><p><strong>F1 Score</strong></p><p>F1 Score is a measure that combines recall and precision. As we have seen there is a trade-off between precision and recall, F1 can therefore be used to measure how effectively our models make that trade-off.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/290/0*tbeFUT6MaGe53WXr.png" /></figure><p>One important feature of the F1 score is that the result is zero if any of the components (precision or recall) fall to zero. Thereby it penalizes extreme negative values of either component.</p><p>But what happens using LLM model?</p><h3><strong>Key LLM-Specific Metrics</strong></h3><p>With LLM model, it is more difficult to understand if an answer is “<em>correct</em>”, since even having the correct answer we cannot do an exact match check because we have to deal with the verbosity, the semantic meaning and the shades of an answer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/903/1*P5-IxjEhxcz0sKtNG3gVxw.png" /><figcaption>a nice rappresentationc from DeepEval</figcaption></figure><p>at this <a href="https://www.confident-ai.com/blog/llm-evaluation-metrics-everything-you-need-for-llm-evaluation#:~:text=LLM%20evaluation%20metrics%20such%20as,just%20be%20the%20LLM%20itself.">link</a> it is possible to find the list of each metric with their definition.</p><p>Here we list the principal we use:</p><h4>1. Relevancy</h4><p><strong>Definition:</strong><br>Relevance measures how well an answer aligns with the question or the overall context of the conversation. A highly relevant answer directly addresses the user’s query without unnecessary information or deviations.<br><strong>How It Works:</strong></p><ul><li>The model evaluates whether the generated answer contains key elements that match the intent of the question.</li><li>Embedding-based similarity (e.g., <strong>Cosine Similarity, BERTScore</strong>) can be used to compare the meaning of the answer with the input query.</li><li>Human evaluation or LLM-based scoring can be leveraged to refine relevance assessments.</li></ul><p><strong>Examples:</strong><br>✅ <em>Good relevance:</em></p><ul><li><strong>Q:</strong> <em>What is the capital of France?</em></li><li><strong>A:</strong> <em>The capital of France is Paris.</em></li></ul><p>❌ <em>Low relevance:</em></p><ul><li><strong>Q:</strong> <em>What is the capital of France?</em></li><li><strong>A:</strong> <em>France is a European country with a rich history.</em> (Does not directly answer the question)</li></ul><p>❌ <em>Irrelevant response:</em></p><ul><li><strong>Q:</strong> <em>What is the capital of France?</em></li><li><strong>A:</strong> <em>The tallest mountain in the world is Mount Everest.</em> (Completely unrelated)</li></ul><h4>2. Correctness</h4><p><strong>Definition:</strong><br>Correctness evaluates whether the generated answer is factually accurate when compared to a known ground truth. This metric ensures that the response does not contain incorrect or misleading information.</p><p><strong>How It Works:</strong></p><ul><li>The model extracts key facts from the answer and verifies them against a <strong>ground truth dataset</strong> or an <strong>external knowledge base</strong>.</li><li><strong>Fact-checking models</strong> (e.g., FactScore, TruthfulQA) can help validate the information.</li><li>LLM-based verification can cross-check statements with authoritative sources.</li></ul><p><strong>Examples:</strong><br>✅ <em>Correct response:</em></p><ul><li><strong>Q:</strong> <em>Who wrote “Pride and Prejudice”?</em></li><li><strong>A:</strong> <em>“Pride and Prejudice” was written by Jane Austen.</em></li></ul><p>❌ <em>Incorrect response:</em></p><ul><li><strong>Q:</strong> <em>Who wrote “Pride and Prejudice”?</em></li><li><strong>A:</strong> <em>“Pride and Prejudice” was written by Charles Dickens.</em> (Factually incorrect)</li></ul><p>❌ <em>Hallucinated answer:</em></p><ul><li><strong>Q:</strong> <em>When was the Eiffel Tower built?</em></li><li><strong>A:</strong> <em>The Eiffel Tower was built in 1925.</em> (Incorrect fact, as the correct answer is 1887–1889)</li></ul><h4>3.ROUGE (Recall-Oriented Understudy for Gisting Evaluation)</h4><p><strong>Definition:</strong><br>ROUGE is a set of metrics used to evaluate how much a generated response overlaps with a reference response. It is commonly used in text summarization and NLP evaluation.</p><p><strong>How It Works:</strong></p><ul><li><strong>ROUGE-N</strong>: Measures the overlap of <strong>n-grams</strong> (word sequences) between the generated answer and the reference text.</li><li><strong>ROUGE-L</strong>: Uses <strong>Longest Common Subsequence (LCS)</strong> to capture the longest matching word sequence.</li><li><strong>ROUGE-W</strong>: Assigns different weights to word sequences based on their importance.</li></ul><p><strong>Examples:</strong><br>✅ <em>High ROUGE score (good match with reference response)</em></p><ul><li><strong>Reference answer:</strong> <em>The Eiffel Tower was built between 1887 and 1889 in Paris, France.</em></li><li><strong>Generated answer:</strong> <em>The Eiffel Tower was constructed from 1887 to 1889 in France.</em></li></ul><p>❌ <em>Low ROUGE score (poor match with reference response)</em></p><ul><li><strong>Reference answer:</strong> <em>The Eiffel Tower was built between 1887 and 1889 in Paris, France.</em></li><li><strong>Generated answer:</strong> <em>It is a very tall tower in Europe, and many tourists visit it.</em> (Does not contain key details)</li></ul><p><strong>Use Case:</strong><br>ROUGE is widely used in text summarization models but can also help assess how much a generated response captures key information from a ground truth reference.</p><h4>4. Toxicity</h4><p><strong>Definition:</strong><br>Toxicity measures the presence of inappropriate, offensive, discriminatory, or violent language in a generated response. This metric is essential to ensuring user safety and maintaining ethical AI interactions.</p><p><strong>How It Works:</strong></p><ul><li><strong>Toxicity detection models</strong> (e.g., <strong>Perspective API, Hate Speech Detection Models</strong>) analyze the language used in the response.</li><li>LLM-based filtering can assess the likelihood of harmful content.</li><li>Keyword-based moderation can flag explicit or offensive terms.</li></ul><p><strong>Examples:</strong><br>✅ <em>Non-toxic response:</em></p><ul><li><strong>Q:</strong> <em>What are some leadership qualities?</em></li><li><strong>A:</strong> <em>Good leadership qualities include communication skills, empathy, and decision-making abilities.</em></li></ul><p>❌ <em>Toxic response:</em></p><ul><li><strong>Q:</strong> <em>What are some leadership qualities?</em></li><li><strong>A:</strong> <em>Some people are just naturally superior, and weak individuals shouldn’t lead.</em> (Discriminatory tone)</li></ul><p>❌ <em>Highly toxic response:</em></p><ul><li><strong>Q:</strong> <em>How should people handle workplace conflicts?</em></li><li><strong>A:</strong> <em>You should just threaten people to get what you want.</em> (Promoting violence)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dnzGGq4SStQyvm9SKXUdoQ.png" /><figcaption>A simplified definition of the DeepEval metrics used in our Evaluation process.</figcaption></figure><h3><strong>Standardizing Scores for Decision-Making</strong></h3><p>Since each metrics has a different scale (depending also on which tools you are using: es VertexAI, DeepEval..) we decide to standardize each metric on a scale from 0 to 1 (zero is the bottom and 1 the best result); this way of thinking is not valid for toxicity. Indeed, if a sentence is toxic, it must be reported immediately. Thus, the synthetic indicator for toxicity is dichotomic True/False and not a score.</p><p>In the End we define specific thresholds in a way we can understand if each answer are “good to go” or have some problems:<br><strong>Rouge</strong>:</p><ul><li>Green: &gt; 0.5</li><li>Yellow: 0.4–0.5</li><li>Red: &lt; 0.4</li></ul><p><strong>Other metrics</strong> (excluding toxicity):</p><ul><li>Green: &gt;= 0.7</li><li>Yellow: 0.4–0.7</li><li>Red: &lt; 0.4</li></ul><p>With this structure we are able to understand if a single interaction has some problems or not, however our goal is to understand if a specific assistant is “good to go” or not and what is it’s performnace. <br>Each metric is converted into a <strong>traffic light indicator</strong>, and their averages determine the final model evaluation. The steps are as follows:</p><ol><li><strong>Convert Individual Scores to Traffic Lights</strong><br>Each metric score is transformed into a categorical indicator (<strong>Green, Yellow, or Red</strong>) based on predefined thresholds.</li><li><strong>Compute the Mean Score Across Metrics</strong><br>The mean of all categorical indicators is computed to determine an overall <strong>traffic light status</strong> for the model.</li><li><strong>Handling of Missing Evaluations</strong><br>If more than <strong>5% of responses are missing</strong> (i.e., could not be evaluated), the <strong>maximum achievable overall score is Yellow</strong>, regardless of the mean metric scores.</li><li><strong>Final Decision for the Overall Traffic Light Indicator</strong></li></ol><ul><li><strong>Green:</strong> Achieved if all sub-indicators are green, and there are no <strong>red values/</strong>or below a certain threshold (you can choose).<br>E.g. Avg mean of 0.87 but one request is red and it has score 0.25</li><li><strong>Yellow:</strong> If at least <strong>one sub-indicator is yellow</strong> but none exceed red.</li><li><strong>Red:</strong> If there are multiple failing criteria: the general avarage is below a certain level, there are different red score for each request or there are different empty response.</li></ul><p>We never mention the toxicity, since if we find a toxic answer, for us it became red all the general experiment (not just the line) and we must solve the problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tJNvTUjUy4rSXM_vpYHJOw.png" /></figure><h3><strong>Application — Automation in Evaluation</strong></h3><p>To ensure consistent evaluation of LLM-based assistants, we have developed a method that allows us to evaluate experiments containing <strong>n samples</strong> and generate a <strong>pragmatic performance metric</strong>. This enables us to justify whether a specific assistant meets a predefined standard or requires further refinement.</p><h3>Integration into the Job Flow</h3><p>The final step in our approach is to seamlessly integrate the evaluation tool within our job flow. By doing so, we can assess each assistant efficiently and systematically. We decided to incorporate this into a <strong>GitLab CI/CD workflow</strong>, ensuring that every time a test is modified or a prompt is updated, an automated evaluation is triggered to measure the assistant’s performance.</p><h3>Automated Workflow Overview</h3><p>Below is a high-level representation of the automated evaluation pipeline:</p><ol><li><strong>User Uploads a CSV</strong> → The user submits a dataset containing test queries and expected responses.</li><li><strong>Data Storage</strong> → The CSV file is stored in a <strong>Blob Storage</strong> system.</li><li><strong>API Processing</strong> → An API reads the stored data and feeds it into the <strong>LLM Evaluation module</strong>.</li><li><strong>LLM-Based Evaluation</strong> → The assistant’s responses are evaluated using predefined metrics such as <strong>relevance, correctness, ROUGE, and toxicity</strong>.</li><li><strong>Output Storage</strong> → The evaluation results are stored in <strong>Neptune</strong>, providing structured feedback and model performance tracking.</li></ol><h4>Visual Representation</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*5S7aOcT61m6TKTyxHiHPxA.jpeg" /><figcaption>LLM Evaluator integrated inside our gitlab pipeline</figcaption></figure><p>This integration ensures that our evaluation system is both scalable and reproducible, allowing us to track assistants’ improvements over time and running tests before deployment.</p><h3>Conclusion</h3><p>In the fast-evolving landscape of AI, <strong>evaluating LLMs effectively is not just an option, but a necessity</strong>. With structured evaluation methodologies and automated pipelines, we can ensure that AI assistants deliver responses that are <strong>accurate, reliable, and aligned with user expectations</strong>. The future of AI depends on our ability to measure and refine — because what we cannot evaluate, we cannot improve.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ca774d381ffe" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>