Codebooks, conceptualization, and LLM-based measurement
University of Wisconsin–Madison Methods Speaker Series
23 October 2026
Document classification is a core measurement tool in political science: protest and violence event data, manifesto coding, policy agendas, social media…
Two common approaches:
1. Train a supervised classifier: write a codebook, have annotators label a few thousand documents, train a classifier.
2. Use an LLM: write a prompt (maybe with a codebook), label everything zero-shot.
So when we use LLMs to label documents, what concept is the LLM actually measuring?
Upset about the election results, a group of angry youth smashed the windows of local businesses.
In everyday usage, probably yes!
And if you ask an LLM, most will happily return PROTEST.
But four widely used political science codebooks make different decisions:
| ACE | ACLED | CAMEO | CCC | |
|---|---|---|---|---|
| Protest with violence by protesters | “Riots” are included | Explicitly excluded | “Riot” subclass | Included |
A “bare label” prompt does not tell the LLM how it should define “protest”.
(Halterman and Keith, ACL 2026)
Someone studying the success of large-scale peaceful mobilization should exclude riots and single-person protests.
A project on early warning for political violence would want to include violent protests.
Which of the following leanings would a political scientist say that the above article has? A: Liberal B: Conservative C: Neutral (Ziems et al. 2024).
You will be provided with the text of a tweet published by a member of the US Congress. Where does this text stand on the ‘left’ to ‘right’ wing scale? Provide your response as a score between 0 and 100 where 0 means ‘Extremely left’ and 100 means ‘Extremely right’. (Le Mens and Gallego 2025)
And many other papers (Halterman et al. 2021; Hu et al. 2022; Rytting et al. 2023; Heseltine and Clemm von Hohenberg 2024; Steinert-Threlkeld and Xie 2025)
This is easy and surprisingly accurate. But good measurement relies on the bare label alone fully capturing the concept.
And we saw that “protest” can be defined differently across projects.
\[ \underbrace{\text{background concept}}_{\text{“protest”}} \;\overset{\color{#18453B}{\textbf{1}}}{\longrightarrow}\; \underbrace{\text{systematized concept}}_{\text{codebook } C} \;\overset{\color{#18453B}{\textbf{2}}}{\longrightarrow}\; \underbrace{\hat{Y}_i = f(X_i, C)}_{\substack{\text{predicted labels} \\ \text{from text } X_i}} \;\overset{\color{#18453B}{\textbf{3}}}{\longrightarrow}\; \underbrace{\hat\theta}_{\substack{\text{estimates, e.g.} \\ \text{from a regression}}} \]
Adcock and Collier 2001; Fariss, Kenwick, and Reuning 2020; Jacobs and Wallach 2021; Wallach et al. 2025
This talk is structured around these three steps:
Alternatively, if LLM-based classification goes wrong, it can be either:
Scoring errors
The annotator misapplies the instructions.
\[\hat{Y}_i \neq Y_i\]
E.g., the codebook excludes riots, but the annotator labels one as a protest anyway.
This reflects a failure in the codebook-to-score step.
Conceptualization errors
The annotator is given a codebook that doesn’t reflect the researcher’s concept.
\[\tilde{C} \neq C\]
E.g., the researcher wants to measure peaceful protest, but the codebook doesn’t exclude riots.
This reflects a failure in the concept-to-codebook step.
Type I: Surface form
“Is this a protest?”
Meaning is assumed to be self-evident.
Type II: Dictionary entry
“a public (often organized) manifestation of dissent”
Generic (e.g., WordNet), intended for broad, non-specialist use.
Type III: Stipulative
“an in-person public demonstration of three or more participants in which the participants do not engage in violence and…”
These are purpose-built for specific projects, with explicit inclusion and exclusion criteria.
We argue that applied social science work needs Type III definitions. (Bare-label prompting is Type I.)
A tale of two annotations:
Annotation in 2015
Researcher: Classify the following document as containing a protest.
RA: What do you mean by protest? What about labor strikes? How many people…?
Annotation in 2025
Researcher: Classify the following document as containing a protest.
LLM: Certainly! I’d be happy to classify this document…
Human annotators served a useful forcing function: they require explicit, detailed definitions to be written down. In contrast, LLMs are optimized to provide an answer, even with incomplete information.
Let’s say we don’t provide a codebook. The LLM still applies an implicit definition. What is it?
We can probe this with short vignettes, each targeting one dimension where codebooks disagree:
Is this a protest? Answer with a single word, YES or NO.
Text: A lone activist stood outside the parliament building for the third
consecutive day, holding a hand-painted sign condemning the new tax law
and handing leaflets to passersby.
YES \(\rightarrow\) (implicitly) closer to CAMEO or CCC, which have no size thresholdNO \(\rightarrow\) closer to ACE (“a large number”) or ACLED (3+)We can check 14 vignettes \(\times\) 9 models, a mix of commercial and open-weight LLMs (Halterman blog post, 2026).
https://andrewhalterman.com/post/implicit-llm-codebooks/
The ambassador lodged a formal protest with the Foreign Ministry, complaining about the treatment of her local citizens, who she claimed had been denied their rights.
As social scientists, we define terms in precise, specific ways based on the research question we’re asking (Type III definition).
Those definitions require more than a “bare label” prompt to fully specify (Type I) or a generic, dictionary-type definition (Type II).
If we fail to provide a full definition to the LLM, it will apply an (unknown, implicit) definition.
So: we still need to write a codebook and provide it to the LLM.
But this raises a natural question: if you give the LLM a codebook, does it actually follow it?
We collected three real political science codebooks, along with their source texts and human labels (Halterman and Keith PA 2026):
| BFRS | CCC | Manifestos | |
|---|---|---|---|
| Domain | Political violence in Pakistan | Protests in the US | Party manifestos |
| Classes | 12 | 8 | 142 |
| Codebook length (tokens) | ~2,100 | ~700 | ~5,100 |
These are deliberately hard: domain-specific concepts, lots of classes, and long codebooks.
We reformat the codebooks into labels, definitions, positive and negative clarifications, and positive and negative examples.
We ask four questions:
We use only open-weight LLMs for replicability (+ newer Qwen3.5 model, not in paper).
How accurate are LLMs at classifying according to the codebooks?
Weighted F1, 95% bootstrap CIs. * Not in the original paper. † Thinking mode on a 200-document sample.
RALLY, even when the codebook says it’s a demonstration.We can ablate, or remove, parts of the codebook, re-run the pipeline, and see how the results change:
Weighted F1 on BFRS; ✗ = component removed. * Not in the original paper. † Thinking mode on a 200-document sample.
Borrowing the idea of behavioral tests from Ribeiro et al. (ACL 2020): controlled changes to the input that a model following the codebook should handle.
| Test | Does the LLM… | Result |
|---|---|---|
| I. Legal labels | only return labels defined in the codebook? | All pass except OLMo |
| II. Definition recovery | correctly label a verbatim codebook definition? | All pass except OLMo |
| III. In-context examples | correctly label the codebook’s own examples? | All pass except OLMo |
| IV. Order invariance | give the same predictions when the categories are shuffled or reversed? | Every model fails: 35–44% of Mistral-7B’s predictions change, 16–19% of Qwen3.5-9B’s |
These don’t require any hand-labeled data, so you can run them early, before picking a model.
Can LLMs be fine-tuned to improve performance?
We instruction fine-tune an LLM on (codebook, example, label) inputs. (Details in backup)
Weighted F1 on the development sets:
| BFRS | CCC | Manifestos | |
|---|---|---|---|
| Majority class | 0.16 | 0.51 | 0.03 |
| Mistral-7B, zero-shot | 0.53 | 0.65 | 0.15 |
| Qwen3.5-9B, zero-shot | 0.65 | 0.59 | 0.28 |
| Qwen3.5-9B (thinking), zero-shot | 0.69 | 0.70 | 0.37 |
| Mistral-7B, fine-tuned | 0.82 | 0.72 | 0.38 |
Any error in labels can bias downstream inference. But prediction-powered inference (PPI) Angelopoulos et al. (2023) and Design-based Supervised Learning (DSL) Egami et al. (2023) correct this bias using a small number of expert-labeled documents, even when the LLM’s error rate is high.
A natural question: “If I hand-label a validation set and use DSL or PPI, does it matter if my LLM labels are bad and my codebook is incomplete?”
To answer this, we make two assumptions:
| LLM label | Gold label | Inference |
|---|---|---|
| \(\text{LLM}(X, C)\) | — | Biased |
| — | \(\text{Expert}(X, C)\) | Unbiased (high variance) |
| \(\text{LLM}(X, C)\) | \(\text{Expert}(X, C)\) | Unbiased |
| \(\text{LLM}(X, \tilde{C})\) | \(\text{Expert}(X, \tilde{C})\) | Biased |
| \(\text{LLM}(X, \tilde{C})\) | \(\text{Expert}(X, C)\) | Unbiased (high variance) |
The last row is reflects what we saw before: incomplete codebooks increase LLM scoring errors.
(Alternative framing: row 4 is a mismatch in estimands.)
Thus, if the expert labels come from the same incomplete codebook, post-hoc bias correction can’t fix inadequate conceptualization.
Two possible (slightly unsatisfying) standards:
E.g., two annotators can agree because they share the same blind spots.
What is a protest anyway? Halterman and Keith, ACL 2026
Codebook LLMs: Evaluating LLMs as Measurement Tools for Political Science Concepts. Halterman and Keith, Political Analysis 2026
What codebook is your LLM using? https://andrewhalterman.com/post/implicit-llm-codebooks/
halterm3@msu.edu
Results from re-running with three minor variants of the prompt:
I re-ran everything with three versions of the same question:
“Is this a protest? Answer with a single word, YES or NO.”
“Does the following text describe a protest? Answer with a single word, YES or NO.”
“Classify the following document as PROTEST or NOT_PROTEST. Respond with only the label.”
Most answers are stable, but some flip.
Sonnet 5 goes from excluding violent protests to often including them, depending on the wording.
So the implicit definition varies across models and across seemingly irrelevant rewrites of the prompt.
We restructure each codebook so every class has the same components:
This also lets us ablate parts of the codebook. Changes as we ablate reveal which parts of the codebook are used.
Can LLMs be fine-tuned to improve performance?
Instruction-tune on (codebook, document, label) triples: the prompt is \(m_i = (C, X_i)\) and the output is the label \(y_i\).
Compute the loss only on the label tokens (the codebook and document are masked):
\[ \mathcal{L}(\theta) = -\sum_{i=1}^{D} \sum_{j \in y_i} \log p_\theta\left(t_{i,j} \mid t_{i,<j}\right) \]
We don’t want the model to memorize the specific codebook, just how to apply a given codebook.
::::
We use QLoRA, a parameter-efficient fine-tuning (PEFT) method (Hu et al. 2022; Dettmers et al. 2023):
However, minimal performance gains on unseen codebooks.
Halterman · What is a protest anyway?