PRACTITIONERCHAPTER 13

LLMs in data work: evals, extraction and text as data

A model that labels text is a measuring instrument, so calibrate it before you count with it: build the labelled set, read the error by slice, and decide what the labels may be used for

40 MINDATA AND MLUPDATED 2026-11-21
PREDICT

The model labels complaints and scores 93% on 300 hand-labelled cases: 150 in English, 90 in Pidgin and 60 in Yoruba. A colleague says: 93% accurate, so every count of a complaint reason is about 7% off, and we can live with that. What is the best reading?

Text is the part of a company’s data that most teams never analyse, because counting it used to need people to read it. A language model changes the cost. It does not change the question an analyst has to ask of any instrument: how wrong is it, in which direction, and does that matter for the decision? This chapter is about that question for text. The tools come from the AI Engineering course. How to constrain a model to return a fixed shape is in structured output, how to build and trust a labelled set is in building an eval set, and how to grade free text with a second model is in LLM as judge. Here you learn the data scientist’s angle: the label is an input to an analysis, so what matters is how its errors bend the number you report.

The model is an instrument, not an analyst

An AI engineer ships a feature that talks to customers. A wrong output is a wrong reply, and the job is to stop it happening. The chapter on the eval set before the feature covers that job, with hard slices where a wrong action is never allowed. Your use is different. You run the model over thousands of messages, keep the labels, and put counts in front of people who decide things. A wrong label is not a wrong reply to one customer. It is a small bias in a table.

Treat the model the way you would treat a survey question or a sensor. Three consequences follow.

  • It needs a calibration set. Hand-labelled cases, drawn on purpose, against which you measure it.
  • Its error has a shape. What matters is which reasons are confused with which, in which language, not only how often.
  • Its output is not data until you have said what it may be used for. A label good enough to rank reasons may not be good enough to route a complaint.

Researchers who use models as annotators say much the same. The review by Ziems and colleagues of language models in computational social science reports that on taxonomic labelling tasks zero-shot models fail to beat the best fine-tuned models but reach fair agreement with people, and concludes that models can work alongside people in the analysis. Read it in the reading list. The caution applies to you for a plainer reason: your messages are not in a benchmark.

Define the extraction before you run it

Every extraction starts with a codebook, a written definition of what is to be pulled out and how. It is the text equivalent of the metric definitions the track covers in metric definitions and a single source of truth. Emmanuella’s has these parts.

  • The fields. For each complaint: one primary reason from a fixed list, and the language. Nothing else, because every field is a thing to measure.
  • The reasons. Eight values for Kolanut: recharge failed, data not working, bundle not activated, balance deducted, agent overcharged, SIM swap or lost SIM, number problem, and other. Each has a one-line boundary. Balance deducted means money left the balance with no service delivered. Agent overcharged means the trader paid an agent more than the price.
  • The rule for several reasons. A message often has two. Pick the one the customer asks to have fixed, and say so in the codebook.
  • The escape value. Keep other and track its share, as the structured output chapter explains: it absorbs uncertainty, and a new kind of complaint lands there before anyone names it.

Settle the codebook with the person who will use the ranking, the way you settled the question in asking the right question. If the head of customer care wants to act on agent conduct, agent overcharged must be its own reason. If it is folded into balance deducted to keep the list short, the whole exercise is blind to what she cares about.

The model call then returns a small object with the reason from the list and a short evidence quote from the message, using the schema techniques in the course. The quote is cheap and useful: it lets a person check a label in seconds, and it shows which words the model leaned on.

Build the set to be sliced

The 300 hand-labelled cases are the instrument’s calibration. Four choices decide whether they are worth having.

Sample by slice. Kolanut’s traffic is about 45% English, 35% Pidgin and 20% Yoruba (illustrative). A random 300 would hold about 135 English, 105 Pidgin and 60 Yoruba cases, and only a handful of any rare reason in a language. Emmanuella instead draws 150 English, 90 Pidgin and 60 Yoruba, and makes sure each reason appears in each language where it occurs, with the rare ones oversampled. The course chapter’s rule applies: design for risk, not for traffic. When you want one overall figure, you reweight to the traffic mix afterwards, by reason as well as by language if you oversampled reasons.

Label with people who know the language. Carmen, a customer-care agent who speaks all three, labels every case. A second agent labels them independently, without seeing hers or the model’s. They agree on 270 of 300 the first time, and the other 30 are settled by talking, with the rule that settled each written into the codebook. Two lessons sit in that. Agreement between careful people is about 90%, so the model is not being compared with a perfect answer. And the disagreements are where the codebook is vague; fix it there. The building an eval set chapter shows how to measure agreement beyond the raw percentage.

Keep a set you have not tuned on. Emmanuella writes the prompt on a separate 60 cases, and the 300 stay unread until the prompt is fixed. If you read the errors on the 300 and adjust the prompt to fix them, the 93% describes the prompt’s fit to those cases, and it will not repeat on new messages. This is the same trap as data leakage in a model you train yourself. When you do change the prompt later, change it against a new set and keep the old one for a before-and-after comparison.

Keep the people out of the model’s reach. Complaints contain phone numbers and sometimes names. Decide before the first call what leaves the building, redact what the task does not need, and read the vendor terms. The privacy and data protection chapter covers the engineering, and the track’s chapter on data governance returns to the policy.

Read the error, not the rate

Emmanuella runs the model on the 300 and gets 279 right: 93.0%. Then she splits it.

Slice Cases Right Rate 95% range (Wilson)
English 150 148 98.7% 95.3% to 99.6%
Pidgin 90 83 92.2% 84.8% to 96.2%
Yoruba 60 48 80.0% 68.2% to 88.2%
All 300 279 93.0% 89.5% to 95.4%

Weighted by the traffic mix, the overall rate is 0.45 × 98.7% + 0.35 × 92.2% + 0.20 × 80.0%, about 92.7%, so 93% is a fair overall figure. It is also the least useful number in the table. The Wilson range is a standard interval for a proportion, and it makes the point about size: with 60 cases, Yoruba could be anywhere from 68% to 88%, so you know it is worse than English and not by exactly how much.

Next, read the errors. There are 21: two in English, seven in Pidgin and twelve in Yoruba. She tabulates what each was labelled instead.

Slice The pattern Count
Pidgin Bundle not activated filed as data not working 4
Pidgin Filed as other 3
Yoruba Agent overcharged filed as balance deducted 7
Yoruba Filed as other 3
Yoruba Scattered 2

The Yoruba row is the finding. Ten of the 60 Yoruba cases are true agent overcharged cases, and the model gets three of them right. Seven are filed as balance deducted. Scale it to a month of about 400 Yoruba complaints and about 47 overcharging complaints (7 of 60, times 400) appear under another reason, in the one language where traders deal most with the agents who overcharge. The sample is small, so treat 47 as an order of magnitude, but the direction is clear and no random error would produce it. At Tier 2, with 1.1 million subscribers, the cost and model choice chapter puts complaints at about 30,000 texts a month, so the same confusion would be hundreds of misfiled complaints a month, and the weekly Yoruba sample would need to grow with it. It is a systematic confusion, so it biases the count, and the overall 93% cannot show it.

Two more reads belong on the same page. First, the share of other by language: a jump in one language suggests the model hedges there. Second, the cases where the model’s evidence quote does not support its label. You read these in an hour, with Carmen, and they tell you what to change.

What the labels may be used for

The last step is the one analysts skip. Write down the use, then ask whether the measured error is acceptable for that use.

Use What a wrong label costs Acceptable error
A monthly ranking of reasons for the operations meeting A reason ranked a place too low; a decision that rests on a gap, not a place A few per cent random; no systematic loss of a reason the meeting acts on
A count of one reason as a metric someone is judged on A person’s result is wrong Low, measured per slice, with the range reported
Routing a complaint to a team (a SIM swap to risk) One customer waits, or a fraud is missed Near zero for the high-stakes reason, so a person reviews it
Training another model on the labels The errors become the model’s Check the label noise before you train

For the ranking, 93% overall can be fine, as long as the Yoruba overcharging confusion is fixed or reported. For routing a SIM swap complaint, it is not fine whatever the overall rate. The same labels serve one use and not the other, which is why the use comes before the rate.

You also have an honest way to quote a count that came from model labels. Angelopoulos and colleagues call the idea prediction-powered inference. It supplements a small set of gold-standard data with a large set of model predictions to give valid confidence intervals, with no assumption about how the model works, and more accurate predictions give narrower intervals. The paper is in the reading list. In practice, the weekly sample you hand-check does two jobs: it monitors the model, and it lets you say the count is 240, give or take a stated range, not 240.

Text as data when you have no categories yet

Sometimes the reasons are not known. Then you do not start with a codebook. You embed the messages as vectors, as in embeddings and similarity, group the close ones, read a sample from each group, and name the groups yourself. The model helps you see structure; it does not decide what the categories are. Once you have named them, you are back to the earlier sections: a codebook, a labelled set, a measured error.

Two cautions. A language model’s summary of 500 messages is for reading, not counting: it reports what stood out, and it may smooth over the rare reason you needed. And a model asked to grade other model output is a judge, with its own biases, which LLM as judge shows how to measure against human labels.

Where practitioners disagree

Model labels or a trained classifier. A small classifier trained on a few thousand human labels is cheaper to run at volume and its errors are easier to characterise. A language model needs no training data to start and handles new reasons by changing the prompt. Teams with stable categories and large volume tend to move to a classifier. Teams with shifting categories and small volume stay with the model. The labelled set pays for either choice.

Models as annotators, or humans only. One view, which the Ziems review partly shares, is that models can do the bulk of annotation if people check them. The other is that for subjective or high-stakes labels only people should decide. Both agree on measuring against human labels. Where they differ is how much weight a model label gets when no person is looking.

Does it work in our languages. Benchmarks for African languages, such as IrokoBench, report a large gap between high-resource languages and African languages for the models they tested. A benchmark is a reason to check, not a number for your data, because your messages are short, code-mixed and full of local words. Measure it on your own text.

Where it goes wrong

One number for the whole set. The 93% that hid the Yoruba confusion. Always report by slice, and by reason.

Tuning on the evaluation set. The model gets better at your 300 and no better at next month’s messages.

A set that is not drawn on purpose. The first 300 messages of the month, or the ones agents flagged, are not a sample of the data.

Treating other as a rest category. It is where the new problem, and the hedging model, hide.

A silent model change. The vendor updates the model, the labels shift, and a month-on-month trend moves for a reason that is not about customers. Pin the version and rerun the set when it changes; monitoring quality in production, in the AI Engineer track, covers the same discipline for a feature.

Labels with no owner. Nobody reads the weekly sample, and the drift is found by a customer.

Day to day

Before the first run, write the codebook with the person who will use the ranking, draw the calibration set by slice, and have two people label it. Most of the time is other people’s, so book them early.

Each time you change the prompt or the model, run it on the development cases first, then once on the held-out set, and record the version, the date and the table by slice. Do not read the held-out errors until the prompt is fixed.

Weekly, draw a sample by slice from the week’s labels, have Carmen or a colleague check it, and add the result to a running table. Read every miss in the slices you worry about.

Monthly, publish the ranking with the error by slice next to it, and say what the labels may and may not be used for. Review the share of other and the list of reasons with the customer-care lead, and add a reason when a pattern in other has a name.

When the vendor changes the model, rerun the whole calibration set before the new version touches production, and compare it case by case with the old.

Quarterly, replace part of the calibration set with fresh messages, ask a second person to relabel a sample, and ask whether the use you wrote down is still the use.

BY ORG SIZE
STARTUPunder 30 people

There is no data team, perhaps one analyst. The model is the only way to read the messages at all, and the calibration set is 100 cases labelled by the analyst and one colleague over an afternoon. Keep it, because a figure you never measured will be believed. Use the labels for a monthly ranking and read the weekly sample yourself. The aim is a known error, not a perfect one.

SCALE-UP30 to 300

Several teams want text labelled: customer care, product, risk. The failure is five prompts and five codebooks that call the same complaint different things. Put one codebook and one calibration set per task under an owner, version them, and write a one-line use statement for each. A shared labelling budget begins to make sense, because the same bilingual people are asked by everyone, and their time becomes the constraint.

ENTERPRISE300 and up

Procurement, security and legal are in the loop before the first call to a model. The work is as much governance as analysis: which data may leave, which vendor, who signs a label that affects a customer. Calibration sets and error tables become audit evidence, so keep them versioned with dates. A central group owns the platform and the standard tests, and the business teams own the codebooks and the sampling.

ARTEFACT Write an extraction spec with its measured error ~50 MIN
YOU PRODUCEAn extraction task with an eval set and a measured error rate

Template

# Extraction spec: <task>
Owner · Date · Model and version · Prompt version

## Use of the labels
What decision this feeds, who uses it, and what a wrong label costs.
Acceptable error for this use, stated before the run:

## Codebook
| Field or value | Definition (one line) | Boundary with the nearest value |
|---|---|---|
Rule when a message has more than one: <rule>

## The eval set
Source and how cases were drawn: <by slice, not by traffic>
| Slice | Cases | Why this many |
|---|---|---|
Labellers (roles) and first-pass agreement: <n of N>; how disagreements were settled:
Development cases (not in the set), and the date the set was last read:

## Result (model, version, date)
| Slice | Cases | Right | Rate | 95% range |
|---|---|---|---|---|
Largest confusion: <value A filed as value B, n cases, which slice>
Share of other by slice:

## Decision
Use the labels for: <uses>
Do not use the labels for: <uses>
What changes if the weekly check falls below the line: <action>

## Monitoring
Weekly sample (size, by slice), who checks, where results go. Rerun on model change.
How this could be wrong:
WORKED EXAMPLE

Kolanut Mobile, launch year. Emmanuella, the analyst, filled this in before the ranking went to operations.

Use of the labels. A monthly ranking of complaint reasons for the head of customer care. No complaint is routed or closed by a label. Acceptable error: a few per cent at random, and no reason the meeting acts on lost in one language.

Codebook. Eight reasons, with agent overcharged (a trader paid an agent more than the price) separated from balance deducted (money left the balance with no service). Two reasons in one message: use the one the customer asks to have fixed.

The eval set. 300 cases drawn by slice: 150 English, 90 Pidgin, 60 Yoruba, from a month of about 2,000 complaints. Two customer-care agents labelled independently and agreed on 270 of 300 (90%); the rest were settled by discussion and the rules written into the codebook. The prompt was written on a separate 60 cases.

Result. English 148 of 150 (98.7%), Pidgin 83 of 90 (92.2%), Yoruba 48 of 60 (80.0%): 279 of 300, 93.0%. Largest confusion: seven Yoruba overcharging complaints filed as balance deducted.

Decision. Use for the monthly ranking, with Yoruba reported as a range. Do not use for routing. A weekly sample of 35 (15 Yoruba, 10 Pidgin, 10 English), checked by Carmen. If Yoruba stays below 85% for three weeks, move Yoruba to human labels.

Now you

Kolanut’s agent-network team, in the launch year, receives free-text messages from market agents about voucher stock, such as “Recharge 200 finish for Bodija market”. A model extracts the market and the recharge amount, and the amount decides how many ₦100, ₦200 and ₦500 vouchers are ordered for each market. You are the analyst. One colleague hand-labelled 120 messages, the first 120 of the month, and nobody else has checked them. The model got the market right in 108 of 120 and the amount in 114 of 120. By language: English 60 messages (market 58, amount 59 right), Pidgin 40 (36, 38) and Yoruba 20 (14, 17). Five of the six amount errors are messages that give two amounts or write the amount in words. Write the extraction spec for this task, state what the figures can and cannot show, and decide what the extraction may be used for.

Self-check

DECIDE

Kolanut Mobile is in its launch year and gets about 2,000 complaints a month in English, Pidgin and Yoruba. A model labels the reason for each. On 300 hand-labelled cases it is right 93% of the time: English 98.7%, Pidgin 92.2%, Yoruba 80.0%, with the Yoruba errors mostly agent overcharging filed as another reason. The labels will feed a monthly ranking that the head of customer care takes to the operations meeting. No complaint is routed or answered because of a label. Emmanuella, the analyst, must say how the labels are used.

READING
  1. BOOK
    AI Engineering: Building Applications with Foundation Models Chip Huyen, 2025

    The standard practitioner text on evaluating model output, including model-graded evaluation and building an evaluation pipeline. Read it for the vocabulary you need to agree an evaluation plan with an AI engineer. Read: The two chapters on evaluation: Evaluation Methodology and Evaluate AI Systems.

  2. PAPER
    Can Large Language Models Transform Computational Social Science? Caleb Ziems, William Held, Omar Shaikh, Jiaao Chen, Zhehao Zhang and Diyi Yang, 2024

    A study of language models on the labelling tasks analysts do by hand. It finds fair agreement with human labels, not better than the best fine-tuned models, and concludes that models can work alongside people. Read: Computational Linguistics 50(1); the sections on classification tasks and the discussion of annotation.

  3. PAPER
    Prediction-Powered Inference Anastasios Angelopoulos, Stephen Bates, Clara Fannjiang, Michael Jordan and Tijana Zrnic, 2023

    Shows how a small set of gold-standard data and a large set of model predictions combine into valid confidence intervals. Read it to see why the hand-checked sample is more than monitoring. Read: The abstract and the introduction; the examples show the idea without the proofs.

  4. PAPER
    IrokoBench: A New Benchmark for African Languages in the Age of Large Language Models 2024

    A published benchmark of African languages that reports a large gap with high-resource languages for the models tested. It is the reason to measure per language on your own text, not a figure to quote for it. Read: The abstract and the results discussion on the gap with high-resource languages.

  5. POST
    Your AI Product Needs Evals Hamel Husain, 2024

    The practitioner's case for evals built from your own data, and for treating the acceptable pass rate as a product decision. Useful when you must agree the acceptable error for a use with the person who owns it.

All companies and people in these examples are fictional. Any resemblance to a real business or person is unintended.

RECALL CARDS Tap to flip. They join your review deck when you mark the lesson complete.
NEXT: Data strategy and roadmap →