FDE Times dataFDE jobs open 932▼14 Change in open roles over 7 days, like-for-like: roles from companies we started tracking this week are left outNew in 7 days 62Companies hiring 202Remote-friendly 24%Median US pay $201kTop hirer Databricks 92
中文VI

The newspaper of the Forward Deployed Engineer

Guides

Read 100 traces before you build a single evaluator

Hamel Husain calls error analysis the most important activity in evals; it yields a ranked list of failures and one thing to fix this week.

ShareLinkedInFacebookX

In brief

  • Hamel Husain considers error analysis the most important activity in evals: read real traces first, measure later.
  • Record only the first error in each trace, label at least 30 traces by hand before asking an LLM to suggest categories, and keep reading until no new kinds of failure appear.
  • Rank failure categories by severity as well as frequency; if a prompt change can fix a category, make that change before building an evaluator.
Slope chart linking occurrence count to priority score for four error groups in a delivery bot example. Answer too long: 11 times, score 11. Wrong order-lookup tool: 8 times, score 24. Ignores date in query: 7 times, score 14. Wrong refund policy: 6 times, score 18. The most frequent group has the lowest score.
Multiply count by severity (1–3) and the most frequent error group, overlong answers, drops to the bottom of the table. Wrong order-lookup tool calls rise to the top. Source: hypothetical figures illustrating the article (customer-service bot for a delivery company).

Hamel Husain calls error analysis “the most important activity in evals”. Yet an FDE who has just deployed a chatbot for a client often wants to start with what looks most professional: a suite of automated evaluators. The case for reading first is simple. Until you know where the system breaks, you do not know what to measure.

The steps below cover one full round of error analysis. At the end you will have a label file for about 100 traces, a list of failure categories you named yourself, a ranking and a clear decision about what to fix this week.

This skill also separates an FDE from someone who only knows how to call an API. When a client asks, “What is the bot bad at?”, an answer backed by counts from real traces is far more persuasive than a general impression.

What do you need?

You need access to the traces of an LLM application: full records of the input, the intermediate steps such as tool calls or document retrieval, and the output. You also need a spreadsheet or CSV file, and Python 3 installed. Langfuse is optional. Its error analysis guide follows this same process, but every step can be done with files you maintain by hand.

The running example is a made-up customer service bot at a delivery company. It answers questions about order status, shipping fees and refund policy. All figures for this bot are illustrative.

Step 1: Sample a diverse set of traces

Langfuse’s process starts by pulling a representative sample from production traffic, a dataset or the outputs of test runs. Husain regards about 100 diverse traces as a practical number to start with. Diverse here means covering many types of question, many kinds of user, and both short and long traces.

Export the sample to a labels.csv file with this structure:

trace_id,note,category
t001,,
t002,,

Check: skim 10 random rows. If all 10 traces are order lookups, the sample is skewed and you need to draw it again.

Step 2: Open coding, recording only the first error

Read each trace and write free-form notes on every problem you see. This is open coding. Do not force your notes into an existing taxonomy; write them as you would for a colleague: “bot promised a 100% refund on an order more than 30 days old”.

The most important rule at this step is to record only the first error that appears in the trace. Husain explains that upstream errors cause downstream ones. If the bot calls the wrong order lookup tool and then gives the wrong delivery date, the tool call is the root cause and the wrong date is merely a consequence.

Husain advises labeling at least 30 traces by hand before looking at suggestions from an AI agent. Those first 30 are where you build intuition about the system. Hand the work to a machine too early and you will not understand enough to judge whether its suggestions are right.

Check: the note column in the first 30 rows should contain specific sentences that make sense at first reading. Notes such as “poor answer” are useless; rewrite them.

Step 3: Axial coding, grouping notes into failure categories

Now reread all your notes and group them into categories. This is axial coding. For the delivery bot, you might arrive at categories such as wrong_refund_policy, ignored_date_in_question, wrong_order_lookup_tool and answer_too_long.

You can ask an LLM to draft the list. But Langfuse’s guide is explicit that you must review the proposed categories yourself, because the model may lump failures with different causes into one. A wrong shipping fee caused by misreading the rate table, for instance, is quite different from one caused by failing to ask for the address, even though the two look alike on the surface.

Then fill in the category column for each trace, leaving it blank where there is no error. Langfuse handles this step by creating a boolean score for each failure category (Settings → Scores → Create, type: Boolean), so that each trace is marked pass or fail against each category.

Check: if one category accounts for more than half of all failures, it probably contains several different causes. Split it.

Step 4: Count, and know when to stop reading

The last step in Husain’s process is to count the failures in each category. Langfuse does the same: label every trace against the set of categories, then calculate a failure rate for each. The script below is a pared-down version that uses only the Python standard library:

import csv
from collections import Counter

with open("labels.csv", encoding="utf-8") as f:
    rows = list(csv.DictReader(f))

total = len(rows)
counts = Counter(r["category"] for r in rows if r["category"])
for cat, n in counts.most_common():
    print(f"{cat:30} {n:3}  {n/total:.0%}")

When have you read enough? Husain’s stopping rule is to keep reading until you reach theoretical saturation, the point at which new traces neither reveal new kinds of failure nor change the existing categories. If you are still creating categories at trace 100, draw a larger sample.

Step 5: Rank by frequency and severity

Counting alone is not enough. Product Talk ranks failure categories by both frequency and severity. If the bot rambles 11 times, customers are merely annoyed. If it misstates the refund policy six times, the company loses real money and customers may file complaints.

One simple approach is to score each category’s severity from 1 to 3 and multiply by its count. This is a simplification and has no standing as a standard formula, but it is enough to start a discussion:

SEVERITY = {"wrong_refund_policy": 3, "wrong_order_lookup_tool": 3,
            "ignored_date_in_question": 2, "answer_too_long": 1}
ranked = sorted(counts, key=lambda c: counts[c] * SEVERITY.get(c, 1),
                reverse=True)

For the delivery bot, the ranking could look like this:

Failure category Count Severity Score Action
wrong_order_lookup_tool 8 3 24 Fix the tool description in the prompt, measure again
wrong_refund_policy 6 3 18 Put the policy text into the context
ignored_date_in_question 7 2 14 Consider building an evaluator
answer_too_long 11 1 11 One line of instruction in the prompt

The most frequent category comes last, which is why frequency alone makes a poor ranking.

The final column applies Langfuse’s rule: fix first, and do not build an evaluator for a failure that a prompt can solve. An evaluator is worth the investment only when the failure persists after your fix and needs long-term monitoring.

Common mistakes

In notes from a talk by Husain, Alex Strick van Linschoten lists three common mistakes. The first is skipping the loop: finishing axial coding and never returning to open coding. Once you have categories, you read traces with different eyes and often find some that need to be split or merged.

The second is shutting out domain experts. You may not notice that an answer about refund terms is wrong, but the company’s customer service staff will spot it at once. The third is automating too early: setting up an LLM-as-judge before you have understood the failures with your own eyes.

Applying this at a client

At a client site, schedule the error analysis session in the first week and invite the person in charge of operations to score severity with you. The finished ranking becomes a plan both sides have agreed on, in place of a list of requests with no order of priority.

For your career, look out for phrases such as “evals”, “trace review” or “failure analysis” when you read FDE job descriptions.

On your résumé, instead of “improved chatbot quality”, say that you labeled N traces, identified K failure categories and cut the failure rate of the top category after fixing the prompt.

A before-and-after figure on the same set of traces is evidence a hiring manager understands immediately.

The next time someone proposes a quality dashboard, open 30 traces and read them first. The best dashboards are built on failure categories you have named by hand.

Was this article useful?

Use with your AI assistantAsk Claude ↗Ask ChatGPT ↗
5 sources
Read next on the roadmap · Stage 6: MeasurementClients forgive a missed eval more readily than a surpriseWhen an agent scores 81% instead of the promised 90% just before a demo, the groundwork laid at kickoff and the options you bring decide the outcome.