Published on Data Blog

Beyond chat demos: evaluating LLM systems at scale with DeepEval

This page in:
Beyond chat demos: evaluating LLM systems at scale with DeepEval The evaluation framework combines persona composition, live multi-turn simulation, metric pre-filtering, and LLM-based scoring to test chatbot reliability at scale. / Image: Shutterstock

Building a generative AI chat prototype has become straightforward. With a large language model (LLM), a vector database, a frontend interface, and an AI coding assistant, a developer can assemble a working demo in days. However, deploying such applications at institutions like the World Bank Group—where data accuracy, policy context, and citation verifiability are essential—requires far more than a working proof of concept. 

How do you guarantee an LLM assistant remains reliable across hundreds of user requests?

How do you ensure it does not hallucinate indicators, skip citations, or lose context over multi-turn dialogues? 

How do you measure response quality for questions users have not yet asked?

To address these challenges, we built an automated, persona-driven evaluation framework using Confident AI's open-source DeepEval library as our scoring backbone. While DeepEval provides core metric primitives, our framework introduces custom innovations: dynamic persona composition, intelligent pre-filtering, and a replay mechanism for rapid rubric iteration. Originally created for the Data360 Chat Assistant, this framework is now packaged as a reusable blueprint for building trustworthy AI applications across the institution (GitHub Repository).

 

The unpredictable path of multi-turn chat

Traditional software testing is linear: input A yields output B. For conversational AI, this approach fails because user interactions are dynamic, branching dialogues. A user might greet the assistant, ask for GDP trends, request data formatted in a table, compare neighboring countries, and finally request a chart.

Image Conversation Turn Progression

 

Evaluating isolated responses misses compounding multi-turn failures:

  • Context Drift: The model forgets constraints (such as country or year range) specified in earlier turns.

  • Orchestration Failures: The router correctly classifies intent on Turn 1 but strays onto an incorrect path on Turn 3.

  • State and Transport Breaks: Persistent Server-Sent Events (SSE) data streams can cut off mid-transit, or database session state can fail to reload, forcing the model to restart.

To catch these failures, our framework executes tests directly against the live chatbot API—requesting guest auth tokens, persisting PostgreSQL session IDs, and parsing streamed responses to simulate real user sessions.

Image Chatbot Evaluation System Dataflow

 

From isolation to standardization

Across large organizations, teams build specialized GenAI applications to query databases, summarize documents, or scan research. While targeting distinct needs, all face a common challenge: verifying interface reliability before deployment. Evaluation is often ad hoc—relying on isolated Jupyter notebooks or manual transcript reviews. These methods are difficult to scale, reuse, or standardize. As a result, teams duplicate effort and lack consistent benchmarks to compare quality across releases. Our goal was to build a modular evaluation framework that handles multi-turn technical complexities while enabling any team to adapt it without building testing infrastructure from scratch.

How the evaluation pipeline works

The pipeline connects four sequential stages:

  1. Persona Composition: Assembles a test user from modular profile facets (role, topic, country, conversational pattern).

  1. Simulation: Runs the persona through the live chatbot API, capturing multi-turn dialogue traces.

  1. Pre-filtering: Examines each turn to skip non-applicable metrics, reducing runtime and LLM judge costs.

  1. Scoring: Evaluates applicable metrics using a lightweight LLM judge, outputting per-turn and per-conversation scores.

     

Simulating WBG user roles: The composable persona system

User expectations vary dramatically: a student seeking basic literacy stats expects plain language, while an operations officer requires dense data tables. Writing static test scripts for hundreds of scenarios is unmanageable. Instead, we designed a Composed Persona System that breaks test users into four modular YAML facets:

  • Base Profiles: User data literacy and interaction style (e.g., student vs. analyst).

  • Topics: Thematic domains (e.g., health, trade, education).

  • Countries: Target geographic locations.

  • Conversational Patterns: Interaction formats (e.g., table requests, visualization requests, adversarial follow-ups).

Image

 

At runtime, the framework mixes and matches these facets. Combining 6 base profiles, 10 topic domains, 5 country groups, and 8 conversational patterns generates hundreds of distinct test journeys while keeping configuration compact in short YAML files.

 

Defining "correctness": expected outcomes & custom rubrics

Once assembled, the simulation engine executes the dialogue for a minimum of two turns to evaluate context retention and follow-up handling. Each persona contains an explicit expected_outcome (for example: "Retrieve latest youth unemployment for Morocco, present with claim tags and sources, display a comparison table, and suggest two related indicators"). We evaluate performance using a two-tiered scoring structure:

  • Conversation-Level Metrics: Evaluated once at dialogue completion (e.g., Conversation Completeness).

  • Per-Turn Metrics: Evaluated on every turn for specific criteria (Data Accuracy, Source Citation, Tool Selection).

Evaluations rely on an LLM-as-a-judge—a lightweight language model that grades outputs against custom scoring rubrics in configuration files.

Image

 

Strict thresholds (e.g., 0.8 for accuracy, 0.5 for retention/formatting) ensure minor formatting variance does not trigger false alarms while data errors fail immediately.

 

The pre-filtering engine: intelligent & cost-effective evaluation

Running a dozen metrics across 5-turn dialogues for 50 test runs requires thousands of LLM judge calls—making evaluation slow, expensive, and noisy (e.g., grading "Data Formatting" on a simple "Hello" turn). Our Pre-filtering Engine programmatically checks turn context before scoring.

Image

 

If a metric is non-applicable (e.g., no data returned, so Data Accuracy is skipped), it is automatically assigned 1.0 and marked as prefiltered: True. Pre-filtered metrics are excluded from aggregate score averages, preventing artificial inflation while cutting evaluation cost and runtime.

 

The developer loop: tuning rubrics with the replay mechanism

Re-running multi-turn simulations to test rubric updates wastes time and tokens. We built a Replay Mechanism that saves raw text, planner reasoning, and tool calls to complete trace files.

Image

 

When developers update a rubric, they replay saved traces against the new criteria without re-running simulations. This cuts feedback loops from minutes to seconds, allowing rubrics to converge quickly with side-by-side score diffs.

 

What the evaluations revealed

In production evaluations since February 2026, we executed over 150 runs across 10 composed personas (5-turn dialogues with 3 repeated trials for variance detection). In a comprehensive 170-metric sweep, the assistant achieved a 98% overall pass rate (167 of 170 metric assessments passed).

Image

 

The framework consistently highlights subtle weak spots: occasional missing "Sources:" headers and overly formal follow-up phrasing. It also serves as a regression guard: when prompt tweaks improved Data Accuracy from 0.89 to 0.94, repeated trials confirmed the gain was consistent rather than accidental.

 

Conclusion & next steps

Automated, persona-driven evaluation transforms ad hoc testing into a repeatable, explainable quality gate. By combining dynamic persona composition, pre-filtering, and trace replay, teams can catch context drift, citation gaps, and routing errors before they reach users. We are packaging core mechanics into a shared template for WBG teams. Current focus areas include mitigating LLM judge variance (via 3x repeated runs) and optimizing API call costs. Teams can adapt our open-source evaluation configuration, persona facets, and rubrics via our GitHub Evals Repository.


Rafael Sevilla Macalaba

AI and ML Engineer Consultant, Development Data Group, World Bank

Aivin Solatorio

Program Manager, Development Data Group, World Bank

Join the Conversation

The content of this field is kept private and will not be shown publicly
Remaining characters: 1000