Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 60

Evaluating AI Capabilities

Recommended resources

Introduction

In the last lesson, we established how to use statistical tests to determine if the performance difference between two models is a genuine improvement or just a statistical fluke. You now have the tools to say with confidence whether Model A is truly better than Model B. But this begs a crucial question: "Better at what?"

Today, we address that question by diving into the specific capabilities that define a model's performance. This lesson covers the learning outcome: Describe methods for evaluating specific capabilities like factual accuracy, reasoning, and instruction-following. We will move beyond a single, generic "quality" score and explore targeted techniques to measure how well a model performs on these three critical axes. For a top-tier engineer, mastering this is essential for diagnosing model weaknesses, selecting the right model for a specific task, and guiding effective fine-tuning.


1. Evaluating Factual Accuracy and Hallucinations

Factual accuracy measures whether a model's output is grounded in verifiable reality or a provided context. The flip side of this is hallucination, where a model generates plausible but factually incorrect or nonsensical information. Let's explore two robust methods for evaluating this.

Method 1: Claim Decomposition and Verification

A highly effective and interpretable method for measuring factuality is to break down the model's output into individual, verifiable claims and then check each one. This approach is central to frameworks like Ragas for evaluating Retrieval-Augmented Generation (RAG) systems.

To learn about this process, please watch the following segment from a Stanford lecture on LLM Evaluation.

Stanford CME295 Transformers & LLMs | Autumn 2025 | Lecture 8 - LLM Evaluation

The following clip from Stanford's lecture on LLM Evaluation explains a robust, multi-step process for quantifying the factual accuracy of a model's output.

Watch the segment from 00:54:03 to 01:00:02. Focus on the three key steps described: Decomposition: How the original text is broken down into a list of atomic facts. Verification: The process of checking each individual fact, often using techniques like RAG or web search. Aggregation: How the individual fact scores (and their optional importance weights) are combined into a single, nuanced factuality score.

As the video explained, the process is:

  1. Decompose: Use an LLM to parse the generated output into a list of discrete, atomic claims. For example, the sentence "The Eiffel Tower, built in 1889, is in Paris" becomes two claims: (1) The Eiffel Tower was built in 1889, and (2) The Eiffel Tower is in Paris.
  2. Verify: For each claim, use a verification mechanism to determine if it is true. In a RAG system, this means checking if the claim is supported by the retrieved context. For open-domain questions, this might involve a web search or checking against a trusted knowledge base.
  3. Score: The final factuality score (often called Faithfulness in a RAG context) is the ratio of supported claims to the total number of claims.

This method is powerful because it provides not only a final score but also pinpoints exactly which claims are incorrect, making it highly debuggable.

Evaluating LLM and RAG Systems - Metrics using Ragas
The Ragas framework highlights 'Faithfulness' as a key metric for the generation component of a RAG system. This metric is calculated by decomposing the answer and verifying each statement against the retrieved context, directly implementing the claim verification method.

Method 2: Advanced Hallucination Detection with Chain-Pole

While claim decomposition is excellent, more advanced techniques aim to improve accuracy and explainability. One such method is Chain-Pole, which combines Chain-of-Thought prompting with an ensembling technique.

Mitigating LLM Hallucinations with a Metrics-First Evaluation Framework

This video from DeepLearningAI introduces a novel technique called 'Chain-Pole' for detecting hallucinations, which addresses some limitations of simpler methods.

Watch the segments from 00:19:31 to 00:28:37. Focus on understanding: The two phases of Chain-Pole: What happens during the 'Chaining' (using Chain-of-Thought) and 'Polling' (ensembling/voting) steps? The resulting metrics: How this technique produces two distinct metrics, 'Correctness' for open-domain use cases and 'Context Adherence' for RAG workflows. The explainability benefit: Notice how the output provides a step-by-step explanation of what went wrong, which is invaluable for debugging.

Chain-Pole offers a more sophisticated approach by:

  • Chaining: Using a detailed Chain-of-Thought prompt to make a secondary LLM break down the reasoning behind the original model's completion.
  • Polling: Ensembling evidence from the Chain-of-Thought output to "vote" on whether a hallucination occurred.

This method produces two key metrics:

  • Correctness: For open-ended, non-RAG use cases, it measures the factual consistency of the output.
  • Context Adherence: For RAG, it specifically measures how well-grounded the output is in the provided context, acting as a more advanced form of faithfulness.

For an engineer aiming for the top 1%, knowing about techniques like Chain-Pole is important as they represent the frontier of automated, explainable evaluation.


2. Evaluating Reasoning

Reasoning refers to a model's ability to perform multi-step logical operations, solve problems, and draw inferences rather than just retrieving facts.

Method 1: Standardized Reasoning Benchmarks

Academic benchmarks are designed to test specific reasoning skills in a standardized way. These are crucial for comparing foundational models.

LLM Reasoning Benchmarks Overview
This table illustrates several common reasoning benchmarks. Winograd Schemas test commonsense reasoning by resolving pronoun ambiguity, bAbI tasks assess skills like deduction and induction, and HellaSwag evaluates commonsense inference in predicting the end of a situation.

Other important reasoning benchmarks include:

  • GSM8K: A dataset of grade school math word problems that require multi-step reasoning.
  • MMLU (Massive Multitask Language Understanding): While a broad knowledge benchmark, its problems (especially in STEM fields) often require significant reasoning to solve.
  • HumanEval & MBPP: Benchmarks that test reasoning in the context of code generation, requiring the model to understand a problem and write a correct program.

Method 2: Evaluating Agentic Reasoning Workflows

In practical applications, especially with AI agents, reasoning isn't about solving abstract puzzles but about successfully completing a task using tools. Evaluating this requires breaking down the agent's thought process. The ReAct (Reason, Act) framework gives us a useful model for this.

The following guide provides a fantastic, production-oriented taxonomy for agent evaluation metrics.

LLM Evaluation Metrics: The Ultimate LLM Evaluation Guide

The 'Ultimate LLM Evaluation Guide' from Confident AI provides a detailed breakdown of metrics for evaluating AI agents. This section is particularly relevant as it maps metrics to the different stages of an agent's reasoning and execution process.

Read the section titled 'AI Agent Metrics'. As you read, categorize the metrics described based on what part of the agent's process they evaluate: Planning: Which metric assesses the quality of the initial plan? Tool Selection: Which metrics check if the model picks the right tool and uses it correctly? Execution: Which metrics evaluate if the model follows its plan and completes the task efficiently?

From the reading, we can construct a comprehensive framework for evaluating an agent's reasoning capabilities at each step of its workflow:

  1. Plan Quality: Does the agent formulate a logical and efficient plan to tackle the user's request? This evaluates the initial "Reason" step.
  2. Tool & Argument Correctness: In the "Act" step, does the agent select the correct tool from its available options, and does it provide the correct arguments to that tool?
  3. Plan Adherence: Does the agent actually follow the plan it created, or does it deviate in unproductive ways?
  4. Step Efficiency: Does the agent complete the task without redundant or unnecessary steps?
  5. Task Completion: The ultimate end-to-end metric. Did the agent, after all its reasoning and actions, successfully accomplish the goal?

By using these specific metrics, you can move from "the agent failed" to a precise diagnosis like "the agent created a good plan but failed to provide the correct arguments to the search_flights tool."


3. Evaluating Instruction-Following

Instruction-following is a model's ability to adhere to specific constraints and directives within a prompt, separate from the factual correctness or reasoning quality of the content itself. This includes constraints on format, length, style, or content inclusion/exclusion.

A major challenge is that instructions can be subjective (e.g., "write in a friendly tone"). A more robust evaluation method focuses on instructions that can be objectively verified.

Instruction-Following Evaluation for Large Language Models

The research paper 'Instruction-Following Evaluation for Large Language Models' introduces IFEval, a benchmark built entirely around the concept of 'verifiable instructions.' It provides a clear framework and taxonomy for this evaluation method.

Read the Introduction (Section 1) and the section on Verifiable Instructions (Section 2, including Table 1). Focus on the definition of a 'verifiable instruction.' Why is this concept useful for creating objective and reproducible evaluations? Review Table 1 to understand the different categories of verifiable instructions, such as those related to keywords, length, format, and structure.

The core idea of IFEval is to evaluate models using prompts that contain instructions verifiable by a simple, deterministic program. This avoids the bias and cost of human or LLM-based judges for this specific capability.

The paper provides a rich taxonomy of such instructions, including:

  • Format Constraints: "Provide the output in JSON format," "Include exactly 3 bullet points," "Wrap the title in double angular brackets."
  • Content Constraints: "Include the keyword 'synergy' at least twice," "Do not use the word 'obvious'," "The third paragraph must start with the word 'Furthermore'."
  • Length Constraints: "Write between 200 and 250 words," "The response must contain exactly 5 sentences."
  • Structural Constraints: "Give two different responses separated by '******'," "Repeat the request verbatim before your answer."

To evaluate a model, you simply run its output through a set of parsers and checkers corresponding to the instructions in the prompt. The final score is the percentage of instructions that were correctly followed. This is a direct, reliable, and highly scalable way to measure a model's adherence to explicit directives.

Test your understanding!

You are tasked with evaluating a new LLM for an internal company chatbot that helps employees understand HR policies. The key requirements are:

  1. It must provide answers based only on the provided HR policy documents.
  2. It needs to handle multi-step queries like "What is the vacation policy for UK employees, and how do I submit a request?"
  3. All responses must end with the exact disclaimer: "This is not legal advice. For specific questions, please contact HR."

How would you design an evaluation plan that specifically tests for factual accuracy, reasoning, and instruction-following for this use case, using methods from this lesson?

Show answer

Here’s a possible evaluation plan:

  • Factual Accuracy (Context Adherence):

    • Method: Use a claim decomposition and verification approach.
    • Implementation: For each test query, take the chatbot's answer and break it into atomic claims (e.g., "UK employees get 25 days of vacation," "Vacation requests are submitted via the Workday portal"). Then, for each claim, programmatically check if it is supported by the content of the retrieved HR policy documents. The final score would be the percentage of claims that are verifiably supported by the context.
  • Reasoning (Agentic Workflow):

    • Method: Use metrics for evaluating agentic workflows.
    • Implementation: Design test cases that require multiple steps. For the example query, a successful reasoning path would be: (1) Identify two sub-questions (policy, submission process), (2) Plan to first search for "vacation policy UK" and then for "submit vacation request," (3) Execute tool calls to the RAG retriever for both, (4) Synthesize the results into a coherent final answer. You would evaluate this using metrics like Plan Quality, Tool Correctness (did it query the retriever correctly?), and Task Completion.
  • Instruction-Following:

    • Method: Use a verifiable instruction check.
    • Implementation: This is the most straightforward. For every single output from the model during evaluation, run a simple programmatic check: response.endswith("This is not legal advice. For specific questions, please contact HR."). The instruction-following score would be the percentage of responses that pass this check.

Conclusion

You have now learned how to dissect a model's performance into its constituent capabilities. Instead of relying on a single, opaque score, you can now design and implement targeted evaluations for what truly matters for your application.

Key Takeaways:

  • Factual Accuracy can be rigorously measured by decomposing outputs into claims and verifying them against a source of truth (like in RAG's Faithfulness metric) or by using advanced methods like Chain-Pole.
  • Reasoning is evaluated using standardized benchmarks (like GSM8K or HellaSwag) for foundational models, and more practically through a breakdown of an agent's workflow (Plan Quality, Tool Correctness, Task Completion) for applied systems.
  • Instruction-Following is best measured objectively by focusing on verifiable instructions—specific constraints on format, length, or content that can be checked with simple, deterministic programs.

What's Next?

In this module, you have built a complete evaluation toolkit. You can curate datasets, design scalable LLM-as-a-judge systems, apply statistical tests for significance, and now, assess specific capabilities with precision.

In the final lesson of this module, we will synthesize all of this. We'll learn how to create a decision matrix to compare LLMs based on a weighted combination of performance, cost, latency, and safety. This is the crucial step where technical evaluation meets business reality, allowing you to make a holistic, data-driven recommendation for which model to deploy in production.