← 返回文章列表
2025-09-17

三次近期故障的复盘报告

A postmortem of three recent issues

A postmortem of three recent issues

Between August and early September, three infrastructure bugs intermittently degraded Claude's response quality. We've now resolved these issues and want to explain what happened. In early August, a number of users began reporting degraded responses from Claude. These initial reports were difficult to distinguish from normal variation in user feedback. By late August, the increasing frequency and persistence of these reports prompted us to open an investigation that led us to uncover three separate infrastructure bugs. To state it plainly: We never reduce model quality due to demand, time of day, or server load. The problems our users reported were due to infrastructure bugs alone. We recognize users expect consistent quality from Claude, and we maintain an extremely high bar for ensuring infrastructure changes don't affect model outputs. In these recent incidents, we didn't meet that bar. The following postmortem explains what went wrong, why detection and resolution took longer than we would have wanted, and what we're changing to prevent similar future incidents. We don't typically share this level of technical detail about our infrastructure, but the scope and complexity of these issues justified a more comprehensive explanation.

八月至九月初期间,三个基础设施漏洞间歇性地降低了 Claude 的回复质量。这些问题现已全部修复,我们在此说明事件经过。

How we serve Claude at scale

八月初,多位用户开始报告 Claude 回复质量下降。这些早期报告很难与用户反馈中的正常波动区分开来。到了八月下旬,相关报告的频率和持续性不断增加,促使我们启动调查,最终发现了三个独立的基础设施漏洞。

We serve Claude to millions of users via our first-party API, Amazon Bedrock, and Google Cloud's Vertex AI. We deploy Claude across multiple hardware platforms, namely AWS Trainium, NVIDIA GPUs, and Google TPUs. This approach provides the capacity and geographic distribution necessary to serve users worldwide. Each hardware platform has different characteristics and requires specific optimizations. Despite these variations, we have strict equivalence standards for model implementations. Our aim is that users should get the same quality responses regardless of which platform serves their request. This complexity means that any infrastructure change requires careful validation across all platforms and configurations.

坦率地说:我们从未因请求量、时段或服务器负载而降低模型质量。用户报告的问题完全是由基础设施漏洞导致的。

Timeline of events

我们深知用户期望 Claude 提供始终如一的质量,因此对确保基础设施变更不影响模型输出设定了极高的标准。在近期这几起事件中,我们未能达到这一标准。以下复盘将说明问题所在、检测和修复为何耗时超预期,以及我们正在采取哪些措施防止类似事件再次发生。

The overlapping nature of these bugs made diagnosis particularly challenging. The first bug was introduced on August 5, affecting approximately 0.8% of requests made to Sonnet 4. Two more bugs arose from deployments on August 25 and 26. Although initial impacts were limited, a load balancing change on August 29 started to increase affected traffic. This caused many more users to experience issues while others continued to see normal performance, creating confusing and contradictory reports.

我们通常不会公开分享基础设施层面的技术细节,但此次问题的波及范围和复杂程度值得给出更全面的说明。

Three overlapping issues

我们如何大规模提供 Claude 服务

Below we describe the three bugs that caused the degradation, when they occurred, and how we resolved them:

我们通过第一方 API、Amazon Bedrock 和 Google Cloud 的 Vertex AI 为数百万用户提供 Claude 服务。Claude 部署在多种硬件平台上,包括 AWS Trainium、NVIDIA GPU 和 Google TPU。这种架构提供了服务全球用户所需的容量和地理分布能力。

1. Context window routing error

每个硬件平台都有不同的特性,需要针对性优化。尽管存在这些差异,我们对模型实现有严格的等价性标准。无论用户的请求由哪个平台处理,都应获得相同质量的回复。这种复杂性意味着任何基础设施变更都需要在所有平台和配置上进行仔细验证。

On August 5, some Sonnet 4 requests were misrouted to servers configured for the upcoming1M tokencontext window. This bug initially affected 0.8% of requests. On August 29, a routine load balancing change unintentionally increased the number of short-context requests routed to the 1M context servers. At the worst impacted hour on August 31, 16% of Sonnet 4 requests were affected. Approximately 30% of Claude Code users who made requests during this period had at least one message routed to the wrong server type, resulting in degraded responses. On Amazon Bedrock, misrouted traffic peaked at 0.18% of all Sonnet 4 requests from August 12. Incorrect routing affected less than 0.0004% of requests on Google Cloud's Vertex AI between August 27 and September 16. However, some users were affected more severely, as our routing is "sticky". This meant that once a request was served by the incorrect server, subsequent follow-ups were likely to be served by the same incorrect server. Resolution:We fixed the routing logic to ensure short- and long-context requests were directed to the correct server pools. We deployed the fix on September 4. Rollout to our first-party platform and Google Cloud's Vertex AI was completed by September 16, and to AWS Bedrock by September 18.

事件时间线

2. Output corruption

这些漏洞的重叠特性使诊断工作尤为棘手。第一个漏洞于 8 月 5 日引入,影响了约 0.8% 的 Sonnet 4 请求。8 月 25 日和 26 日的部署又引入了两个漏洞。

On August 25, we deployed a misconfiguration to the Claude API TPU servers that caused an error during token generation. An issue caused by a runtime performance optimization occasionally assigned a high probability to tokens that should rarely be produced given the context, for example producing Thai or Chinese characters in response to English prompts, or producing obvious syntax errors in code. A small subset of users that asked a question in English might have seen "สวัสดี" in the middle of the response, for example. This corruption affected requests made to Opus 4.1 and Opus 4 on August 25-28, and requests to Sonnet 4 August 25–September 2. Third-party platforms were not affected by this issue. Resolution:We identified the issue and rolled back the change on September 2. We've added detection tests for unexpected character outputs to our deployment process.

虽然初始影响有限,但 8 月 29 日的一次负载均衡变更开始增加受影响的流量。这导致更多用户遇到问题,而其他用户仍看到正常表现,从而产生了令人困惑和相互矛盾的报告。

3. Approximate top-k XLA:TPU miscompilation

三个重叠的问题

On August 25, we deployed code to improve how Claude selects tokens during text generation. This change inadvertently triggered a latent bug in the XLA:TPU[1]compiler, which has been confirmed to affect requests to Claude Haiku 3.5. We also believe this could have impacted a subset of Sonnet 4 and Opus 3 on the Claude API. Third-party platforms were not affected by this issue. Resolution:We first observed the bug affecting Haiku 3.5 and rolled it back on September 4. We later noticed user reports of problems with Opus 3 that were compatible with this bug, and rolled it back on September 12. After extensive investigation we were unable to reproduce this bug on Sonnet 4 but decided to also roll it back out of an abundance of caution. Simultaneously, we have (a) been working with the XLA:TPU team on a fix for the compiler bug and (b) rolled out a fix to use exact top-k with enhanced precision. For details, see the deep dive below.

以下是我们对导致质量下降的三个漏洞的描述,包括发生时间和修复方式:

A closer look at the XLA compiler bug

1. 上下文窗口路由错误

To illustrate the complexity of these issues, here's how the XLA compiler bug manifested and why it proved particularly challenging to diagnose. When Claude generates text, it calculates probabilities for each possible next word, then randomly chooses a sample from this probability distribution. We use "top-p sampling" to avoid nonsensical outputs—only considering words whose cumulative probability reaches a threshold (typically 0.99 or 0.999). On TPUs, our models run across multiple chips, with probability calculations happening in different locations. To sort these probabilities, we need to coordinate data between chips, which is complex.[2] In December 2024, we discovered our TPU implementation would occasionally drop the most probable token whentemperaturewas zero. We deployed a workaround to fix this case. The root cause involved mixed precision arithmetic. Our models compute next-token probabilities inbf16(16-bit floating point). However, the vector processor isfp32-native, so the TPU compiler (XLA) can optimize runtime by converting some operations to fp32 (32-bit). This optimization pass is guarded by thexla_allow_excess_precisionflag which defaults to true. xla_allow_excess_precision This caused a mismatch: operations that should have agreed on the highest probability token were running at different precision levels. The precision mismatch meant they didn't agree on which token had the highest probability. This caused the highest probability token to sometimes disappear from consideration entirely. On August 26, we deployed a rewrite of our sampling code to fix the precision issues and improve how we handled probabilities at the limit that reach the top-p threshold. But in fixing these problems, we exposed a trickier one. xla_allow_excess_precision Our fix removed the December workaround because we believed we'd solved the root cause. This led to a deeper bug in theapproximate top-koperation—a performance optimization that quickly finds the highest probability tokens.[3]This approximation sometimes returned completely wrong results, but only for certain batch sizes and model configurations. The December workaround had been inadvertently masking this problem. The bug's behavior was frustratingly inconsistent. It changed depending on unrelated factors such as what operations ran before or after it, and whether debugging tools were enabled. The same prompt might work perfectly on one request and fail on the next. While investigating, we also discovered that the exact top-k operation no longer had the prohibitive performance penalty it once did. We switched from approximate to exact top-k and standardized some additional operations on fp32 precision.[4]Model quality is non-negotiable, so we accepted the minor efficiency impact.

8 月 5 日,部分 Sonnet 4 请求被错误路由到了为即将推出的 100 万 token 上下文窗口配置的服务器。该漏洞最初影响 0.8% 的请求。8 月 29 日,一次例行负载均衡变更无意中增加了被路由到 100 万上下文服务器的短上下文请求数量。在 8 月 31 日影响最严重的一个小时内,16% 的 Sonnet 4 请求受到影响。

Why detection was difficult

在此期间,约 30% 的 Claude Code 用户至少有一条消息被路由到了错误的服务器类型,导致回复质量下降。在 Amazon Bedrock 上,自 8 月 12 日起,错误路由的流量峰值占所有 Sonnet 4 请求的 0.18%。8 月 27 日至 9 月 16 日期间,Google Cloud 的 Vertex AI 上受影响的请求不到 0.0004%。

Our validation process ordinarily relies on benchmarks alongside safety evaluations and performance metrics. Engineering teams perform spot checks and deploy to small "canary" groups first. These issues exposed critical gaps that we should have identified earlier. The evaluations we ran simply didn't capture the degradation users were reporting, in part because Claude often recovers well from isolated mistakes. Our own privacy practices also created challenges in investigating reports. Our internal privacy and security controls limit how and when engineers can access user interactions with Claude, in particular when those interactions are not reported to us as feedback. This protects user privacy but prevents engineers from examining the problematic interactions needed to identify or reproduce bugs. Each bug produced different symptoms on different platforms at different rates. This created a confusing mix of reports that didn't point to any single cause. It looked like random, inconsistent degradation. More fundamentally, we relied too heavily on noisy evaluations. Although we were aware of an increase in reports online, we lacked a clear way to connect these to each of our recent changes. When negative reports spiked on August 29, we didn't immediately make the connection to an otherwise standard load balancing change.

然而,部分用户受到的影响更为严重,因为我们的路由具有"粘性"。这意味着一旦请求由错误的服务器处理,后续的追问很可能仍由同一台错误的服务器处理。

What we're changing

修复措施:我们修正了路由逻辑,确保短上下文和长上下文请求被引导到正确的服务器池。修复于 9 月 4 日部署,9 月 16 日前完成了第一方平台和 Google Cloud Vertex AI 的上线,9 月 18 日前完成了 AWS Bedrock 的上线。

As we continue to improve our infrastructure, we're also improving the way we evaluate and prevent bugs like those discussed above across all platforms where we serve Claude. Here's what we're changing:

2. 输出损坏

  • More sensitive evaluations:To help discover the root cause of any given issue, we’ve developed evaluations that can more reliably differentiate between working and broken implementations. We’ll keep improving these evaluations to keep a closer eye on model quality.
  • Quality evaluations in more places:Although we run regular evaluations on our systems, we will run them continuously on true production systems to catch issues such as the context window load balancing error.
  • Faster debugging tooling:We'll develop infrastructure and tooling to better debug community-sourced feedback without sacrificing user privacy. Additionally, some bespoke tools developed here will be used to reduce the remediation time in future similar incidents, if those should occur.

8 月 25 日,我们向 Claude API 的 TPU 服务器部署了一个错误配置,导致 token 生成过程中出现错误。由运行时性能优化引发的问题偶尔会为在给定上下文中本应极少出现的 token 分配高概率,例如在英文提示中输出泰文或中文字符,或在代码中产生明显的语法错误。少数用英文提问的用户可能会在回复中看到类似"สวัสดี"(泰文"你好")的内容。

Evals and monitoring are important. But these incidents have shown that we also need continuous signal from users when responses from Claude aren't up to the usual standard. Reports of specific changes observed, examples of unexpected behavior encountered, and patterns across different use cases all helped us isolate the issues. It remains particularly helpful for users to continue to send us their feedback directly. You can use the/bugcommand in Claude Code or you can use the "thumbs down" button in the Claude apps to do so. Developers and researchers often create new and interesting ways to evaluate model quality that complement our internal testing. If you'd like to share yours, reach out tofeedback@anthropic.com. /bug We remain grateful to our community for these contributions.

此损坏影响了 8 月 25-28 日期间对 Opus 4.1 和 Opus 4 的请求,以及 8 月 25 日至 9 月 2 日对 Sonnet 4 的请求。第三方平台未受此问题影响。

Acknowledgments

修复措施:我们定位了问题并于 9 月 2 日回滚了相关变更。我们已在部署流程中增加了对异常字符输出的检测测试。

Written by Sam McAllister, with thanks to Stuart Ritchie, Jonathan Gray, Kashyap Murali, Brennan Saeta, Oliver Rausch, Alex Palcuie, and many others. [1]XLA:TPU is the optimizing compiler that translatesXLAHigh Level Optimizing language—often written usingJAX—to TPU machine instructions. [2]Our models are too large for single chips and are partitioned across tens of chips or more, making our sorting operation a distributed sort. TPUs (just like GPUs and Trainium) also have different performance characteristics than CPUs, requiring different implementation techniques using vectorized operations instead of serial algorithms. [3]We had been using this approximate operation because it yielded substantial performance improvements. The approximation works by accepting potential inaccuracies in the lowest probability tokens, which shouldn't affect quality—except when the bug caused it to drop the highest probability token instead. [4]Note that the now-correct top-k implementation may result in slight differences in the inclusion of tokens near the top-p threshold, and in rare cases users may benefit from re-tuning their choice of top-p.

3. 近似 top-k 的 XLA:TPU 编译错误

8 月 25 日,我们部署了用于改进 Claude 在文本生成过程中选择 token 方式的代码。此变更无意中触发了 XLA:TPU[1] 编译器中的一个潜在漏洞,经确认影响了对 Claude Haiku 3.5 的请求。

我们还认为该漏洞可能影响了 Claude API 上部分 Sonnet 4 和 Opus 3 的请求。第三方平台未受此问题影响。

修复措施:我们首先观察到该漏洞影响了 Haiku 3.5,并于 9 月 4 日进行了回滚。随后注意到用户关于 Opus 3 问题的报告与该漏洞特征吻合,于 9 月 12 日对其也进行了回滚。经过大量调查,我们未能在 Sonnet 4 上复现该漏洞,但出于谨慎考虑,同样进行了回滚。

同时,我们(a)正与 XLA:TPU 团队合作修复编译器漏洞,(b)已部署了使用精确 top-k 并增强精度的修复方案。详情请参见下文的深入分析。

XLA 编译器漏洞深入解析

为了说明这些问题的复杂性,以下是 XLA 编译器漏洞的表现形式及其诊断难度的原因。

当 Claude 生成文本时,它会为每个可能的下一个词计算概率,然后从该概率分布中随机采样。我们使用"top-p 采样"来避免无意义的输出——只考虑累积概率达到阈值(通常为 0.99 或 0.999)的词。在 TPU 上,我们的模型运行在多个芯片上,概率计算在不同位置进行。为了排序这些概率,我们需要在芯片之间协调数据,这本身就很复杂。[2]

2024 年 12 月,我们发现 TPU 实现偶尔会在温度(temperature)为零时丢失概率最高的 token。我们部署了一个变通方案来修复此问题。

根本原因涉及混合精度算术。我们的模型以 bf16(16 位浮点数)计算下一个 token 的概率。然而,向量处理器是原生 fp32 的,因此 TPU 编译器(XLA)可以通过将部分运算转换为 fp32(32 位)来优化运行时性能。该优化过程受 xla_allow_excess_precision 标志保护,其默认值为 true。

这导致了不一致:本应对最高概率 token 达成一致的运算在不同精度级别上运行。精度不一致意味着它们对哪个 token 具有最高概率的判断不一致,导致最高概率的 token 有时会完全从候选中消失。

8 月 26 日,我们部署了采样代码的重写版本,以修复精度问题并改进我们对达到 top-p 阈值的极限概率的处理方式。但在修复这些问题的过程中,我们暴露了一个更棘手的问题。

我们的修复移除了 12 月的变通方案,因为我们认为已解决了根本原因。这导致 approximate top-k(近似 top-k)运算中出现了更深层的漏洞——这是一种快速找到最高概率 token 的性能优化。[3] 这种近似方法有时会返回完全错误的结果,但仅在特定批量大小和模型配置下出现。12 月的变通方案无意中掩盖了这个问题。

该漏洞的行为令人沮丧地不一致。它会因不相关的因素而变化,例如其前后运行了什么操作,以及是否启用了调试工具。相同的提示可能在一次请求中完美运行,在下一次请求中则失败。

在调查过程中,我们还发现精确 top-k 运算不再具有曾经令人望而却步的性能代价。我们将近似 top-k 切换为精确 top-k,并将部分额外运算标准化为 fp32 精度。[4] 模型质量是不可妥协的,因此我们接受了轻微的效率影响。

为何检测困难

我们的验证流程通常依赖基准测试、安全评估和性能指标。工程团队进行抽查,并先部署到小规模的"金丝雀"用户组。

这些暴露出的关键缺口本应更早被发现。我们运行的评估根本没有捕捉到用户报告的质量下降,部分原因是 Claude 通常能很好地从孤立错误中恢复。我们自身的隐私保护措施也给调查报告带来了挑战。我们的内部隐私和安全控制限制了工程师访问用户与 Claude 交互的方式和时机,特别是在这些交互未作为反馈报告给我们的情况下。这保护了用户隐私,但也阻碍了工程师检查识别或复现漏洞所需的问题交互。

每个漏洞在不同平台上以不同速率产生了不同的症状。这造成了一堆令人困惑的报告,无法指向任何单一原因。看起来像是随机的、不一致的质量下降。

更根本的是,我们过于依赖噪音较大的评估指标。尽管我们注意到网上报告有所增加,但缺乏将这些报告与我们近期各项变更明确关联的方法。当 8 月 29 日负面报告激增时,我们并未立即将其与一次看似常规的负载均衡变更联系起来。

我们正在做出的改变

在持续改进基础设施的同时,我们也正在改进在所有 Claude 服务平台上评估和预防类似漏洞的方式。以下是我们的改进措施:

  • 更灵敏的评估:为了帮助发现任何特定问题的根本原因,我们开发了能够更可靠地区分正常与异常实现的评估方法。我们将持续改进这些评估,更密切地关注模型质量。
  • 在更多环节进行质量评估:虽然我们对系统进行定期评估,但我们将在真实生产系统上持续运行评估,以捕获诸如上下文窗口负载均衡错误等问题。
  • 更快的调试工具:我们将开发基础设施和工具,以便在不牺牲用户隐私的前提下更好地调试来自社区的反馈。此外,此次开发的部分定制工具将用于缩短未来类似事件(如果发生)的修复时间。

评估和监控固然重要。但这些事件表明,当 Claude 的回复未达到通常标准时,我们也需要来自用户的持续信号。对所观察到的具体变化的报告、遇到的意外行为示例以及不同使用场景中的模式,都有助于我们隔离问题。

用户继续直接向我们发送反馈仍然特别有帮助。您可以使用 Claude Code 中的 /bug 命令,或使用 Claude 应用中的"踩"(thumbs down)按钮来提交反馈。开发者和研究人员经常创建新的、有趣的方法来评估模型质量,这些方法可以补充我们的内部测试。如果您愿意分享您的评估方法,请联系 feedback@anthropic.com。

我们对社区的这些贡献深表感谢。

致谢

由 Sam McAllister 撰写,感谢 Stuart Ritchie、Jonathan Gray、Kashyap Murali、Brennan Saeta、Oliver Rausch、Alex Palcuie 及众多其他同事。

[1] XLA:TPU 是优化编译器,用于将 XLA 高级优化语言(通常通过 JAX 编写)翻译为 TPU 机器指令。

[2] 我们的模型规模太大,无法在单个芯片上运行,因此被分布在数十个甚至更多芯片上,使得排序操作成为分布式排序。TPU(与 GPU 和 Trainium 一样)的性能特性与 CPU 不同,需要使用向量化运算而非串行算法的不同实现技术。

[3] 我们此前使用该近似运算是因为它带来了显著的性能提升。该近似方法通过接受最低概率 token 的潜在不精确性来工作,这通常不会影响质量——除了当漏洞导致它丢弃的是最高概率 token。

[4] 请注意,现在修正后的 top-k 实现可能导致接近 top-p 阈值的 token 的纳入情况出现细微差异,在极少数情况下,用户可能受益于重新调整其 top-p 参数的选择。

八月至九月初期间,三个基础设施漏洞间歇性地降低了 Claude 的回复质量。这些问题现已全部修复,我们在此说明事件经过。

八月初,多位用户开始报告 Claude 回复质量下降。这些早期报告很难与用户反馈中的正常波动区分开来。到了八月下旬,相关报告的频率和持续性不断增加,促使我们启动调查,最终发现了三个独立的基础设施漏洞。

坦率地说:我们从未因请求量、时段或服务器负载而降低模型质量。用户报告的问题完全是由基础设施漏洞导致的。

我们深知用户期望 Claude 提供始终如一的质量,因此对确保基础设施变更不影响模型输出设定了极高的标准。在近期这几起事件中,我们未能达到这一标准。以下复盘将说明问题所在、检测和修复为何耗时超预期,以及我们正在采取哪些措施防止类似事件再次发生。

我们通常不会公开分享基础设施层面的技术细节,但此次问题的波及范围和复杂程度值得给出更全面的说明。

我们如何大规模提供 Claude 服务

我们通过第一方 API、Amazon Bedrock 和 Google Cloud 的 Vertex AI 为数百万用户提供 Claude 服务。Claude 部署在多种硬件平台上,包括 AWS Trainium、NVIDIA GPU 和 Google TPU。这种架构提供了服务全球用户所需的容量和地理分布能力。

每个硬件平台都有不同的特性,需要针对性优化。尽管存在这些差异,我们对模型实现有严格的等价性标准。无论用户的请求由哪个平台处理,都应获得相同质量的回复。这种复杂性意味着任何基础设施变更都需要在所有平台和配置上进行仔细验证。

事件时间线

这些漏洞的重叠特性使诊断工作尤为棘手。第一个漏洞于 8 月 5 日引入,影响了约 0.8% 的 Sonnet 4 请求。8 月 25 日和 26 日的部署又引入了两个漏洞。

虽然初始影响有限,但 8 月 29 日的一次负载均衡变更开始增加受影响的流量。这导致更多用户遇到问题,而其他用户仍看到正常表现,从而产生了令人困惑和相互矛盾的报告。

三个重叠的问题

以下是我们对导致质量下降的三个漏洞的描述,包括发生时间和修复方式:

1. 上下文窗口路由错误

8 月 5 日,部分 Sonnet 4 请求被错误路由到了为即将推出的 100 万 token 上下文窗口配置的服务器。该漏洞最初影响 0.8% 的请求。8 月 29 日,一次例行负载均衡变更无意中增加了被路由到 100 万上下文服务器的短上下文请求数量。在 8 月 31 日影响最严重的一个小时内,16% 的 Sonnet 4 请求受到影响。

在此期间,约 30% 的 Claude Code 用户至少有一条消息被路由到了错误的服务器类型,导致回复质量下降。在 Amazon Bedrock 上,自 8 月 12 日起,错误路由的流量峰值占所有 Sonnet 4 请求的 0.18%。8 月 27 日至 9 月 16 日期间,Google Cloud 的 Vertex AI 上受影响的请求不到 0.0004%。

然而,部分用户受到的影响更为严重,因为我们的路由具有"粘性"。这意味着一旦请求由错误的服务器处理,后续的追问很可能仍由同一台错误的服务器处理。

修复措施:我们修正了路由逻辑,确保短上下文和长上下文请求被引导到正确的服务器池。修复于 9 月 4 日部署,9 月 16 日前完成了第一方平台和 Google Cloud Vertex AI 的上线,9 月 18 日前完成了 AWS Bedrock 的上线。

2. 输出损坏

8 月 25 日,我们向 Claude API 的 TPU 服务器部署了一个错误配置,导致 token 生成过程中出现错误。由运行时性能优化引发的问题偶尔会为在给定上下文中本应极少出现的 token 分配高概率,例如在英文提示中输出泰文或中文字符,或在代码中产生明显的语法错误。少数用英文提问的用户可能会在回复中看到类似"สวัสดี"(泰文"你好")的内容。

此损坏影响了 8 月 25-28 日期间对 Opus 4.1 和 Opus 4 的请求,以及 8 月 25 日至 9 月 2 日对 Sonnet 4 的请求。第三方平台未受此问题影响。

修复措施:我们定位了问题并于 9 月 2 日回滚了相关变更。我们已在部署流程中增加了对异常字符输出的检测测试。

3. 近似 top-k 的 XLA:TPU 编译错误

8 月 25 日,我们部署了用于改进 Claude 在文本生成过程中选择 token 方式的代码。此变更无意中触发了 XLA:TPU[1] 编译器中的一个潜在漏洞,经确认影响了对 Claude Haiku 3.5 的请求。

我们还认为该漏洞可能影响了 Claude API 上部分 Sonnet 4 和 Opus 3 的请求。第三方平台未受此问题影响。

修复措施:我们首先观察到该漏洞影响了 Haiku 3.5,并于 9 月 4 日进行了回滚。随后注意到用户关于 Opus 3 问题的报告与该漏洞特征吻合,于 9 月 12 日对其也进行了回滚。经过大量调查,我们未能在 Sonnet 4 上复现该漏洞,但出于谨慎考虑,同样进行了回滚。

同时,我们(a)正与 XLA:TPU 团队合作修复编译器漏洞,(b)已部署了使用精确 top-k 并增强精度的修复方案。详情请参见下文的深入分析。

XLA 编译器漏洞深入解析

为了说明这些问题的复杂性,以下是 XLA 编译器漏洞的表现形式及其诊断难度的原因。

当 Claude 生成文本时,它会为每个可能的下一个词计算概率,然后从该概率分布中随机采样。我们使用"top-p 采样"来避免无意义的输出——只考虑累积概率达到阈值(通常为 0.99 或 0.999)的词。在 TPU 上,我们的模型运行在多个芯片上,概率计算在不同位置进行。为了排序这些概率,我们需要在芯片之间协调数据,这本身就很复杂。[2]

2024 年 12 月,我们发现 TPU 实现偶尔会在温度(temperature)为零时丢失概率最高的 token。我们部署了一个变通方案来修复此问题。

根本原因涉及混合精度算术。我们的模型以 bf16(16 位浮点数)计算下一个 token 的概率。然而,向量处理器是原生 fp32 的,因此 TPU 编译器(XLA)可以通过将部分运算转换为 fp32(32 位)来优化运行时性能。该优化过程受 xla_allow_excess_precision 标志保护,其默认值为 true。

这导致了不一致:本应对最高概率 token 达成一致的运算在不同精度级别上运行。精度不一致意味着它们对哪个 token 具有最高概率的判断不一致,导致最高概率的 token 有时会完全从候选中消失。

8 月 26 日,我们部署了采样代码的重写版本,以修复精度问题并改进我们对达到 top-p 阈值的极限概率的处理方式。但在修复这些问题的过程中,我们暴露了一个更棘手的问题。

我们的修复移除了 12 月的变通方案,因为我们认为已解决了根本原因。这导致 approximate top-k(近似 top-k)运算中出现了更深层的漏洞——这是一种快速找到最高概率 token 的性能优化。[3] 这种近似方法有时会返回完全错误的结果,但仅在特定批量大小和模型配置下出现。12 月的变通方案无意中掩盖了这个问题。

该漏洞的行为令人沮丧地不一致。它会因不相关的因素而变化,例如其前后运行了什么操作,以及是否启用了调试工具。相同的提示可能在一次请求中完美运行,在下一次请求中则失败。

在调查过程中,我们还发现精确 top-k 运算不再具有曾经令人望而却步的性能代价。我们将近似 top-k 切换为精确 top-k,并将部分额外运算标准化为 fp32 精度。[4] 模型质量是不可妥协的,因此我们接受了轻微的效率影响。

为何检测困难

我们的验证流程通常依赖基准测试、安全评估和性能指标。工程团队进行抽查,并先部署到小规模的"金丝雀"用户组。

这些暴露出的关键缺口本应更早被发现。我们运行的评估根本没有捕捉到用户报告的质量下降,部分原因是 Claude 通常能很好地从孤立错误中恢复。我们自身的隐私保护措施也给调查报告带来了挑战。我们的内部隐私和安全控制限制了工程师访问用户与 Claude 交互的方式和时机,特别是在这些交互未作为反馈报告给我们的情况下。这保护了用户隐私,但也阻碍了工程师检查识别或复现漏洞所需的问题交互。

每个漏洞在不同平台上以不同速率产生了不同的症状。这造成了一堆令人困惑的报告,无法指向任何单一原因。看起来像是随机的、不一致的质量下降。

更根本的是,我们过于依赖噪音较大的评估指标。尽管我们注意到网上报告有所增加,但缺乏将这些报告与我们近期各项变更明确关联的方法。当 8 月 29 日负面报告激增时,我们并未立即将其与一次看似常规的负载均衡变更联系起来。

我们正在做出的改变

在持续改进基础设施的同时,我们也正在改进在所有 Claude 服务平台上评估和预防类似漏洞的方式。以下是我们的改进措施:

  • 更灵敏的评估:为了帮助发现任何特定问题的根本原因,我们开发了能够更可靠地区分正常与异常实现的评估方法。我们将持续改进这些评估,更密切地关注模型质量。
  • 在更多环节进行质量评估:虽然我们对系统进行定期评估,但我们将在真实生产系统上持续运行评估,以捕获诸如上下文窗口负载均衡错误等问题。
  • 更快的调试工具:我们将开发基础设施和工具,以便在不牺牲用户隐私的前提下更好地调试来自社区的反馈。此外,此次开发的部分定制工具将用于缩短未来类似事件(如果发生)的修复时间。

评估和监控固然重要。但这些事件表明,当 Claude 的回复未达到通常标准时,我们也需要来自用户的持续信号。对所观察到的具体变化的报告、遇到的意外行为示例以及不同使用场景中的模式,都有助于我们隔离问题。

用户继续直接向我们发送反馈仍然特别有帮助。您可以使用 Claude Code 中的 /bug 命令,或使用 Claude 应用中的"踩"(thumbs down)按钮来提交反馈。开发者和研究人员经常创建新的、有趣的方法来评估模型质量,这些方法可以补充我们的内部测试。如果您愿意分享您的评估方法,请联系 feedback@anthropic.com。

我们对社区的这些贡献深表感谢。

致谢

由 Sam McAllister 撰写,感谢 Stuart Ritchie、Jonathan Gray、Kashyap Murali、Brennan Saeta、Oliver Rausch、Alex Palcuie 及众多其他同事。

[1] XLA:TPU 是优化编译器,用于将 XLA 高级优化语言(通常通过 JAX 编写)翻译为 TPU 机器指令。

[2] 我们的模型规模太大,无法在单个芯片上运行,因此被分布在数十个甚至更多芯片上,使得排序操作成为分布式排序。TPU(与 GPU 和 Trainium 一样)的性能特性与 CPU 不同,需要使用向量化运算而非串行算法的不同实现技术。

[3] 我们此前使用该近似运算是因为它带来了显著的性能提升。该近似方法通过接受最低概率 token 的潜在不精确性来工作,这通常不会影响质量——除了当漏洞导致它丢弃的是最高概率 token。

[4] 请注意,现在修正后的 top-k 实现可能导致接近 top-p 阈值的 token 的纳入情况出现细微差异,在极少数情况下,用户可能受益于重新调整其 top-p 参数的选择。

Between August and early September, three infrastructure bugs intermittently degraded Claude's response quality. We've now resolved these issues and want to explain what happened. In early August, a number of users began reporting degraded responses from Claude. These initial reports were difficult to distinguish from normal variation in user feedback. By late August, the increasing frequency and persistence of these reports prompted us to open an investigation that led us to uncover three separate infrastructure bugs. To state it plainly: We never reduce model quality due to demand, time of day, or server load. The problems our users reported were due to infrastructure bugs alone. We recognize users expect consistent quality from Claude, and we maintain an extremely high bar for ensuring infrastructure changes don't affect model outputs. In these recent incidents, we didn't meet that bar. The following postmortem explains what went wrong, why detection and resolution took longer than we would have wanted, and what we're changing to prevent similar future incidents. We don't typically share this level of technical detail about our infrastructure, but the scope and complexity of these issues justified a more comprehensive explanation.

How we serve Claude at scale

We serve Claude to millions of users via our first-party API, Amazon Bedrock, and Google Cloud's Vertex AI. We deploy Claude across multiple hardware platforms, namely AWS Trainium, NVIDIA GPUs, and Google TPUs. This approach provides the capacity and geographic distribution necessary to serve users worldwide. Each hardware platform has different characteristics and requires specific optimizations. Despite these variations, we have strict equivalence standards for model implementations. Our aim is that users should get the same quality responses regardless of which platform serves their request. This complexity means that any infrastructure change requires careful validation across all platforms and configurations.

Timeline of events

The overlapping nature of these bugs made diagnosis particularly challenging. The first bug was introduced on August 5, affecting approximately 0.8% of requests made to Sonnet 4. Two more bugs arose from deployments on August 25 and 26. Although initial impacts were limited, a load balancing change on August 29 started to increase affected traffic. This caused many more users to experience issues while others continued to see normal performance, creating confusing and contradictory reports.

Three overlapping issues

Below we describe the three bugs that caused the degradation, when they occurred, and how we resolved them:

1. Context window routing error

On August 5, some Sonnet 4 requests were misrouted to servers configured for the upcoming1M tokencontext window. This bug initially affected 0.8% of requests. On August 29, a routine load balancing change unintentionally increased the number of short-context requests routed to the 1M context servers. At the worst impacted hour on August 31, 16% of Sonnet 4 requests were affected. Approximately 30% of Claude Code users who made requests during this period had at least one message routed to the wrong server type, resulting in degraded responses. On Amazon Bedrock, misrouted traffic peaked at 0.18% of all Sonnet 4 requests from August 12. Incorrect routing affected less than 0.0004% of requests on Google Cloud's Vertex AI between August 27 and September 16. However, some users were affected more severely, as our routing is "sticky". This meant that once a request was served by the incorrect server, subsequent follow-ups were likely to be served by the same incorrect server. Resolution:We fixed the routing logic to ensure short- and long-context requests were directed to the correct server pools. We deployed the fix on September 4. Rollout to our first-party platform and Google Cloud's Vertex AI was completed by September 16, and to AWS Bedrock by September 18.

2. Output corruption

On August 25, we deployed a misconfiguration to the Claude API TPU servers that caused an error during token generation. An issue caused by a runtime performance optimization occasionally assigned a high probability to tokens that should rarely be produced given the context, for example producing Thai or Chinese characters in response to English prompts, or producing obvious syntax errors in code. A small subset of users that asked a question in English might have seen "สวัสดี" in the middle of the response, for example. This corruption affected requests made to Opus 4.1 and Opus 4 on August 25-28, and requests to Sonnet 4 August 25–September 2. Third-party platforms were not affected by this issue. Resolution:We identified the issue and rolled back the change on September 2. We've added detection tests for unexpected character outputs to our deployment process.

3. Approximate top-k XLA:TPU miscompilation

On August 25, we deployed code to improve how Claude selects tokens during text generation. This change inadvertently triggered a latent bug in the XLA:TPU[1]compiler, which has been confirmed to affect requests to Claude Haiku 3.5. We also believe this could have impacted a subset of Sonnet 4 and Opus 3 on the Claude API. Third-party platforms were not affected by this issue. Resolution:We first observed the bug affecting Haiku 3.5 and rolled it back on September 4. We later noticed user reports of problems with Opus 3 that were compatible with this bug, and rolled it back on September 12. After extensive investigation we were unable to reproduce this bug on Sonnet 4 but decided to also roll it back out of an abundance of caution. Simultaneously, we have (a) been working with the XLA:TPU team on a fix for the compiler bug and (b) rolled out a fix to use exact top-k with enhanced precision. For details, see the deep dive below.

A closer look at the XLA compiler bug

To illustrate the complexity of these issues, here's how the XLA compiler bug manifested and why it proved particularly challenging to diagnose. When Claude generates text, it calculates probabilities for each possible next word, then randomly chooses a sample from this probability distribution. We use "top-p sampling" to avoid nonsensical outputs—only considering words whose cumulative probability reaches a threshold (typically 0.99 or 0.999). On TPUs, our models run across multiple chips, with probability calculations happening in different locations. To sort these probabilities, we need to coordinate data between chips, which is complex.[2] In December 2024, we discovered our TPU implementation would occasionally drop the most probable token whentemperaturewas zero. We deployed a workaround to fix this case. The root cause involved mixed precision arithmetic. Our models compute next-token probabilities inbf16(16-bit floating point). However, the vector processor isfp32-native, so the TPU compiler (XLA) can optimize runtime by converting some operations to fp32 (32-bit). This optimization pass is guarded by thexla_allow_excess_precisionflag which defaults to true. xla_allow_excess_precision This caused a mismatch: operations that should have agreed on the highest probability token were running at different precision levels. The precision mismatch meant they didn't agree on which token had the highest probability. This caused the highest probability token to sometimes disappear from consideration entirely. On August 26, we deployed a rewrite of our sampling code to fix the precision issues and improve how we handled probabilities at the limit that reach the top-p threshold. But in fixing these problems, we exposed a trickier one. xla_allow_excess_precision Our fix removed the December workaround because we believed we'd solved the root cause. This led to a deeper bug in theapproximate top-koperation—a performance optimization that quickly finds the highest probability tokens.[3]This approximation sometimes returned completely wrong results, but only for certain batch sizes and model configurations. The December workaround had been inadvertently masking this problem. The bug's behavior was frustratingly inconsistent. It changed depending on unrelated factors such as what operations ran before or after it, and whether debugging tools were enabled. The same prompt might work perfectly on one request and fail on the next. While investigating, we also discovered that the exact top-k operation no longer had the prohibitive performance penalty it once did. We switched from approximate to exact top-k and standardized some additional operations on fp32 precision.[4]Model quality is non-negotiable, so we accepted the minor efficiency impact.

Why detection was difficult

Our validation process ordinarily relies on benchmarks alongside safety evaluations and performance metrics. Engineering teams perform spot checks and deploy to small "canary" groups first. These issues exposed critical gaps that we should have identified earlier. The evaluations we ran simply didn't capture the degradation users were reporting, in part because Claude often recovers well from isolated mistakes. Our own privacy practices also created challenges in investigating reports. Our internal privacy and security controls limit how and when engineers can access user interactions with Claude, in particular when those interactions are not reported to us as feedback. This protects user privacy but prevents engineers from examining the problematic interactions needed to identify or reproduce bugs. Each bug produced different symptoms on different platforms at different rates. This created a confusing mix of reports that didn't point to any single cause. It looked like random, inconsistent degradation. More fundamentally, we relied too heavily on noisy evaluations. Although we were aware of an increase in reports online, we lacked a clear way to connect these to each of our recent changes. When negative reports spiked on August 29, we didn't immediately make the connection to an otherwise standard load balancing change.

What we're changing

As we continue to improve our infrastructure, we're also improving the way we evaluate and prevent bugs like those discussed above across all platforms where we serve Claude. Here's what we're changing:

  • More sensitive evaluations:To help discover the root cause of any given issue, we’ve developed evaluations that can more reliably differentiate between working and broken implementations. We’ll keep improving these evaluations to keep a closer eye on model quality.
  • Quality evaluations in more places:Although we run regular evaluations on our systems, we will run them continuously on true production systems to catch issues such as the context window load balancing error.
  • Faster debugging tooling:We'll develop infrastructure and tooling to better debug community-sourced feedback without sacrificing user privacy. Additionally, some bespoke tools developed here will be used to reduce the remediation time in future similar incidents, if those should occur.

Evals and monitoring are important. But these incidents have shown that we also need continuous signal from users when responses from Claude aren't up to the usual standard. Reports of specific changes observed, examples of unexpected behavior encountered, and patterns across different use cases all helped us isolate the issues. It remains particularly helpful for users to continue to send us their feedback directly. You can use the/bugcommand in Claude Code or you can use the "thumbs down" button in the Claude apps to do so. Developers and researchers often create new and interesting ways to evaluate model quality that complement our internal testing. If you'd like to share yours, reach out tofeedback@anthropic.com. /bug We remain grateful to our community for these contributions.

Acknowledgments

Written by Sam McAllister, with thanks to Stuart Ritchie, Jonathan Gray, Kashyap Murali, Brennan Saeta, Oliver Rausch, Alex Palcuie, and many others. [1]XLA:TPU is the optimizing compiler that translatesXLAHigh Level Optimizing language—often written usingJAX—to TPU machine instructions. [2]Our models are too large for single chips and are partitioned across tens of chips or more, making our sorting operation a distributed sort. TPUs (just like GPUs and Trainium) also have different performance characteristics than CPUs, requiring different implementation techniques using vectorized operations instead of serial algorithms. [3]We had been using this approximate operation because it yielded substantial performance improvements. The approximation works by accepting potential inaccuracies in the lowest probability tokens, which shouldn't affect quality—except when the bug caused it to drop the highest probability token instead. [4]Note that the now-correct top-k implementation may result in slight differences in the inclusion of tokens near the top-p threshold, and in rare cases users may benefit from re-tuning their choice of top-p.