LinkedIn 如何让智能体从错误中改进,并验证改动有效
原题An Agent That Fixes Its Own Mistakes - Saloni Gandhi & Ziwei Guo, LinkedIn
推荐理由LinkedIn 从生产轨迹诊断到留出集验证,分享智能体如何提出提示修改以及评估器自身怎样被人工校准。它揭示自动改进系统也会判断错误、诊断错误,帮助团队先建立可信反馈,再评测修改是否有效,理解上线审查、置信区间与回归验证为何要共同存在。
看前速览
LinkedIn 用递归改进流程生成了首个上线的提示词更新。为了让改动靠谱,团队先修正了评估标准和归因方式。
把打分和查原因拆开
第一层评估器给结果打分。第二层按失败维度聚类并诊断,合并相似原因,再按发生频率排序。
用人工分歧改进评分标准
看起来合理的职位名称可能漏掉关键证据。格式差异不应被当成语义错误,部分正确的输出也需要明确的给分规则。
验证改动,也验证评估器
候选改动先经验证,再用留出集测试。上线保留人工审核,同时用多数投票降低评估波动,并补足归因标签。
完整摘要
Ziwei Guo 和 Saloni Gandhi 介绍了改进用户理解智能体的七个步骤,从收集执行轨迹,到提出修改、验证候选项,再用留出集测试。第一层评估器给输出打分,第二层诊断失败原因,再据此提出改动。团队复核约 180 到 200 个案例,发现评估器有时过于苛刻,对证据的处理不一致,归因标签也无法表达「评估器自己判错了」。修订规则后,评估器与人工判断的一致率从 57% 升至 64%。第一个优化改动经过人工审核和量化验证后上线。
章节
文字稿
简要描述Brief Description
LinkedIn 的 Ziwei Guo 和 Saloni Gandhi 介绍了一种工作流程:从生产环境跟踪记录中学习,并为用户理解代理提出提示词修改建议。该案例研究展示了这一工作流程如何贯穿评估、诊断和验证,直至首次经人工审核的生产环境变更。LinkedIn's Ziwei Guo and Saloni Gandhi describe a workflow that learns from production traces and proposes prompt changes for a user-understanding agent. The case study follows the workflow through evaluation, diagnosis, validation, and its first human-reviewed production change.
目录Table of Contents
- 这里所说的递归式自我改进意味着什么What recursive self-improvement means here
- 从生产环境跟踪记录到拟议编辑From production traces to a proposed edit
- 人工审核揭示了评估器中的问题What human review exposed in the evaluators
- 衡量采用情况并共享基础设施Measuring adoption and sharing the infrastructure
这里所说的递归式自我改进意味着什么What recursive self-improvement means here
郭子玮:我们围绕目标 AI 系统构建递归式自我改进(RSI)。对于 LinkedIn 的职业发展智能体,这一循环始于日常开发或生产环境追踪中发现的问题。评估引擎负责识别问题并提供反馈,随后这些反馈会指导系统改进。评估必须客观,并与用户反馈保持一致,因为它能告诉我们瓶颈在哪里,以及下一步该做哪些改动。Ziwei Guo: We build recursive self-improvement, or RSI, around a target AI system. For LinkedIn's career agent, the loop starts with issues found during daily development or in production traces. An evaluation engine identifies problems and gives feedback. That feedback then guides changes to the system. The evaluation needs to be objective and aligned with user feedback, because it tells us where the bottleneck is and what to change next.
智能体框架包含规划与执行逻辑、用于会话状态的上下文和记忆、与工具和数据交互的接口、用于存储输出和日志的工件存储,以及评估逻辑。基础模型为该框架提供支持,但优化该模型不在本项目范围内。优化阶梯从提示词开始,接着是结构化上下文、工作流设计、框架代码,最终扩展到优化器自身的代码。我们当前正在开展的工作是提示词优化。An agent harness includes planning and execution logic, context and memory for session state, interfaces to tools and data, artifact storage for outputs and logs, and evaluation logic. A base model powers the harness, but optimizing that model is outside this project's scope. The optimization ladder starts with prompts, then structured context, workflow design, harness code, and eventually the optimizer's own code. Our active work is prompt optimization.
从生产环境跟踪记录到拟议的编辑From production traces to a proposed edit
工作流程分为七个步骤。首先,在样本上运行智能体,并记录输出和执行轨迹。其次,使用评估引擎评估这些轨迹。第三,反思失败案例,找出原因,问题可能出在提示词、智能体、模型、工具、评判器或评估标准上。第四,根据诊断结果提出修改建议。目前修改的是提示词,今后也可能调整工作流程或代码。第五,使用相同的评判器和评估标准验证候选修改。第六,将某个候选方案应用到提示词中。第七,在将获批的更新设为下一轮的基线之前,先在留出集上将其与旧系统再次进行评估。The workflow has seven steps. First, run the agent on samples and log outputs and execution traces. Second, run the evaluation engine on those traces. Third, reflect on the failures to find their cause, which might be the prompt, agent, model, tool, judge or rubric. Fourth, propose edits based on the diagnosis. The edits are prompts today and could eventually change the workflow or code. Fifth, validate edit candidates against the same judge and rubrics. Sixth, adopt a candidate in the prompt. Seventh, evaluate it again on a holdout set against the old system before making the approved update the baseline for the next cycle.
我们正在优化的目标是用户理解智能体。给定一个会员 ID,它会利用搜索历史、个人资料、位置和偏好等输入,生成结构化描述。其中一个字段是首选职位名称。智能体可能会推荐网络经理或客户经理,给出置信度,引用诸如已保存搜索中反复出现的职位等证据,并解释其推理过程。The target we are optimizing is the user-understanding agent. Given a member ID, it uses inputs such as search history, profile, location and preferences to generate a structured description. One field is preferred job titles. The agent might propose network manager or account manager, give its confidence, cite evidence such as repeated occurrences in saved searches and explain its reasoning.
一级评审器 L1 根据产品定义的评分标准,从 15 个维度对输出进行评分。在一个示例中,总体得分为 2.31。报告将得分细分到目标摘要、首选职位名称等维度,并为每个维度提供评分理由。1 表示质量较差,2 表示一般,3 表示非常好。The first-level judge, L1, scores the output across 15 dimensions with product-defined rubrics. In one example, the overall result was 2.31. The report breaks that down into dimensions such as goal summary and preferred job title, with a rationale for each. One means poor quality, two fair and three very good.
反思阶段包含四个较小的步骤。首先,不使用模型,按维度对失败的轨迹行进行分组。其次,由 L2 评判器诊断每一行,并指定根本原因和标签。第三,将近似重复的诊断合并为规范问题。例如,一行指出缺少个人资料数据,另一行指出这些数据无法支持推断出的偏好,两者可能指向同一个潜在的证据缺口。第四,按出现频率对规范问题进行分组和排序。这样就会生成一份便于人类阅读的评分卡,以及已保存的诊断结果,可用于指导 L2 评判器后续的运行。The reflection stage has four smaller steps. First, group failing trace rows by dimension without using a model. Second, an L2 judge diagnoses each row and assigns a root cause and tag. Third, merge near-duplicate diagnoses into canonical issues. A row saying profile data is missing and a row saying it does not support the inferred preference can point to the same underlying evidence gap. Fourth, group and rank the canonical issues by frequency. That produces a human-readable scorecard and saved diagnoses that can guide the L2 judge on later runs.
提示词方案会利用评审者提供的证据和反思产物。优化器以小批次生成修改,选中的候选方案会经过验证和留出集检查,之后才能将胜出的更新作为新的基线。该工作流会根据需要按每周、每两周或每月的节奏运行。人工标注、评审者方差研究,以及对评分和诊断机制的更新,都是质量保障的核心。目前,生产环境中的变更都由人工审核。只有在质量足以支撑的情况下,我们才会逐步减少这部分工作。Prompt proposals use the judge's evidence and the reflection artifacts. The optimizer generates edits in mini-batches, and selected candidates go through validation and the holdout check before a winning update can become the new baseline. This runs as a workflow on a weekly, biweekly or monthly cadence as needed. Human annotations, judge variance studies and updates to both scoring and diagnosis are central to quality. Production changes are human-reviewed for now. We would reduce that work gradually only as quality warrants it.
人工审查揭示了评估器中的问题What human review exposed in the evaluators
Saloni Gandhi:经过人工审核和量化测量后,我们部署了首个针对 RSI 优化的 PR。另一项重要成果是改进评估器本身。我们对输出进行了标注,查看评判器与人工意见不一致的地方,并发现评分标准和反思系统都存在反复出现的弱点。优化循环的可靠性,取决于驱动它的反馈有多可靠。Saloni Gandhi: We deployed our first RSI-optimized PR after human review and quantitative measurement. The other major outcome was improving the evaluator itself. We annotated outputs, looked where the judge disagreed with people, and found recurring weaknesses in both the rubric and reflection system. An optimization loop is only as reliable as the feedback driving it.
我们分析了约 180 至 200 条由人工评审的结果,以评估 L1 评审器。对于得分为 1、2 和 3 的输出,评审器与人工评审完全一致的比例分别约为 55%、57% 和 80%。与区分较弱的输出相比,评审器更能可靠地识别优质输出。在人们认为评审过于严苛的 37 个判断中,有 31 个得分为 1。不同维度上的一致度也有所差异:首选标题的表现最弱,专业知识或领域维度约为 47%,工作类型维度约为 50%。We analyzed about 180 to 200 human reviews for the L1 judge. Full agreement with humans was around 55% for outputs scored one, around 57% for score two, and around 80% for score three. The judge recognized strong outputs more reliably than it distinguished among weaker ones. Of 37 judgments people thought were too harsh, 31 had received a one. Agreement also varied by dimension. Preferred titles were among the weakest, expertise or domain was around 47%, and work type around 50%.
在职位名称示例中,法官有时会接受一个看似合理的头衔,却没有注意到代理遗漏了一项重要信号。专业知识则涉及另一个问题:领域、职能或角色,以及技能并不能互换。软件工程、机器学习工程师和机器学习便说明了这种区别。对于答案中正确与错误信息混杂时如何给部分分,评分标准也缺乏一致的规则。In the job-title examples, the judge sometimes accepted a plausible title without noticing that the agent had omitted an important signal. Expertise raised a different issue: a domain, a function or role, and a skill are not interchangeable. Software engineering, machine learning engineer and machine learning illustrate the distinction. The rubric also lacked consistent rules for partial credit when an answer mixed correct and incorrect information.
评判器有时会因无关紧要的格式问题而扣分,例如 full-time 的大小写,也会从就业记录中得出不一致的推断。评审人员对于何时可以合理地推断未明说的偏好也存在分歧。我们统一了职位名称和格式,明确了有关同时任职、资历和地域的规则,并重新校准了错误答案与部分正确答案之间的界限。人工评审的一致率从 57% 提高到 64%。平均错误率也有所下降[图注未明确说明所报告数值 96 和 74 的量表]。改进对何为优质答案的规范,与改进模型本身同样重要。The judge sometimes punished harmless formatting, such as how full-time was capitalized, or drew inconsistent inferences from employment records. The reviewers also disagreed about when an unstated preference could legitimately be inferred. We normalized titles and formatting, clarified rules on concurrent employment, seniority and geography, and recalibrated the line between poor and partially correct outputs. Human agreement rose from 57% to 64%. The mean error also fell [the scale for the reported figures, 96 and 74, is unclear in the captions]. Improving the specification for what counts as a good answer mattered alongside the model.
L2 的根因归因比发现失败更难。当它将问题归咎于底层模型时,评审者更常达成一致;而将问题归因于其他原因时,达成一致的情况较少,尤其是归咎于评估标准时。最初的分类体系没有明确的方式来表示 L1 判断有误,因此 L2 有时会转而归咎于评估标准。它有时也会直接沿用 L1 的理由,而不核对这些理由是否符合智能体的输出。即使解释听起来很有说服力,也仍可能错误地诊断出问题所在的组件,并引导人们在错误的位置进行修改。L2 root-cause attribution was harder than spotting a failure. Reviewers agreed more often when it blamed the underlying model than when it blamed other causes, particularly the rubric. The initial taxonomy had no explicit way to say L1 had made a wrong judgment, so L2 sometimes blamed the rubric instead. It also sometimes reused L1's rationale without checking it against the agent's output. A convincing explanation can still diagnose the wrong component and steer an edit to the wrong place.
因此,我们分别处理了 L1 评分和 L2 诊断。多数投票和留出集评估可以减轻个别评审者差异带来的影响。是否采用还取决于阈值和置信区间,而不只是选择得分最高的候选项。We therefore worked on L1 scoring and L2 diagnosis separately. Majority voting and held-out evaluations reduce the effects of individual judge variance. Adoption also depends on a threshold and confidence intervals, not simply selecting the highest-scoring candidate.
衡量采用情况并共享基础设施Measuring adoption and sharing the infrastructure
一个衡量指标是循环本身的可靠性。另一个是团队采用这种方式后会发生什么:能够以这种方式生成并验证多少项提示词变更,下游响应是否有所改善,以及维护人员是否因此减少了工作量。目标是提升可衡量的智能体质量,而不是增加自动化编辑的数量。One measure is reliability of the loop itself. Another is what happens as teams adopt it: how many prompt changes can be generated and validated this way, whether downstream responses improve, and whether maintainers save work. The objective is measurable agent quality, rather than more automated edits.
大多数团队已经拥有能够回答问题、进行总结或执行工作流的智能体,但拥有可重复、可靠评估的团队要少得多。评估之上,还需要系统化的反思与诊断。RSI 循环依赖这两者,并进一步加入优化与验证。构建可信赖的评估基础设施,是扩展这一循环的前提。Most teams already have agents that answer questions, summarize or carry out workflows. Fewer have repeatable, reliable evaluations. Above evaluation comes systematic reflection and diagnosis. The RSI loop depends on both and adds optimization and validation. Building trustworthy evaluation infrastructure is a prerequisite to scaling the loop.
计划是将可复用的评估、指标以及经人工反馈校准的判定器标准化;自动收集执行轨迹并检测反复出现的问题;以可重复的方式生成并测试候选修改;要求进行留出集评估和回归测试;并提供自助式组件,让各团队无需从头构建整套流水线。The plan is to standardize reusable evaluations, metrics and judges calibrated against human feedback; automate trace collection and detection of recurring failures; generate and test candidate edits repeatably; require holdout evaluations and regression tests; and provide self-service components so that each team does not have to build a whole pipeline.
目标智能体是我们要改进的对象。改进引擎会对它进行评估、诊断故障并提出改进方案。长远目标是让目标智能体更快地变好,提升其性能随时间变化的增长速度。关键在于能够信任那些旨在让系统变得更好的改动。The target agent is what we improve. The improvement engine evaluates it, diagnoses failures and proposes changes. The long-term objective is to make the target get better faster, increasing the slope of its performance over time. The key is being able to trust the changes that are supposed to make the system better.