Skip to main content
Merit helps developers test AI projects for AI-specific bugs like hallucinations, missing context, and incorrect decisions. But shouldn’t evals handle that? Or pytest? In this section, we explain the differences and help you pick the best approach for your use case.

What’s wrong about evals?

Evals come from data science. The workflow is:
  1. Define a metric (accuracy, F1, BLEU, etc.)
  2. Run your model on a benchmark dataset
  3. Tweak parameters until the metric improves
  4. Repeat
This works when you’re training a model. But when you’re building a product, you have more control over your system. By incrementally improving the code and system design, you can move the product quality to be enough for production. A 95% accuracy score tells you nothing about what code contributed to which failures, and which failures should be prioritized.

What’s wrong about pytest?

Automated tests come from software engineering. The workflow is:
  1. Write an assertion: assert result == expected
  2. Run the test
  3. If it passes once, ship it
This works when code is deterministic. Call add(2, 2) and you always get 4. AI systems are stochastic. The same input can produce different outputs:
Even for something that looks deterministic (like arithmetic), LLM-based systems can behave like every phrasing is a new case:
This is why a single passing test is weak evidence for AI behavior: you need repeated runs and broader case coverage.

Comparison

AI Predicates: Assert meaning, not strings

Merit’s AI predicates let you assert on complex properties:

Repeat: Measure consistency

Merit’s @merit.repeat runs the same merit multiple times:

Metrics: Aggregate statistics with quality gates

Merit’s metrics give you statistical power with explicit thresholds:
You get both individual pass/fail results and aggregate statistics.

Cases: Turn datasets into type-safe explicit code

Merit’s Case abstraction lets you load test data from external sources:

Example: Testing a Customer Support Bot

Let’s see how the same system would be tested with each approach.

The System

A customer support chatbot that answers questions using a knowledge base:

With pytest

With Evals

With Merit

Run with:

Getting Started

Ready to try Merit? Check out the Quick Start guide.