# Evaluation Frameworks for LLMs and Agents: The Complete Toolkit in AI Engineering From Scratch

> Master LLM and agent evaluation with frameworks like lm-evaluation-harness, DeepEval, RAGAS, G-Eval, and promptfoo. This toolkit covers benchmarking to end-to-end assessment for AI engineering from scratch.

- Repository: [Rohit Ghumare/ai-engineering-from-scratch](https://github.com/rohitg00/ai-engineering-from-scratch)
- Tags: tutorial
- Published: 2026-06-20

---

**The curriculum teaches six primary open-source frameworks—lm-evaluation-harness, DeepEval, RAGAS, G-Eval, promptfoo, and custom Agent eval patterns—that cover everything from standardized LM benchmarking to end-to-end agent-system assessment.**

The **AI Engineering From Scratch** repository by rohitg00 provides a comprehensive curriculum for evaluating language models and agent systems at production scale. Understanding these evaluation frameworks for LLMs and agents is essential for building reliable AI applications that can be deployed with confidence. This guide breaks down the specific tools, file locations, and implementation patterns taught across the course phases.

## Core Evaluation Frameworks Covered

The curriculum is structured around framework-agnostic tools that work with any model loadable via HuggingFace or local checkpoints. Each framework targets a specific layer of the evaluation stack.

### lm-evaluation-harness for Standardized Benchmarking

**EleutherAI's lm-evaluation-harness** serves as the foundation for running hundreds of standard LM benchmarks including MMLU, HellaSwag, TruthfulQA, and BIG-Bench. This is taught in Phase 10-LLMs-from-Scratch (see [`phases/10-llms-from-scratch/10-evaluation/docs/en.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/phases/10-llms-from-scratch/10-evaluation/docs/en.md)).

The framework produces leaderboard-style JSON outputs and supports matrix evaluation across multiple tasks simultaneously:

```python

# phases/10-llms-from-scratch/10-evaluation/code/run_harness.py

from lm_eval import evaluator, utils

model = utils.get_model("gpt2")

results = evaluator.evaluate(
    model=model,
    tasks=["mmlu"],
    device="cuda"
)

print("MMLU accuracy:", results["mmlu"]["acc"])

```

### DeepEval for Python-Native Metrics

**DeepEval** (by Confident AI) provides 14+ Python metrics including answer relevance, faithfulness, toxicity, bias, and hallucination detection. Taught in Phase 11-LLM-Engineering ([`phases/11-llm-engineering/10-evaluation/docs/en.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/phases/11-llm-engineering/10-evaluation/docs/en.md)), it integrates directly with PyTest for CI/CD pipelines.

```python

# phases/11-llm-engineering/10-evaluation/tests/test_deepeval.py

from deepeval import evaluate
from deepeval.metrics import AnswerRelevancyMetric
from deepeval.test_case import LLMTestCase

def test_answer_relevancy():
    case = LLMTestCase(
        input="What is the capital of France?",
        output="Paris is the capital of France.",
        expected_output="Paris",
    )
    metric = AnswerRelevancyMetric()
    score = evaluate([case], metric)
    assert score[0].score > 0.9

```

### RAGAS for Retrieval-Augmented Generation

**RAGAS** (Retrieval-Augmented Generation Assessment) specializes in four RAG-specific metrics that work without gold references: faithfulness, answer-relevance, context-precision, and context-recall. This is covered in Phase 5-NLP-Foundations-to-Advanced ([`phases/05-nlp-foundations-to-advanced/27-llm-evaluation-frameworks/docs/en.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/phases/05-nlp-foundations-to-advanced/27-llm-evaluation-frameworks/docs/en.md)).

```python

# phases/05-nlp-foundations-to-advanced/27-llm-evaluation-frameworks/code/ragas_demo.py

from ragas import evaluate as ragas_eval
from ragas.metrics import Faithfulness, AnswerRelevancy

samples = [
    {
        "question": "Who wrote the novel '1984'?",
        "answer": "George Orwell wrote '1984'.",
        "contexts": ["George Orwell was a British writer."]
    }
]

metrics = [Faithfulness(), AnswerRelevancy()]
results = ragas_eval(samples, metrics)

```

### G-Eval for Custom LLM-as-Judge Pipelines

**G-Eval** enables user-defined criteria evaluation (such as citation correctness) built on top of an LLM judge. This framework is taught alongside RAGAS in the same lesson ([`phases/05-nlp-foundations-to-advanced/27-llm-evaluation-frameworks/docs/en.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/phases/05-nlp-foundations-to-advanced/27-llm-evaluation-frameworks/docs/en.md)), allowing for custom evaluation criteria when standard metrics are insufficient.

### promptfoo for Regression Testing

**promptfoo** provides YAML-driven evaluation suites for multi-model prompt-regression testing with LLM-as-judge capabilities. The curriculum covers this in Phase 10-LLMs-from-Scratch ([`phases/10-llms-from-scratch/10-evaluation/docs/en.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/phases/10-llms-from-scratch/10-evaluation/docs/en.md)) as a CI-friendly solution.

```yaml

# phases/10-llms-from-scratch/10-evaluation/promptfoo.yaml

prompts:
  - name: "simple-qa"
    model: "openai:gpt-4o"
    temperature: 0
    prompt: |
      Q: {{question}}
      A:
tests:
  - vars:
      question: "What is the boiling point of water?"
    assert:
      - type: contains
        value: "100°C"

```

## Agent-System Evaluation Patterns

For multi-agent pipelines, the curriculum teaches the **"Eval-Pattern" skill** in Phase 14-Agent-Engineering ([`phases/14-agent-engineering/10-evaluation/docs/en.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/phases/14-agent-engineering/10-evaluation/docs/en.md)). This pattern stitches together metric collection, cost tracking, latency monitoring, and safety checks.

```python

# phases/14-agent-engineering/10-evaluation/code/agent_eval.py

from promptfoo import run as promptfoo_run
from deepeval import evaluate as deepeval_run
from ragas import evaluate as ragas_run

def evaluate_agent_run(trace):
    promptfoo_results = promptfoo_run("promptfoo.yaml")
    deepeval_score = deepeval_run(trace["llm_output"])
    ragas_score = ragas_run(trace["retrieval_samples"], metrics=[Faithfulness()])
    
    return {
        "promptfoo": promptfoo_results,
        "deepeval": deepeval_score,
        "ragas_faithfulness": ragas_score,
    }

```

## Safety and Refusal Evaluation

The curriculum includes capstone projects that combine the above frameworks with red-team tooling (Garak, PyRIT) to create a **refusal-evaluation** skill. This measures under-refusal, over-refusal rates, and calibration across categories (see [`phases/19-capstone-projects/84-refusal-evaluation/docs/en.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/phases/19-capstone-projects/84-refusal-evaluation/docs/en.md)).

## Key Curriculum Files

The following source files contain the complete implementation details:

- [`phases/10-llms-from-scratch/10-evaluation/docs/en.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/phases/10-llms-from-scratch/10-evaluation/docs/en.md) – lm-evaluation-harness and promptfoo overview
- [`phases/11-llm-engineering/10-evaluation/docs/en.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/phases/11-llm-engineering/10-evaluation/docs/en.md) – DeepEval introduction and PyTest integration
- [`phases/05-nlp-foundations-to-advanced/27-llm-evaluation-frameworks/docs/en.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/phases/05-nlp-foundations-to-advanced/27-llm-evaluation-frameworks/docs/en.md) – RAGAS, DeepEval, and G-Eval comparison
- [`phases/14-agent-engineering/10-evaluation/docs/en.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/phases/14-agent-engineering/10-evaluation/docs/en.md) – Agent-system evaluation patterns
- [`phases/19-capstone-projects/49-lm-eval-harness/docs/en.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/phases/19-capstone-projects/49-lm-eval-harness/docs/en.md) – Detailed harness usage and leaderboard generation
- [`phases/19-capstone-projects/84-refusal-evaluation/docs/en.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/phases/19-capstone-projects/84-refusal-evaluation/docs/en.md) – Refusal evaluation framework
- [`phases/19-capstone-projects/08-production-rag-chatbot/docs/en.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/phases/19-capstone-projects/08-production-rag-chatbot/docs/en.md) – Production RAG evaluation stack

## Summary

- **lm-evaluation-harness** provides standardized benchmarking across hundreds of tasks like MMLU and HellaSwag for base model assessment.
- **DeepEval** offers 14+ Python-native metrics with PyTest integration for unit testing LLM outputs in CI pipelines.
- **RAGAS** delivers reference-free evaluation specifically for retrieval-augmented generation systems.
- **G-Eval** enables custom LLM-as-judge criteria for specialized evaluation requirements.
- **promptfoo** supports YAML-driven regression testing and multi-model comparison in CI/CD environments.
- **Agent eval patterns** combine these frameworks to measure cost, latency, and safety in multi-agent workflows.

## Frequently Asked Questions

### What is the difference between RAGAS and DeepEval?

**RAGAS** is specifically designed for retrieval-augmented generation systems and works without ground-truth references, measuring faithfulness and context relevance. **DeepEval** is a general-purpose framework with 14+ metrics for any LLM application, integrating directly with PyTest for traditional software testing workflows.

### How does the curriculum teach agent evaluation differently from single-model evaluation?

The curriculum teaches agent evaluation through the **"Eval-Pattern" skill** in [`phases/14-agent-engineering/10-evaluation/docs/en.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/phases/14-agent-engineering/10-evaluation/docs/en.md), which focuses on aggregating multiple metric types ( DeepEval for response quality, RAGAS for retrieval accuracy, promptfoo for regression testing) while tracking cost and latency across multi-step workflows.

### Can these frameworks evaluate locally-hosted models or only API-based models?

All frameworks taught in the curriculum are **framework-agnostic** and support any model loadable via HuggingFace or local checkpoints. The `lm-evaluation-harness` specifically demonstrates loading local PyTorch models, while DeepEval and RAGAS can evaluate any model wrapper you provide.

### Where can I find the production-ready implementation examples?

Production implementations are located in the capstone projects, particularly [`phases/19-capstone-projects/08-production-rag-chatbot/docs/en.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/phases/19-capstone-projects/08-production-rag-chatbot/docs/en.md) for RAG evaluation and [`phases/19-capstone-projects/11-llm-observability-dashboard/docs/en.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/phases/19-capstone-projects/11-llm-observability-dashboard/docs/en.md) for observability stacks combining DeepEval, RAGAS, and custom LLM judges.