LLM主题标签不是观测值

TL;DR · AI 摘要
LLM生成的主题标签不是真实观测值,而是条件生成过程的输出,存在选择偏差、时间偏差、测量偏差和角色偏差四大问题,会导致下游因果分析产生误导性结果。
核心要点
- LLM生成变量存在四个偏差:选择偏差、时间偏差、测量偏差和角色偏差
- NULL填充将'未生成文本'错误合并到参考类别,改变了分析的人群定义
- 预处理阶段的假设会在连接表中变得不可见,影响因果推断准确性
结构提纲
按章节快速跳转。
LLM生成的主题标签不是客户属性的真实观测,而是应用于客户行为子集的生成过程输出。
选择偏差、时间偏差、测量偏差和角色偏差会同时出现在NULL填充操作中。
分析师通常隐式地将转录文本主题作为协变量处理,但控制变量的角色取决于其在因果图中的位置。
思维导图
用一张图看清主题之间的关系。
查看大纲文本(无障碍 / 无 JS 友好)
- LLM主题标签偏差问题
- 四大偏差类型
- 选择偏差
- 时间偏差
- 测量偏差
- 角色偏差
- 根本原因
- 生成变量本质
- 条件过程输出
- 解决方案
- 诊断方法
- 流程改进
金句 / Highlights
值得收藏与分享的关键句。
The column is not an observation of a customer attribute. It is the output of a generative process applied to a self-selected subset of customer behavior.
Themes from a call corpus are mapped to the customer table. Customers without transcripts receive NULL values, which are then filled with zero, "no issue mentioned," or quietly omitted as a reference category. In one step of preprocessing, the pipeline converts "did not call support" into "did not experience billing frustration."
The subsequent regression appears clean. The coefficient for "billing frustration" is significant, aligns with the product team's expectations, and is substantial enough to matter. It is included in a roadmap document, and no one questions where the variable came from.
This article discusses what is smuggled in with that fill value and explores three other seemingly innocuous moves in a notebook that rest on assumptions never named in the analysis. The setup isn't specific to support calls; it applies to chat logs, ticket summaries, product reviews, sales transcripts, and survey free-response fields—anywhere a modern pipeline transforms text into a tidy column. The pipeline could be a fine-tuned classifier, a zero-shot LLM, or an embedding-plus-cluster approach. The conceptual issue remains the same: the column isn't an observation of a customer attribute; it's the output of a generative process applied to a self-selected subset of customer behavior.
Practitioners increasingly treat these outputs as direct readings of customer state, which they are not. They are generated variables: measurements produced by a pipeline, conditional on a customer performing an action that left a textual trace, and conditional on that trace surviving the extraction model. Each step of this condition has implications for what the variable signifies in a downstream causal model, and most of these implications are invisible in the joined table.
Four Things Tend to Go Wrong, and the NULL Move Makes All Four Visible at Once
Selection: A theme exists for a customer because that customer called, complained, posted, or replied. Whatever drove that action is likely correlated with the treatment, the outcome, or both. The NULL fill collapses "did not generate text" into the reference category, and the analysis no longer estimates an effect over the entire customer base but over a redefined population, with the redefinition occurring during preprocessing.
Timing: Was the call before the treatment, during it, or after? Pre-treatment text can be a candidate confounder. Post-treatment text can be a candidate mediator or outcome, and treating it as a pre-treatment control is a classic source of post-treatment bias. The joined table rarely makes this visible.
Measurement: The label "billing frustration" isn't billing frustration itself; it's what the pipeline detected as billing-frustration-shaped language. Classifier accuracy is finite and can differ across treatment arms because a treatment that changes how customers talk also changes how the model interprets them. The label noise isn't orthogonal to the thing being studied.
Role: Is the theme acting as a confounder, a mediator, a treatment, an outcome, or a descriptive feature? The DAG (Directed Acyclic Graph) decides this, not the column name. A variable that is methodologically valid in one role can become a bias source in another.
These four problems aren't independent; they interact. An LLM-detected theme inherits a selection footprint from the channel it came through, a timing footprint from when the text was generated, and a measurement footprint from the pipeline that extracted it. The downstream regression sees a column of zeros and ones.
_The problem isn't that the pipeline produced a bad label; the problem is that the label inherited a data-generating process that the downstream analysis never modeled._
The rest of this article explores what this means in practice, where the standard workflow goes wrong, and what the minimum diagnostic looks like. We start with the role-and-timing question because it's the one analysts get wrong first.
Role and Timing Are the Same Question
The first implicit move an analyst makes with a transcript-derived theme is to treat it as a covariate. Themes go into the right-hand side of the regression. The treatment is the variable of interest, and the outcome is on the left. The theme is "controlled for."
The phrase "controlled for" is doing work the analyst hasn't checked. Controlling for a variable adjusts away the part of the treatment-outcome relationship that flows through it. Whether this adjustment helps or hurts depends entirely on where the variable sits in the causal graph, and that position is determined by timing.
Pre-treatment text, generated before the treatment was assigned, can act as a confounder. If a customer called about billing in January and the retention offer went out in March, the call captures something about the customer's state that may influence both who received the offer and who churned. Conditioning on the theme here can reduce bias from omitted variables, provided the theme actually proxies for the relevant construct and the selection issues in the next section are handled.
Concurrent text, generated as part of the treatment itself, isn't a covariate at all. If the treatment is a call from a retention agent and the theme comes from that same call, the theme is part of the intervention. Conditioning on it doesn't adjust for confounding; it removes part of the effect the analyst is trying to measure.
治疗后文本,在治疗后生成,是最危险的类别,因为它们最有可能被分析师错误地归类为混杂因素,尤其是当他们从没有时间索引的平面表中工作时。例如,一个客户在三月份收到了一个保留优惠,并在四月份打电话投诉,这次通话的转录反映了他们至少部分是对治疗的反应。对从这次通话中提取的主题进行条件处理,实际上是对治疗后的变量进行条件处理。这种操作可能会阻断中介路径、诱导碰撞关联,或者以其他方式改变估计量,使其偏离分析师认为正在估计的治疗效果。
一个实际的例子可以更清楚地说明这一点。考虑一个合成但业务现实的设置。客户基于一个捕捉价格敏感性的模型被选中接收保留优惠。优惠的分配和客户流失都取决于这个潜在的价格敏感性,而分析师并未观察到这一点。价格敏感性较高的客户更有可能收到优惠(因为目标模型选择了他们),并且无论是否收到优惠,他们更有可能流失。他们也更有可能联系支持并表达账单冲击。从这些治疗后通话中提取的主题包括“账单冲击”。
naive分析师将主题连接到客户表,将NULL填充为零,并运行一个逻辑回归,将流失作为优惠和账单冲击的函数:
import numpy as np
import pandas as pd
import statsmodels.api as sm
rng = np.random.default_rng(7)
n = 20000
price_sens = rng.normal(0, 1, n)
offer = rng.binomial(1, 1 / (1 + np.exp(-(0.8 * price_sens))))
churn = rng.binomial(1, 1 / (1 + np.exp(-(-1.0 + 1.2 * price_sens - 0.5 * offer))))
called = rng.binomial(1, 1 / (1 + np.exp(-(-1.5 + 0.7 * price_sens + 0.9 * churn))))
theme_prob = 1 / (1 + np.exp(-(-0.5 + 0.8 * price_sens)))
bill_shock = np.where(called == 1, rng.binomial(1, theme_prob), 0)
df = pd.DataFrame({"churn": churn, "offer": offer, "bill_shock": bill_shock})
X = sm.add_constant(df[["offer", "bill_shock"]])
naive = sm.Logit(df["churn"], X).fit(disp=0)
print(naive.params)优惠对流失的真实影响是-0.50的对数几率。优惠旨在减少流失,在数据生成过程中确实如此。以下是四种规格返回的结果:

图1. 同一数据,四种规格,四种不同的答案。
规格 | 优惠系数 | 说明 ---|---|--- 朴素(含账单冲击) | +0.12 | 优惠似乎有害 删除(不含账单冲击) | +0.24 | 优惠仍然似乎有害 预言机(含价格敏感性) | -0.55 | 优惠减少流失 真实效应(DGP) | -0.50 | 优惠减少流失
由于优惠分配已经受到价格敏感性的混淆,删除坏的控制变量并不能使设计变得有效。它只是去除了一个额外的失真源。从这张表中可以得出两个观察结果。
首先,朴素规格的方向是错误的。在已经存在偏差的模型中添加账单冲击控制翻转了优惠系数的符号。产品团队阅读这个输出会得出结论,保留优惠导致流失。但他们错了。
其次,删除账单冲击变量并不能修复分析。删除规格仍然是正的,只有预言机规格,直接条件于未观察到的混淆变量,才恢复了真实效应。在实际分析中,分析师没有这个列。这就是重点。删除坏的控制是必要的,但不够的,从自选呼叫子群体中提取的与治疗后文本相关的话题,并不能替代识别。
朴素规格中符号翻转的机制值得探讨。流失影响呼叫的可能性,因为即将离开的客户更可能打电话。账单冲击只有在客户打电话时才被观察到,因为主题需要有转录存在。对账单冲击进行条件处理因此是对流失的下游后果进行条件处理。在账单冲击等于一的客户中,优惠和价格敏感性之间的关系已经被扭曲,因为这两个变量现在有助于解释为什么客户被标记。优惠的系数吸收了这种诱导的关联。
这个方法论点具有普遍性。从文本中提取的变量在其因果图中的位置由文本生成的时间相对于治疗、生成文本的主体以及产生标签的过程决定。角色和时间是从不同角度看待同一个问题。这些变量带有分析师需要追踪的结构性足迹,而连接的表并不是追踪发生的地方。
选择问题
大多数使用支持转录的行业分析隐式地将人群从“客户”重新定义为“生成支持语言的客户”。回归甚至开始之前,估计量就已经改变了。
这是实践中工作流程中最重要的一部分,也是标准工作流程最脆弱的部分。
文本的存在是因为客户做了某事:打电话、发帖、投诉、回复。这件事是一种行为,而不是测量。它受到客户特征、可用渠道、潜在问题的紧迫性以及通常治疗本身的影响。这些都不是随机的。通常与结果不正交。
NULL处理决策是操作化的起点。常见的做法有三种,每一种都带有假设。
将 NULL 填充为零或“未提及问题”假设不生成文本是对潜在结构缺失的有信息量的表示。分析师声称未打电话的客户没有经历主题所检测到的构造。对于大多数值得检测的主题来说,这种假设在表面上是不合理的。未打电话的客户可能经历了账单烦恼,并通过取消服务、转而使用竞争对手、在社交媒体上投诉或放弃来解决这些问题。将 NULL 填充为零将所有这些情况都视为“没有烦恼”。
删除具有 NULL 主题的行,将分析限制在打电话的子群体中,至少是对人群诚实的,但它改变了估计的目标。打电话客户的治疗效果并非所有客户的治疗效果,而这两个之间的差异往往是业务问题的核心所在。对易流失呼叫者的保留优惠的效果是一个有用的量。但它通常不是分析声称估计的量。
将文本存在视为缺失机制并根据谁打电话的模型应用逆概率加权(IPW),在方法上是正确的一步。但关键是倾向性模型本身。建模谁生成文本需要写出驱动呼叫的因素,而这个模型依赖于人口统计、 tenure、先前的问题、治疗暴露以及未测量的烦恼,而这正是主题原本应该帮助测量的构造。IPW 步骤是原则性的,但它看起来往往并不那么原则性。
更深层次的观点是,进入文本的选择行为与治疗相互作用。保留优惠可能改变呼叫率。定价变化可能改变投诉率。功能发布可能改变客户表达问题的方式。这些任何一种情况都使得选择机制本身依赖于治疗,这意味着即使是最精确提取、最及时的主题,也是在一个人群上测量的,而这个人群的构成随着治疗的变化而变化。标准的观察校正假设选择机制是稳定的。当治疗影响选择时,这些校正就不适用了。
这并不意味着从转录中导出的变量是无用的。它意味着分析师欠读者一个明确的陈述,分析估计了哪个群体的效应,是什么机制产生了文本,以及对没有文本的每个人做出了什么假设。
测量问题
旧的 NLP 输出看起来很嘈杂。TF-IDF 权重、稀疏关键词计数、LDA 主题向量:它们都不像客户所感受的那样。从业者出于本能地不信任它们,而这种本能救了很多不良分析于水火。
LLM 输出并不嘈杂。它们看起来像潜在的构造。像“账单烦恼”、“信任侵蚀”或“续订焦虑”这样的标签读起来像是对客户心理状态的描述。这些标签表达清晰,类别在语义上是连贯的,失败模式在列中并不明显。说服问题在统计问题开始之前就已经存在了。
统计问题更为熟悉。LLM 主题是潜在构造的嘈杂代理。标签“账单冲击”不是账单冲击本身,而是模型决定在处理的转录中什么是账单冲击形状的语言。即使对于干净的任务,分类器的准确性也是有限的,而且在实际人群上,而不是在保留的评估集上,准确性往往是未知的。将嘈杂的代理直接插入回归中,代替真实的变量,在某些设置下会将系数衰减向零,在其他设置下会扭曲它们,这取决于噪声是否是差分的。
差分测量误差是真正损害所在之处。如果治疗改变了客户如何表达自己,而值得运行的大多数治疗都会这样做,那么分类器在主题检测上的准确性可能在治疗组和对照组之间不同。一个软化客户情绪的保留优惠可能降低模型标记“账单冲击”语言的速率,而没有减少潜在的烦恼。一个定价变化可能改变客户表达投诉的方式,在一个手臂上比另一个手臂更改变分类器的准确性。标签噪声不再均值为零。它与治疗相关,且根据嘈杂的标签进行条件反射会偏置估计的治疗效果,分析师很难确定其方向。
有关校正分类器引起的测量误差的文献是存在的。Egami 及其同事在《如何使用文本进行因果推断》(“How to Make Causal Inferences Using Texts”)一文中开发了一种分样本工作流,用于文本发现措施作为治疗或结果的因果推断。Mozer 及其同事在电子健康记录中应用了文本增强匹配,并在《利用电子健康记录中的文本数据进行因果推断》(“Leveraging text data for causal inference using electronic health records”)中展示了文本基线协变量如何改变真实医学研究中的估计效应。对于更广泛的景观,Keith、Jensen 和 O’Connor 在《文本和因果推断:使用文本从因果估计中去除混杂因素的回顾》(“Text and Causal Inference: A Review of Using Text to Remove Confounding from Causal Estimates”)中回顾了文本如何在各种应用中用于去除混杂因素。这些方法存在,并且当分析重要时值得使用。它们也需要分析师认识到标签是一种具有误差的测量,而这正是大多数工作流所跳过的步骤。
从业者错误不是使用标签。从业者错误是将来自生成模型的标签视为从传感器读取的列。
实践者检查表
使用从转录中生成的变量进行因果分析仍然可以是可辩护的。它只需要在回归运行之前回答五个问题。
1. 我假设这个变量扮演什么角色?
混杂因素、中介、治疗、结果或描述性特征。有向无环图(DAG)决定。列名无关紧要。
2. 文本是在治疗前、治疗中还是治疗后生成的?
治疗前、同时还是治疗后。如果分析师无法从数据中回答这个问题,该变量不作为混杂因素进入模型。
3. 产生文本的选择机制是什么?我对于那些没有文本的人做了什么假设?
零填充、删除、IPW:每种都是一个假设。选择一个并明确说明。
4. 标签是如何产生的?在不同治疗组中,其可靠性是否可能有所不同?
如果治疗可能影响客户表达潜在构造的方式,分类器的准确性在比较分析中可能不一致。
5. 在压力测试下,结果看起来如何?
在不使用从转录中导出的变量的情况下重新拟合模型。如果关键系数不稳定,结果不足以独自承载因果声明。
这五个问题并非解决方案,而是诊断工具。能够回答这些问题的分析师并不保证能识别出效应;无法回答的分析师则是在用因果语言进行描述性工作。
更广泛的趋势早于大语言模型(LLMs)。生成的变量是管道输出,看起来像观测值,但实际上是由选择条件的模型输出。它们出现在欺诈评分、推荐相关性指标、情感指数、重复使用的倾向得分作为协变量,以及任何由上游模型生成并被下游分析消费的潜在特征估计中。LLMs并没有发明这个错误;它们只是以 older NLP 输出从未达到的规模和流畅度使其普及。标签看起来像潜在构造,列看起来像测量值,工作流程看起来像因果推理。
_假设并没有消失,它们只是向上游移动了。_
专注于因果推理、实验和决策科学的工作人员数据科学家。我撰写关于将模糊的业务问题转化为决策分析的文章。
更多类似内容在 LinkedIn