<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>codebooks | Andy Halterman</title>
    <link>/tag/codebooks/</link>
      <atom:link href="/tag/codebooks/index.xml" rel="self" type="application/rss+xml" />
    <description>codebooks</description>
    <generator>Source Themes Academic (https://sourcethemes.com/academic/)</generator><language>en-us</language><lastBuildDate>Tue, 14 Jul 2026 08:21:31 +0000</lastBuildDate>
    <image>
      <url>/images/icon_huab4d5c2e03caf9fcc48bdbc9f32aea05_939897_512x512_fill_lanczos_center_2.png</url>
      <title>codebooks</title>
      <link>/tag/codebooks/</link>
    </image>
    
    <item>
      <title>What codebook is your LLM using?</title>
      <link>/post/implicit-llm-codebooks/</link>
      <pubDate>Tue, 14 Jul 2026 08:21:31 +0000</pubDate>
      <guid>/post/implicit-llm-codebooks/</guid>
      <description>&lt;p&gt;At ACL last week, 
&lt;a href=&#34;https://kakeith.github.io/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Katie Keith&lt;/a&gt; and I presented a 
&lt;a href=&#34;https://aclanthology.org/2026.acl-long.92/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;paper, &amp;ldquo;What is a protest anyway?&amp;quot;&lt;/a&gt; that argues that conceptualization&amp;mdash;defining what your labels like &amp;ldquo;protest&amp;rdquo; mean before getting an LLM to annotate your documents&amp;mdash;is still absolutely critical. Take, for example, this sentence:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;ldquo;Upset about the election results, a group of angry youth smashed the windows of local businesses.&amp;rdquo;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Is this a protest? In everyday usage, this probably is. And if you ask an LLM to classify it as a protest or not, it will happily return PROTEST or NOT_PROTEST. However, we argue that classifying documents in this way, using bare labels like &amp;ldquo;PROTEST&amp;rdquo; causes serious measurement problems.&lt;/p&gt;
&lt;p&gt;Rich social science concepts like &amp;ldquo;protest&amp;rdquo; are rightly defined in quite different ways: a project investigating the success of large-scale peaceful mobilization would want to exclude the story above from its set of protests, while a project on the early warning indicators for political violence might want to include it in its definition of protest. These detailed, project-specific definitions are usually written in codebooks that can range from a paragraph or two to hundreds of pages. And indeed, different existing codebooks in social science have definitions of protest that would either include or exclude that example:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;protest_codebook_aspects.png&#34; alt=&#34;Existing social science definitions of &amp;ldquo;PROTEST&amp;rdquo; disagree widely on different aspects of protests (Figure 2, Halterman and Keith 2026)&#34;&gt;
&lt;strong&gt;Figure 1&lt;/strong&gt;: &lt;em&gt;Existing social science definitions of &amp;ldquo;PROTEST&amp;rdquo; disagree widely on different aspects of protests (Figure 2, 
&lt;a href=&#34;https://aclanthology.org/2026.acl-long.92/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Halterman and Keith 2026&lt;/a&gt;)&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Our paper&amp;rsquo;s main arguments are that there are no &amp;ldquo;correct&amp;rdquo;, universal definitions of concepts, that any social science concept requires a carefully written and explicit definition of what&amp;rsquo;s included or not based on their measurement problem, and that LLMs can tempt researchers into skipping this step because they&amp;rsquo;re so good at generalizing from minimal instructions. Moreover, an incomplete definition of the concept cannot be corrected using new bias correction techniques such as 
&lt;a href=&#34;https://www.science.org/doi/10.1126/science.adi6000&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;PPI&lt;/a&gt; or 
&lt;a href=&#34;https://naokiegami.com/paper/dsl.pdf&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;DSL&lt;/a&gt;, if the gold standard labels themselves are produced using a flawed codebook. I encourage you to go read the 
&lt;a href=&#34;https://aclanthology.org/2026.acl-long.92/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;paper&lt;/a&gt;!&lt;/p&gt;
&lt;h2 id=&#34;but-what-codebook-do-llms-implicitly-apply&#34;&gt;But what &amp;ldquo;codebook&amp;rdquo; do LLMs implicitly apply?&lt;/h2&gt;
&lt;p&gt;A natural followup question that someone asked at ACL is what implicit definitions of a &amp;ldquo;protest&amp;rdquo; do LLMs actually use? If LLMs are not told which definition of protest to apply and are just asked &amp;ldquo;Classify as PROTEST or NOT_PROTEST&amp;rdquo;, which definition of protest do they actually implicitly use?&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
&lt;h3 id=&#34;setup&#34;&gt;Setup&lt;/h3&gt;
&lt;p&gt;To probe an LLM&amp;rsquo;s implicit definition of protest, we can run some simple experiments. We can write different vignettes to probe aspects of a protest definition then ask an LLM to classify whether it is a protest.&lt;/p&gt;
&lt;p&gt;For example, codebook definitions of protests apply very different thresholds for the number of participants required for something to count as a protest. ACE requires &amp;ldquo;a large number&amp;rdquo;, ACLED requires 3+, CAMEO implicitly has no threshold, and CCC explicitly has no size limit.&lt;/p&gt;
&lt;p&gt;To probe this behavior, we can prompt an LLM with:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-text&#34;&gt;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.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If the LLM returns YES, then it&amp;rsquo;s (implicitly) applying a definition closer to CAMEO or CCC that do not have size requirements, and a NO is closer to ACE or ACLED, which require more than one participant for something to count as a protest.&lt;/p&gt;
&lt;p&gt;We can repeat this for other vignettes testing the aspects listed in the table above across different LLMs, including large commercial LLMs from Anthropic and OpenAI, large open weight models such as GLM, and smaller, open weight models that you can run locally. These are an ad hoc collection of models, and note that for closed weight models, the behavior of the model can 
&lt;a href=&#34;https://arthurspirling.org/documents/BarriePalmerSpirling_TrustMeBro.pdf&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;change if you come back to it later&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Finally, we can get an approximate continuous estimate of a model&amp;rsquo;s confidence by looking at the token probabilities for the answers or repeatedly sampling $k=10$ labels with non-zero temperatures from the closed weight models.&lt;sup id=&#34;fnref:2&#34;&gt;&lt;a href=&#34;#fn:2&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;2&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
&lt;h3 id=&#34;results&#34;&gt;Results&lt;/h3&gt;
&lt;p&gt;Because we&amp;rsquo;ve prompted the LLM to classify documents without providing a codebook or definition to specify  what we mean by &amp;ldquo;protest&amp;rdquo;, each LLM has to generalize to what the entire scope of the idea of &amp;ldquo;protest&amp;rdquo; is from a bare label. To understand which definition of protest each LLM is implicitly applying, we can compare its label on constructed examples against what each of the four codebooks would say about each class.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;comparing-llm-codebook-definitions.png&#34; alt=&#34;Two side-by-side heatmaps comparing protest definitions. The left panel shows how four expert codebooks (ACE, ACLED, CAMEO, CCC) label fourteen scenarios as yes, no, or unclear; the right shows each of nine LLMs&amp;rsquo; probability of calling the same scenario a protest. Models agree on clear cases like canonical protests and non-events but diverge sharply on contested cases such as violence by participants, vigils, and diplomatic protests.&#34;&gt;
&lt;strong&gt;Figure 2&lt;/strong&gt;: &lt;em&gt;How do LLMs score different aspects of protest?&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;First, the LLMs (ordered very roughly by capability) are fairly consistent in how they annotate many aspects of protest. All correctly classify the canonical protest vignette (&amp;ldquo;About two thousand people marched through the capital&amp;rsquo;s main square on Saturday, chanting slogans and carrying banners denouncing the government&amp;rsquo;s handling of the crisis.&amp;quot;) and the obvious non-protest vignette (&amp;ldquo;The city council met on Tuesday evening to review the proposed annual budget, hearing presentations from the finance department before adjourning without a vote.&amp;quot;). And you can identify some commonalities across models (the biggest four models all exclude vigils, most models exclude demonstrations in support of a policy, all models include labor strikes, etc). And note that the original codebooks disagree on whether to include these or not!&lt;/p&gt;
&lt;p&gt;But the main takeaway is that different models employ different implicit definitions, so it&amp;rsquo;s challenging to identify &amp;ldquo;the implicit LLM codebook&amp;rdquo; that all share. At most, the models seem closest to applying a fairly standard dictionary-type definition like 
&lt;a href=&#34;https://en-word.net/lemma/protest&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Wordnet&lt;/a&gt;&amp;lsquo;s &amp;ldquo;a public (often organized) manifestation of dissent&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;To return to our original question: a researcher who uses Sonnet 5 to annotate documents will obtain a dataset that &lt;em&gt;excludes&lt;/em&gt; violent protest, while a researcher using the same prompt with GPT-4o will obtain a dataset that &lt;em&gt;includes&lt;/em&gt; violent protests. And in neither case will the coding rules be explicitly documented somewhere, and any substantive results that the researcher obtains from these datasets will be dependent on an opaque, implicit concept of protest employed by the LLM.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The most common protest dataset is least reflected in LLM coding&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;What happens if you just take an LLM&amp;rsquo;s answers as-is? Which codebook is it closest to? We can construct a rough agreement measure by taking the proportion of categories where the LLM&amp;rsquo;s answer matches each codebook&amp;rsquo;s answer.&lt;sup id=&#34;fnref:3&#34;&gt;&lt;a href=&#34;#fn:3&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;3&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;llm-codebook-alignment.png&#34; alt=&#34;Heatmap showing how closely each of nine LLMs&amp;rsquo; implicit protest concept matches four expert codebooks, measured as the percentage of scenarios where labels agree. Agreement is highest with CAMEO (75 to 83 percent) and lowest with ACLED (43 to 64 percent), so no widely used codebook is well reflected in the LLM annotations.&#34;&gt;
&lt;strong&gt;Figure 3&lt;/strong&gt;: &lt;em&gt;Rough congruence analysis: what percentage of LLM answers align with each codebook&amp;rsquo;s definitions?&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Although ACLED is perhaps the most widely used international dataset of protests, its definitions are not well reflected in any of the LLM annotations. CAMEO, in contrast, is the closest, but still differs from most LLM annotations in about 1 out of 5 aspects.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Minor prompt variations shift which implicit codebook is being used&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;All of the results above use the same prompt: &amp;ldquo;Is this a protest? Answer with a single word, YES or NO.&amp;rdquo; It&amp;rsquo;s very well known that LLMs are sensitive to slight variations in prompts. Do minor prompt variations change which &amp;ldquo;codebook&amp;rdquo; is implicitly being used?&lt;/p&gt;
&lt;p&gt;We can check this by re-running the analysis above with two new variants of the same prompt:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&amp;ldquo;Does the following text describe a protest? Answer with a single word, YES or NO.&amp;rdquo;&lt;/li&gt;
&lt;li&gt;&amp;ldquo;Classify the following document as PROTEST or NOT_PROTEST. Respond with only the label.&amp;rdquo;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;What we find is the expected instability in output, which, in this situation, means instability in the implicit definition that&amp;rsquo;s being applied.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;codebook_llm_prompt_variance.png&#34; alt=&#34;Heatmap of how much each answer shifts when the protest question is reworded, across nine LLMs and fourteen protest scenarios. Most cells show near-zero change, but ambiguous cases like violence by participants, sports-riot violence, vigils, and formal diplomatic protests swing by up to 1.0 for models including Claude Sonnet 5 and Gemma 3, showing the label can flip with trivial rephrasing.&#34;&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Figure 4&lt;/strong&gt;: &lt;em&gt;How do LLMs&amp;rsquo; answers change as you vary the prompt between three variations of the task prompt? The values shown are the maximum difference in answer probability across the three prompts.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Whereas before, Sonnet 5 always &lt;em&gt;excluded&lt;/em&gt; events where protestors were committing violence, giving it an alternative prompt can switch its behavior to often &lt;em&gt;including&lt;/em&gt; violent protests (0-0.80). Something about the alternative framing of the prompt, which seem substantively identical, makes it switch from an implicit ACLED definition to an implicit ACE/CAMEO/CCC-type definition.&lt;/p&gt;
&lt;p&gt;So not only are LLMs given bare class labels implicitly picking a definition to apply, the definition they use can also flip with seemingly irrelevant rewrites of the prompt.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Lexical shortcut&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Our earlier 
&lt;a href=&#34;https://www.cambridge.org/core/journals/political-analysis/article/codebook-llms-evaluating-llms-as-measurement-tools-for-political-science-concepts/7B323A0E47F782F2698A0AE849EA00DE&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&amp;ldquo;Codebook LLMs&amp;rdquo; paper&lt;/a&gt; found that earlier generations of LLMs tend to anchor their labels on keywords that are present in the text. We see the same behavior in these nine models. I wrote an example of a document that does not meet the definition of protest in any of our four codebooks, but does include the word &amp;ldquo;protest&amp;rdquo;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;ldquo;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.&amp;rdquo;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Almost all models (with the exception of GPT-4o) coded this as a protest, while most researchers of political mobilization and protest would not be interested in formal diplomatic complaints.&lt;/p&gt;
&lt;h2 id=&#34;theres-no-escaping-conceptualization&#34;&gt;There&amp;rsquo;s no escaping conceptualization&lt;/h2&gt;
&lt;p&gt;The figures above are not meant to show that LLMs are &amp;ldquo;bad&amp;rdquo; at classifying protest. Instead, the point is that abdicating your role of carefully defining what you want the LLM to classify means that the LLM falls back on a sense of the bare label it learned during pretraining. An LLM&amp;rsquo;s implicit &amp;ldquo;codebook&amp;rdquo; comes from the pretraining and post-training data it sees, which are shaped by the (human) decisions made at each company. In almost all cases, those decisions and data are hidden from the user of the LLM. Here, that&amp;rsquo;s something that looks sort of similar to the Wordnet dictionary entry. So the model will always use a definition: you just want it to be explicit instead of implicit, and your definition instead of the definition learned from pretraining.&lt;/p&gt;
&lt;p&gt;We&amp;rsquo;ve used protests as a running example here, but the same concerns apply to other concepts. For instance, asking an LLM to score a political manifesto on a left-right ideology scale has the same issue: you&amp;rsquo;re relying on the LLM&amp;rsquo;s implicit definition of ideology, rather than the sense that you want to measure.&lt;/p&gt;
&lt;p&gt;If you&amp;rsquo;re interested in why incomplete codebooks can&amp;rsquo;t be fixed downstream, the 
&lt;a href=&#34;https://aclanthology.org/2026.acl-long.92/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;ACL&lt;/a&gt; paper has details on that. And if you&amp;rsquo;re interested in what LLMs actually do with complete codebooks and how to know if an LLM is following the codebook instructions, our earlier 
&lt;a href=&#34;https://www.cambridge.org/core/journals/political-analysis/article/codebook-llms-evaluating-llms-as-measurement-tools-for-political-science-concepts/7B323A0E47F782F2698A0AE849EA00DE&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;em&gt;Political Analysis&lt;/em&gt; article&lt;/a&gt; is about that.&lt;/p&gt;
&lt;p&gt;So, tl;dr: if you&amp;rsquo;re asking an LLM to label documents, tell it what you mean by the label. And if you don&amp;rsquo;t, it will use an implicit definition that might not reflect your concept and that varies across models and minor prompt variations.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Acknowledgements: Thank you to Katie Keith for comments on a draft of this post.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;To get future blog posts in newsletter form, you can sign up here:&lt;/em&gt;&lt;/p&gt;
&lt;iframe src=&#34;https://andyhalterman.substack.com/embed&#34; width=&#34;100%&#34; height=&#34;120&#34; style=&#34;border:1px solid #EEE; background:white;&#34; frameborder=&#34;0&#34; scrolling=&#34;no&#34;&gt;&lt;/iframe&gt;&lt;section class=&#34;footnotes&#34; role=&#34;doc-endnotes&#34;&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id=&#34;fn:1&#34; role=&#34;doc-endnote&#34;&gt;
&lt;p&gt;Our earlier 
&lt;a href=&#34;https://www.cambridge.org/core/journals/political-analysis/article/codebook-llms-evaluating-llms-as-measurement-tools-for-political-science-concepts/7B323A0E47F782F2698A0AE849EA00DE&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&amp;ldquo;Codebook LLMs&amp;rdquo; paper&lt;/a&gt; looks at how LLMs follow (or don&amp;rsquo;t) the instructions provided to them in codebooks, but doesn&amp;rsquo;t try to reverse engineer the implicit definition an LLM uses. &lt;a href=&#34;#fnref:1&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id=&#34;fn:2&#34; role=&#34;doc-endnote&#34;&gt;
&lt;p&gt;Technical note: for the smaller open-weight models, I set temperature=0 and look at the log probabilities for the token labels. The models I access through API, such as Claude, GPT, and the (open weight but very large) GLM-5.2, do not expose the token probabilities. Instead, I generate multiple ($k=10$) responses with temperature=1 and average the responses. GPT-OSS, which I run locally, requires temperature&amp;gt;0 for the (required) &amp;ldquo;thinking&amp;rdquo; step before answering, so I also apply the sample multiple sample and average approach. This means that the probabilities across the techniques aren&amp;rsquo;t directly comparable, but we can still get a rough sense of model &amp;ldquo;confidence&amp;rdquo;. &lt;a href=&#34;#fnref:2&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id=&#34;fn:3&#34; role=&#34;doc-endnote&#34;&gt;
&lt;p&gt;This doesn&amp;rsquo;t account for the frequency of these aspects or the importance of each and is dependent on the specific wording of each example. But this is a blog post, not &lt;em&gt;Political Analysis&lt;/em&gt;! &lt;a href=&#34;#fnref:3&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/section&gt;
</description>
    </item>
    
  </channel>
</rss>
