Evaluation Frameworks for LLMs and Agents: The Complete Toolkit in AI Engineering From Scratch
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).
The framework produces leaderboard-style JSON outputs and supports matrix evaluation across multiple tasks simultaneously:
# 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), it integrates directly with PyTest for CI/CD pipelines.
# 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).
# 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), 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) as a CI-friendly solution.
# 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). This pattern stitches together metric collection, cost tracking, latency monitoring, and safety checks.
# 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).
Key Curriculum Files
The following source files contain the complete implementation details:
phases/10-llms-from-scratch/10-evaluation/docs/en.md– lm-evaluation-harness and promptfoo overviewphases/11-llm-engineering/10-evaluation/docs/en.md– DeepEval introduction and PyTest integrationphases/05-nlp-foundations-to-advanced/27-llm-evaluation-frameworks/docs/en.md– RAGAS, DeepEval, and G-Eval comparisonphases/14-agent-engineering/10-evaluation/docs/en.md– Agent-system evaluation patternsphases/19-capstone-projects/49-lm-eval-harness/docs/en.md– Detailed harness usage and leaderboard generationphases/19-capstone-projects/84-refusal-evaluation/docs/en.md– Refusal evaluation frameworkphases/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, 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 for RAG evaluation and phases/19-capstone-projects/11-llm-observability-dashboard/docs/en.md for observability stacks combining DeepEval, RAGAS, and custom LLM judges.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →