Request a Consultation

Insights · AI

Building an LLM evaluation harness you can trust

By the Cystem X Engineering Team - Published - 5 min read

Changing a prompt, a model or a retrieval setting can quietly make an LLM application better in one respect and worse in another. Without measurement, teams argue about impressions. An evaluation harness replaces impressions with evidence by running the same set of tests every time something changes.

Define what good means

Quality is multi-dimensional: correctness, groundedness, completeness, tone, format, latency, cost and safety. Decide which dimensions matter for your use case, and write acceptance criteria for each in measurable terms.

Involve the people who use the output. Their definition of good is the one that counts.

Build a representative dataset

Collect real questions or tasks, with expected answers or reference sources where possible. Include common cases, edge cases, ambiguous inputs and adversarial examples. Start with dozens, grow to hundreds and keep adding cases from production failures.

Hold out a portion that is never used for tuning, so you can detect overfitting to the test set.

If you cannot measure a change, you cannot safely ship it.
Dense code on a dark screen
Evaluation suites are code and should be versioned and reviewed.

Use the right metrics

Some outputs can be checked programmatically: valid JSON, correct tool call, exact match on a field. Others need judgment. Combine deterministic checks, similarity measures and rubric-based grading.

Report metrics per category as well as overall. An average can hide a serious weakness in a small but important segment.

Use model judges carefully

Language models can grade outputs at scale using a rubric, but judges have biases such as preferring longer answers and favoring outputs similar to their own. Calibrate judges against human labels, use clear rubrics and check agreement regularly.

Use human review for high-stakes categories and for periodic audits of the automated scores.

Tablet showing a bar chart on a desk
Report metrics by category, not only in aggregate.

Test safety and robustness

Include tests for prompt injection, data leakage, harmful content and policy violations, along with tests for how the system behaves when inputs are malformed or retrieval returns nothing useful.

Treat safety tests as release gates with explicit thresholds, not as optional extras.

Automate regression testing

Run the suite in continuous integration whenever prompts, models, retrieval settings or tools change, and compare against the last accepted baseline. Fail the build when key metrics fall below thresholds.

Store results with the configuration that produced them, so that any score can be reproduced later.

Engineer working at a computer with code displayed
Run the suite in CI on every change.

Monitor in production

Offline tests cannot predict everything. Sample production traffic for review, collect user feedback and track drift in inputs and outputs. Feed discovered failures back into the dataset.

Evaluation is a cycle: measure, learn, improve, and measure again.

Key takeaways

  • Define quality dimensions and acceptance criteria before testing.
  • Build a representative, growing dataset with a held-out portion.
  • Combine deterministic checks, similarity and rubric grading.
  • Calibrate model judges against human labels.
  • Run regression tests in CI and monitor production behavior.

Sources and further reading

This article reflects general practice and publicly available guidance. Teams should consult primary sources, including the NIST AI Risk Management Framework, the OWASP Top 10 for LLM Applications and the documentation of open-source evaluation frameworks, and adapt the guidance to their own environment, risk appetite and legal obligations.

Agentic AI & Automation

Measure your AI before your users do.

We design evaluation harnesses and release gates for LLM applications and agents.

Explore Agentic AI & Automation

Let’s engineer what’s next.

Tell us about your initiative - a solution architect will respond within one business day.