AIsaAIsaStudio English 打开 AIsa Studio

AWS 指南:生成式 AI 降本,规则用代码、判断用模型

原标题:Cut generative AI costs: Code for rules, models for judgment

AWS 官方博客提出降低生成式 AI 成本的方法:先判断工作流每一步是否需要调用模型,而不是先选哪个模型。文章给出三问决策流程,把规则可判定步骤交给确定性代码、固定选项步骤交给带升级信号的受限决策调用、只有开放式任务才用按需选型的 Amazon Bedrock 模型,并用 AWS Step Functions、AWS Lambda、API Gateway 请求验证、structured outputs 和 Strands Decider 等组件给出落地方案。

为什么值得看

原文给出一个可直接套用的三问决策流程图和落地到 AWS 各组件的方案,帮助读者在写代码前先判断哪些步骤根本不必调用模型。

阅读原文 ↗11月18日 AI 日报

本页的摘要、推荐理由与解读出自 AIsa Studio 的 AI 风向智能体,原文版权归原作者所有。

深度解读

发生了什么

AWS Machine Learning 发布了一篇生成式 AI 降本指南,核心观点是:生成式 AI 系统中最大的成本杠杆,是某一步到底要不要调用模型。文中指出,团队常把所有任务都交给大语言模型处理,包括输入校验、格式化和路由。单次调用看似便宜,但在生产规模下,这些小额成本会成为架构中最大的开销项之一。

指南给出了在 AWS 上的三种选项映射:确定性代码、受约束的决策调用,或 Amazon Bedrock 上尺寸合适的模型。

关键细节

判断方法是一个流程图,包含三个按序提问,命中第一个满足要求的选项即停止:

  • 规则能否判定成功(格式、schema、关键词、数值范围)?
  • 模型能否一次性写出规则,比如正则表达式或 JSON schema?
  • 该步骤是否从固定列表中选一个答案,如路由、分类或是否判断?

如果三个答案都是否,该步骤属于开放式任务,交给尺寸合适的模型。文中以客服助手为例演示了五个步骤的映射:订单号格式校验用 API Gateway 请求校验或 Lambda;意图路由用关键词快速路径,剩余部分走受约束的决策调用;从承运商邮件提取单号用模型起草正则、人工审核后提交为代码;工单分派队列用受约束的决策调用,不确定时升级;起草回复用满足要求的 Bedrock 最小模型。

文章对比了确定性代码与模型调用:代码单次调用成本「通常低几个数量级」,延迟在个位数毫秒以内,对明确规则是精确的,规则在版本控制中可审计,且行为稳定不变;模型按 token 计费、增加数百毫秒延迟,即使温度为 0 也仍有非零错误率,且换模型版本时行为会变。

对固定选项的步骤,文章描述了分层、基于置信度的升级模式,在 AWS 上有四种实现方式:带结构化输出的小型 Bedrock 模型(含触发升级的 "unsure" 选项);用 Bedrock embeddings 模型做嵌入相似度匹配并设阈值;Strands Decider——一个 Apache License 2.0 下的实验性开源决策模型,其 README 称在短分类任务上置信度 0.9 以上的答案正确率约 95%(需在自有数据上验证);以及在 SageMaker AI 上训练的分类器。

「确定性快速路径」模式先跑规则检查,只把规则解决不了的部分送进模型。文中给出示意性算术:若规则能解决 95% 的请求,则只有二十分之一的请求到达模型。AWS 构件包括 Step Functions Choice 状态(配合 JSONata)、Lambda、API Gateway 请求校验,以及 Bedrock 结构化输出。确实需要模型时应按质量下限、成本上限、延迟目标和合规约束做尺寸选择,可用 Bedrock Intelligent Prompt Routing 和 Model Distillation。文章还建议把模型选择当作受测试的配置:在持续集成中运行带标注的金标评估集、做回归门禁、用配置开关便于回滚、并用影子模式监控漂移。

为什么重要

包括 AWS Well-Architected Generative AI Lens 在内的成本指南,通常从模型选择讲起。而这篇文章提前一步问:这一步需不需要模型?并把问题重新表述为「做决策,而不是做生成」。由于支出随请求量增长、链路中每次调用都会叠加延迟、非确定性又让测试和审计变慢,把规则型任务从模型上移走被描述为「通常最大、也最安全的收益」。文章给出的落地路径是:给每类调用打标并度量,把规则移到代码,增加带升级机制的受约束决策调用,以及在新模型成为默认之前先用金标评估集测试。文中同时给出安全提示:不要在配置文件里运行任意代码,并警惕模型写的正则中嵌套量词导致的 ReDoS。

对谁有影响

该指南面向已走出原型规模、小额成本开始随请求量累积的生成式 AI 工程团队。对使用 Amazon Bedrock、Step Functions、Lambda、API Gateway 和 SageMaker AI 的 AWS 团队直接适用;文章指出受监管的业务负载更偏好规则,因为可审计性更强。每次新模型发布后都在重新争论该用哪个模型的团队,正是「这一步要不要模型」这个更早问题的目标读者。

全文翻译

以下翻译只覆盖原文的前一部分,其余内容请看下方原文。

生成式 AI 系统中最大的成本杠杆在于你是否真的调用了模型。我们经常看到团队将每个任务都通过大型语言模型(LLM)进行处理,包括输入验证、格式化和路由。每次调用在孤立看来都很便宜,但在生产规模下,这些微小的成本会成为架构中最大的支出项之一。只要确定性规则能完成任务的地方,跳过模型就能节省资金、降低延迟,并消除非确定性的来源。在本文中,你将学习如何判断工作流中的每一步是否真的需要模型。然后,你可以将每个选项映射到 AWS:确定性代码、受限决策调用,或在 Amazon Bedrock 上运行合适规模的模型。

为什么不必要的模型调用会累积

这种模式通常始于原型开发。一个模型调用在某一步奏效,于是它就成了下一步的默认选择。这些步骤包括验证输入、重新格式化请求体以及选择路由。在原型阶段的流量下,没人会注意到成本。

在生产级别的流量下,不必要的模型调用会通过三种方式增加你的成本:

  • 随着请求数量的增长,支出也会增加,即使对于低价值的步骤也是如此。
  • 延迟叠加,因为链中的每次模型调用都会增加数百毫秒。
  • 输出可能发生变化,因为相同的输入可能会返回不同的答案。这使得测试更加困难,审计也更加缓慢。

每次新模型的发布都会重新引发关于使用哪个模型的争论。而最初的问题——这一步是否真的需要模型——却被忽略了。

成本指南,包括 AWS 良好架构生成式 AI 视角,通常从模型选择开始。本文则提前了一步:这一步是否真的需要模型?

如何判断某一步是否需要模型

图 1 将整个决策展示为一个带有三个标记区域的流程图:作为代码运行、问题、以及在模型上运行。依次对每个工作流步骤提出三个问题,并在第一个满足该步骤要求的选项处停止:

  1. 是否有规则可以检查成功与否,例如格式、模式、关键字或范围?如果规则只能解决步骤的一部分,快速路径会先运行规则。
  2. 模型是否可以编写一次规则,例如正则表达式或 JSON 模式?
  3. 该步骤是否从固定列表中选择一个答案,例如路由、类别或“是/否”?

如果这三个问题的答案都是“否”,则该步骤是开放式的,应在合适规模的模型上运行。

流程图,将工作流步骤分类为代码、受限决策调用或合适规模的 Amazon Bedrock 模型

图 1:决定工作流步骤是否需要模型,以及需要哪种模型

考虑一个客户支持助手。下表展示了其五个步骤如何通过图表进行筛选。

#

步骤

通过图表的路径

运行位置

1

检查订单号的格式

规则可以检查成功与否。

Amazon API Gateway REST API 请求验证,或 AWS Lambda 函数

2

按意图路由消息

规则解决了部分问题。快速路径上的关键字匹配解决了诸如“退款”之类的消息,剩余部分进入第三个问题。

使用 JSONata 的 AWS Step Functions Choice 状态。剩余部分进入受限决策调用。

3

从承运商电子邮件中提取追踪号

模型可以编写一次规则。它起草一个正则表达式,你进行审核并提交。

代码,作为 AWS Lambda 中提交的模式

4

为工单选择四个支持队列中的一个

答案来自固定列表。

受限决策调用。不确定的答案升级到合适规模的模型。

5

草拟给客户的回复

任务是开放式的。

合适规模的模型,即满足要求的最小 Amazon Bedrock 模型

当任务是开放式、模糊或生成式时,可以使用模型:总结文档、草拟回复、从文本中提取含义。当任务有可检查的规则时,使用确定性代码:电子邮件格式、模式、确切的关键字、数值范围。下表展示了将具有规则形状的任务发送给模型时所放弃的特性。

特性

确定性代码

模型调用

每次调用的成本

通常低几个数量级

按令牌计费,在大规模下不可忽视

延迟

个位数毫秒或更少

数百毫秒

对明确指定规则的正确性

对编写的规则完全准确

高,但存在非零的错误率

可审计性

规则位于源代码控制中

向审计员解释起来更困难

随时间的行为

稳定,直到你更改它

当你迁移到新模型版本或旧版本被弃用时,行为会发生变化

模型也可能产生幻觉,并对相同的输入返回不同的答案。温度设为 0 会降低出现不同答案的可能性,但不能保证输出完全相同。Amazon Bedrock 模型评估 和 Amazon Bedrock Guardrails 帮助你衡量和控制这些风险。规则没有这两个问题,这也是受监管的工作负载倾向于使用规则的原因之一。一个有用的测试:如果你可以将验收测试写成一个规则,那么通常你也可以将该步骤写成一个规则。更多信息,请参阅 AWS 建议指南中的 编排模型:从基于规则到 AI 原生。

决定,而非生成

大多数路由和分类步骤介于规则和开放式生成之间。规则无法决定所有情况,但这些步骤也不需要生成的文本。它们需要从预先定义的固定选项列表中选择一个答案,如前例中的支持队列。使用限制其输出为允许答案的组件,并在何时升级时给你一个信号。自信的答案继续处理,不确定的答案则升级。AWS 良好架构 Agentic AI 视角描述了这种 分层、基于置信度的升级机制。在 AWS 上,你可以通过四种方式构建它:

  • 带有结构化输出的小型 Amazon Bedrock 模型 – 答案被限制为选项的 enum,加上触发升级的“不确定”选项。这是模型自己的判断,而不是校准后的分数,因此在使用它来决定升级之前,请用标记数据对其进行校验。
  • 嵌入相似度 – 使用 Amazon Bedrock 嵌入模型对输入进行嵌入,并选择最接近的标记示例。使用相似度分数作为升级信号,并在标记数据上设置其阈值。
  • Strands Decider,一款 Apache License 2.0 下的实验性开源决策模型 – 它从选项中挑选或根据标准评分,并为每个答案返回校准后的置信度。其 README 报告称,在短分类任务中,置信度为 0.9 或以上的答案大约 95% 是正确的。由于该模型处于实验阶段,请在使用前在自己的数据上验证该结果。你自己托管它,例如在 Amazon SageMaker AI 端点上,遵循其仓库中的 部署指南。
  • Amazon SageMaker AI 上的训练分类器 – 一旦拥有标记的训练数据,它以低延迟和低成本返回类别概率。

以下 JSON 模式将结构化输出答案限制为四个队列加上“不确定”。Amazon Bedrock 要求模式中的每个对象都将 additionalProperties 设置为 false。

{
  "type": "object",
  "properties": {
    "queue": {
      "type": "string",
      "enum": ["billing", "technical", "account", "other", "unsure"]
    }
  },
  "required": ["queue"],
  "additionalProperties": false
}

无论你选择哪种选项,都用你自己的标记数据检查其升级信号,并在那里设置任何阈值。将你的授权决策(例如退款限额)保留在规则中。

确定性快速路径模式

许多成本模式专注于模型之间的路由。快速路径更进一步:首先运行确定性检查,并将规则无法解决的请求发送给模型。意图路由就是一个例子。许多消息携带明确的信号,例如“退款”或“重置我的密码”,关键字匹配可以在个位数毫秒或更短时间内解决。如果规则解决了 95% 的请求,那么在通过模型选择获得任何节省之前,只有 1/20 的请求到达模型。(说明性算术,非基准测试。)

在 AWS 上,你可以从现有的构建块中组合出这种模式:

  • AWS Step Functions Choice 状态在工作流调用任何模型之前进行分支。
  • AWS Lambda 托管需要比 Choice 状态更复杂的规则,例如验证和模式检查。
  • Amazon API Gateway (REST API) 请求验证在任何计算运行之前拒绝格式错误的输入。
  • 受限决策调用或 Amazon Bedrock 模型仅处理剩余部分。

以下 Choice 状态是一个关键字快速路径。它使用 JSONata 将退款和密码重置消息直接发送到代码,并将其他所有内容发送到受限决策调用。

"KeywordFastPath": {
  "Type": "Choice",
  "QueryLanguage": "JSONata",
  "Choices": [
    {
      "Condition": "{% $contains($states.input.message, /refund/i) %}",
      "Next": "RefundFlow"
    },
    {
      "Condition": "{% $contains($states.input.message, /reset (my )?password/i) %}",
      "Next": "PasswordResetFlow"
    }
  ],
  "Default": "ConstrainedDecisionCall"
}

你也可以让模型编写一次规则,而不是每次都运行它。让它起草一个正则表达式或 JSON 模式,审核并提交。在运行时,规则以规则的速度和成本运行。审核模型编写的正则表达式,并用已知的好坏输入进行测试。避免使用嵌套量词,如 (a+)+,这可能导致在某些输入上匹配非常慢(正则表达式拒绝服务,即 ReDoS)。

当你确实需要生成时,Amazon Bedrock 结构化输出会将响应约束为你定义的 JSON 模式。响应随后与模式匹配,因此你的代码可以解析它而无需自定义解析逻辑(检查内容的正确性)。将范围检查(如数值界限和长度限制)保留在代码中。有关支持的模型和模式功能,请参阅 从模型获取验证的 JSON 结果。

如果你的规则存在于配置中,只允许已知的原语,例如正则表达式、模式检查、关键字列表和范围检查。永远不要从配置文件中运行任意代码。

当你确实需要模型时,将其调整到合适规模

选择满足你质量底线的最便宜且最快的模型。这通常不是最新或最大的模型。生成式 AI 视角在其关于 调整模型选择规模的最佳实践 中涵盖了这一点。针对 Amazon Bedrock 的有效成本优化策略 对此进行了深入介绍。在比较模型之前定义需求:

  • 质量底线: 最低可接受的输出质量,通过在黄金评估集(带有已知正确答案的任务标记示例)上测量得出。
  • 成本上限: 每次请求或每次成功结果所支付的最高费用。
  • 延迟目标: 体验所能容忍的 p95 或 p99 响应时间。
  • 合规约束: 如数据驻留等要求,可能会排除某些候选模型。

Amazon Bedrock 提供多种模型系列

查看原文

The biggest cost lever in a generative AI system is whether you call a model at all. We often see teams route every task through a large language model (LLM), including input validation, formatting, and routing. Each call is cheap in isolation, but at production scale these small costs become one of the largest line items in the architecture. Wherever a deterministic rule can do the job, skipping the model saves money, cuts latency, and removes a source of non-determinism. In this post, you learn how to decide whether each step in a workflow needs a model at all. You can then map each option to AWS: deterministic code, a constrained decision call, or a right-sized model on Amazon Bedrock.

Why unneeded model calls add up

The pattern usually starts in a prototype. A model call works for one step, so it becomes the default for the next. Those steps include validating input, reformatting a request body, and picking a route. At prototype volume, nobody notices the cost.

At production volume, unneeded model calls cost you in three ways:

  • Spend grows with request count, even for low-value steps.
  • Latency stacks, because every model call in a chain adds hundreds of milliseconds.
  • Output can vary, because the same input can return a different answer. That makes testing harder and audits slower.

Each new model launch then restarts the debate about which model to use. The earlier question, whether the step needs a model at all, goes unasked.

Cost guidance, including the AWS Well-Architected Generative AI Lens, often starts at model selection. This post starts one step earlier: Does the step need a model at all?

How to decide whether a step needs a model

Figure 1 shows the whole decision as a flowchart with three labeled lanes: Runs as code, Questions, and Runs on a model. Take each workflow step through three questions in order, and stop at the first option that meets the step’s requirements:

  1. Can a rule check success, such as a format, a schema, a keyword, or a range? If a rule settles only part of the step, a fast path runs the rule first.
  2. Can a model write the rule once, such as a regular expression or a JSON schema?
  3. Does the step pick one answer from a fixed list, such as a route, a class, or yes or no?

If the answer to all three is no, the step is open-ended and runs on a right-sized model.

Flowchart that sorts a workflow step into code, a constrained decision call, or a right-sized Amazon Bedrock model

Figure 1: Deciding whether a workflow step needs a model, and which one

Consider a customer support assistant. The following table shows how five of its steps go through the chart.

#

Step

Path through the chart

Where it runs

1

Check an order number’s format

A rule can check success.

Amazon API Gateway REST API request validation, or an AWS Lambda function

2

Route a message by intent

A rule settles part of it. A keyword match on the fast path resolves messages such as “refund”, and the residual goes to the third question.

An AWS Step Functions Choice state that uses JSONata. The residual goes to a constrained decision call.

3

Extract a tracking number from a carrier email

A model can write the rule once. It drafts a regular expression, and you review and commit it.

Code, as a committed pattern in AWS Lambda

4

Pick one of four support queues for a ticket

The answer comes from a fixed list.

A constrained decision call. Unsure answers escalate to the right-sized model.

5

Draft a reply to the customer

The task is open-ended.

The right-sized model, the smallest Amazon Bedrock model that meets the requirements

You can use a model when a task is open-ended, ambiguous, or generative: summarizing a document, drafting a reply, extracting meaning from prose. Use deterministic code when the task has a checkable rule: an email format, a schema, an exact keyword, a numeric range. The following table shows what you trade away when you send a rule-shaped task to a model.

Property

Deterministic code

Model call

Cost per invocation

Typically orders of magnitude lower

Per-token, non-trivial at scale

Latency

Single-digit milliseconds or less

Hundreds of milliseconds

Correctness on a well-specified rule

Exact for the rule as written

High, but with a non-zero error rate

Auditability

The rule sits in source control

Harder to explain to an auditor

Behavior over time

Stable until you change it

Changes when you move to a new model version, or when a version is retired

A model can also hallucinate and return different answers to the same input. A temperature of 0 makes varied answers less likely, but it doesn’t guarantee identical output. Amazon Bedrock model evaluation and Amazon Bedrock Guardrails help you measure and contain these risks. A rule has neither problem, which is one reason regulated workloads favor rules. A useful test: If you can write the acceptance test as a rule, you can usually write the step as a rule. For more information, refer to Orchestration models: From rule-based to AI-native in AWS Prescriptive Guidance.

Decide, don’t generate

Most routing and classification steps sit between a rule and open-ended generation. A rule can’t decide every case, but these steps don’t need generated text either. They need one answer from a fixed list of options that you define in advance, like the support queues in the preceding example. Use a component that limits its output to the allowed answers and gives you a signal for when to escalate. Confident answers proceed, and uncertain ones escalate. The AWS Well-Architected Agentic AI Lens describes this tiered, confidence-based escalation. On AWS, you can build it four ways:

  • A small Amazon Bedrock model with structured outputs – The answer is limited to an enum of options, plus an ‘unsure’ option that triggers escalation. This is the model’s own judgment, not a calibrated score, so check it against labeled data before you use it to decide escalation.
  • Embedding similarity – Embed the input with an Amazon Bedrock embeddings model and pick the nearest labeled example. Use the similarity score as an escalation signal, and set its threshold on labeled data.
  • Strands Decider, an experimental open source decision model under the Apache License 2.0 – It picks from options or scores against a rubric, and it returns a calibrated confidence with each answer. Its README reports that answers at a confidence of 0.9 or more are right about 95 percent of the time on short classification tasks. Because the model is experimental, validate that result on your own data before you use it in production. You host it yourself, for example on an Amazon SageMaker AI endpoint, by following the deployment guides in its repository.
  • A trained classifier on Amazon SageMaker AI – It returns class probabilities with low latency and cost once you have labeled training data.

The following JSON schema limits a structured-output answer to four queues plus ‘unsure’. Amazon Bedrock requires every object in the schema to set additionalProperties to false.

{
  "type": "object",
  "properties": {
    "queue": {
      "type": "string",
      "enum": ["billing", "technical", "account", "other", "unsure"]
    }
  },
  "required": ["queue"],
  "additionalProperties": false
}

Whichever option you choose, check its escalation signal against your own labeled data, and set any threshold there. Keep your authorization decisions, such as a refund limit, in a rule.

The deterministic fast-path pattern

Many cost patterns focus on routing between models. The fast path goes one level earlier: Run the deterministic check first, and send only what the rule can’t settle to a model. Intent routing is one example. Many messages carry an unambiguous signal, such as “refund” or “reset my password”, which a keyword match resolves in single-digit milliseconds or less. If rules resolve 95 percent of requests, only 1 in 20 requests reaches a model, before any savings from model selection. (Illustrative arithmetic, not a benchmark.)

On AWS, you compose this from existing building blocks:

  • AWS Step Functions Choice states branch before the workflow invokes any model.
  • AWS Lambda hosts rules that need more than a Choice state, such as validation and schema checks.
  • Amazon API Gateway (REST API) request validation rejects malformed input before any compute runs.
  • A constrained decision call or an Amazon Bedrock model handles only the residual.

The following Choice state is a keyword fast path. It uses JSONata to send refund and password-reset messages straight to code, and it sends everything else to the constrained decision call.

"KeywordFastPath": {
  "Type": "Choice",
  "QueryLanguage": "JSONata",
  "Choices": [
    {
      "Condition": "{% $contains($states.input.message, /refund/i) %}",
      "Next": "RefundFlow"
    },
    {
      "Condition": "{% $contains($states.input.message, /reset (my )?password/i) %}",
      "Next": "PasswordResetFlow"
    }
  ],
  "Default": "ConstrainedDecisionCall"
}

You can also let a model write the rule once instead of running it every time. Have it draft a regular expression or a JSON schema, review it, and commit it. At runtime the rule runs at rule speed and cost. Review a model-written regular expression, and test it against known good and bad inputs. Avoid nested quantifiers such as (a+)+, which can make matching very slow on some inputs (regular expression denial of service, or ReDoS).

When you do generate, Amazon Bedrock structured outputs constrain a response to a JSON schema that you define. The response then matches the schema, so your code can parse it without custom parsing logic (check content for correctness). Keep range checks, such as numeric bounds and length limits, in code. For supported models and schema features, refer to Get validated JSON results from models.

If your rules live in configuration, allow only known primitives, such as regular expressions, schema checks, keyword lists, and range checks. Never run arbitrary code from a configuration file.

When you do need a model, right-size it

Choose the cheapest and fastest model that meets your quality floor. That is often not the newest or largest model. The Generative AI Lens covers this in its best practice on right-sizing model selection. Effective cost optimization strategies for Amazon Bedrock covers it in depth. Define the requirements before you compare models:

  • Quality floor: The minimum acceptable output quality, measured on a golden evaluation set (labeled examples of the task with known-correct answers).
  • Cost ceiling: The most you pay per request or per successful outcome.
  • Latency target: The p95 or p99 response time the experience can tolerate.
  • Compliance constraints: Requirements such as data residency that can rule out candidates.

Amazon Bedrock offers many model families and sizes behind one API, so you can right-size each task without changing your integration. Amazon Bedrock Intelligent Prompt Routing routes each request to a suitable model within a supported model family. Amazon Bedrock Model Distillation transfers knowledge from a larger model to a smaller, cheaper one for your use case. Model providers evaluate a new frontier model on broad benchmarks, but your workload is one task with one quality floor. A larger model can add cost and latency without improving that task. Before you switch, evaluate each launch against your requirements, such as quality on your golden evaluation set and your latency target.

Treat model choice as tested configuration

The Generative AI Lens recommends testing candidate models against your ground truth data and having a way to update the model quickly. Go further and treat the decision as a tested configuration:

  • Keep a golden evaluation set per task, with labeled ground truth, and run it in continuous integration.
  • Gate on your requirements. Treat a cheaper model that drops below the quality floor as a regression.
  • Put the model behind a configuration flag so that you can reverse a swap.
  • Verify with the right oracle. Check rules against ground truth. Reserve model-as-judge evaluation for open-ended outputs.
  • Watch for drift. Sample some rule-resolved requests through a model in shadow mode, and reclassify a step when they disagree.

Putting it into practice

Spend model capacity where judgment is needed, and nowhere else. You can get there in four steps:

  1. Instrument – Tag every call as deterministic code, a constrained decision call, or a model call. Track cost per successful outcome.
  2. Move the rules to code – Run rule-checkable steps on AWS Lambda or AWS Step Functions. This is usually the largest and safest win.
  3. Add constrained decision calls – Route fixed-choice steps through a call that escalates when it is unsure.
  4. Test before you switch models – Run every new model through your golden evaluation set before it becomes the default.

Conclusion

In this post, you learned how to decide whether a workflow step needs a model at all. Rules belong in deterministic code, and fixed choices belong in a constrained decision call. Open-ended work goes to a right-sized Amazon Bedrock model. Aim to meet each requirement at the lowest cost and latency that your quality floor allows. Ask whether a step needs a model before you ask which one.

For more information, refer to these posts on the AWS Artificial Intelligence Blog:

To try a constrained decision call, open the Amazon Bedrock console, or deploy Strands Decider from its GitHub repository.

Start with one high-volume workflow and measure how much of it never needed a model.


About the authors

原文版权归 AWS Machine Learning 及原作者所有,本站转载仅供阅读。如需删除,请联系 support@aisa.one。