Automated Reasoning policy refinement in Amazon Bedrock
https://aws.amazon.com/blogs/machine-learning/automated-reasoning-policy-refinement-in-amazon-bedrock/📌 【AWS 技術更新】Amazon Bedrock 推出自動化推理策略修正,告別手動編輯形式邏輯的繁瑣流程
TL;DR:Amazon Bedrock 透過自動化診斷與修正,將原本需手動編輯形式邏輯(formal logic)的循環,轉化為「審核並套用」的自動化流程。
在建立 Amazon Bedrock Guardrails 的 Automated Reasoning(自動化推理)策略時,工程師常面臨一個巨大的摩擦點:當測試失敗時,必須經歷「診斷 → 手動編輯形式邏輯 → 重新測試 → 重複上述步驟」的漫長循環。這種迭代過程不僅耗時,更需要專業知識來維護複雜的規則。
🧩 兩階段驗證流程:問題發生的根源在哪?
為了理解如何修正,首先必須了解 Automated Reasoning 的驗證流程。當系統檢查一個回應時,會經過兩個步驟:
- 翻譯階段 (Translate):將自然語言的輸入與輸出,根據策略中的變數描述,轉換為變數賦值(variable assignments)。
- 驗證階段 (Validate):將這些賦值應用於策略中的形式規則,最後輸出結果(如 VALID、INVALID、SATISFIABLE、IMPOSSIBLE 或 TRANSLATION_AMBIGUOUS)。
當測試失敗時,問題通常出在這兩個階段之一。
🤔 針對不同錯誤類型,提供兩大修正模式
根據測試結果的不同,AWS 提供了兩種專門的修正模式,以精準解決不同層級的問題:
- 迭代修正模式 (Iterative Refinement):針對「規則問題」設計。 當翻譯正確(變數與數值皆符合預期),但驗證結果卻與預期不符(例如預期為 INVALID 卻得到 SATISFIABLE)時,代表問題出在規則太過寬鬆、過於嚴格或完全缺失。
- 模糊變數修正模式 (Ambiguous Variable Refinement):針對「語言問題」設計。
當系統回傳
TRANSLATION_AMBIGUOUS時,代表翻譯模型對於如何將自然語言對應到策略變數存在歧義(例如「任期」與「服務年資」定義重疊,或「5%」與「0.05」格式不一),導致產生多種可能的解釋。
📊 迭代修正:從手動編輯轉向「審核與核准」
針對最常見的規則錯誤,ITERATIVELY_REFINE_POLICY 模式大幅簡化了開發流程。
- 傳統做法:專家需手動追蹤規則、提出假設,並親自編輯 SMT-LIB 形式邏輯。
- 自動化做法:工程師只需提供「現有策略定義」、「包含權威內容的來源文件」以及「選填的自然語言回饋」(例如:「請根據文件第三章,將育嬰假的要求從 12 個月改為 6 個月」)。
引擎會在後臺進行多次內部迭代,模擬不同規則變更對測試集的影響,最終只會產出一個「收斂後的結果」。工程師看到的不是複雜的修改過程,而是一個清晰的 Diff 介面,顯示哪些規則與變數被更動了,並直接選擇「Accept changes」或「Discard changes」。
🛠️ 如何透過程式化方式操作
對於需要整合至自動化工作流的開發者,可以使用 AWS SDK for Python (Boto3) 進行操作:
- 匯出:匯出目前的策略定義。
- 啟動:呼叫
start_build_workflow並設定buildWorkflowType為ITERATIVELY_REFINE_POLICY。 - 輪詢:使用
get_automated_reasoning_policy_build_workflow監控狀態(從 SCHEDULED → BUILDING → COMPLETED)。 - 取得:當狀態變為終止狀態後,取得建議的變更內容。
🎯 實務啟示
這項功能對開發者最大的價值在於「降低門檻」。工程師不再需要成為形式邏輯專家,只需專注於定義業務邏輯(透過自然語言文件),並透過「審核」機制來確保 AI 代理(Agent)的安全性與正確性。這對於需要高度合規性與精準度的企業應用場景至關重要。
🔗 來源
- 標題:Automated Reasoning policy refinement in Amazon Bedrock
- 作者/機構:Nafi Diallo @ AWS ML
- 連結:https://aws.amazon.com/blogs/machine-learning/automated-reasoning-policy-refinement-in-amazon-bedrock/
#AWS #AmazonBedrock #MachineLearning #AutomatedReasoning #AIModelSafety #LLM #FormalVerification #CloudComputing #SoftwareEngineering #AIInfrastructure
原始資料 AWS ML · 收集於 2026-08-04
摘要原文
Refining an Automated Reasoning policy in Amazon Bedrock has been a manual cycle of diagnose, hand-edit, retest, and repeat. Today, we are announcing automatic policy refinement, which automates the diagnose-and-fix work in that cycle. The refinement engine diagnoses failing tests and proposes formal-logic fixes. You approve every change before it takes effect. Automated Reasoning checks in Amazon Bedrock Guardrails use formal verification to prove answer correctness. On unambiguous translations from natural language to formal logic, they deliver up to 99% verification accuracy, as reported in the GA announcement . To get started, you build an Automated Reasoning policy from a source document and validate it with test cases. Customers told us that this iterative tuning creates the biggest friction point in policy development. In this post, we walk through two new refinement modes: Iterative Refinement for rule issues, and Ambiguous Variable Refinement for language issues. For each mode, we show a complete API workflow (start, poll, retrieve) and a repeatable console workflow for turning failing policies into passing ones. Automated Reasoning checks translate natural language into formal logic, then apply automated reasoning techniques to produce a finding: VALID , INVALID , SATISFIABLE , IMPOSSIBLE , or TRANSLATION_AMBIGUOUS . For a full introduction to how policies work, refer to our GA announcement post . For this post, the key concept is the two-step validation pipeline . First, the translate step maps natural-language input/output to variable assignments using the variable descriptions in your policy. Second, the validate step applies your formal rules to those assignments. When a test fails, the root cause lives in one of those two steps, and each refinement mode targets a different one. Figure 1 traces that pipeline end to end. Figure 1: How Automated Reasoning checks validate a response at runtime. Automated Reasoning checks translate natural language into variables using the policy’s variable descriptions, then validate those variables against the policy’s formal rules to return a finding. This two-step pipeline is why refinement has two modes. Testing your policy. You validate a policy by attaching tests: each test is input/output text plus the result you expect. Run tests individually or as a batch. Failures tell you exactly where the policy diverges from your intent. Recall the two-step pipeline: translate (natural language to variable assignments) and then validate (formal logic to finding). A failed test means one of these steps produced something you didn’t expect. Automated Reasoning checks surface two distinct failure signals that map cleanly to each step. In a rule-issue failure, the translation works correctly: the right variables have the right values, but the validation result doesn’t match your expectation. The problem lives in your rules: a rule is too permissive, too restrictive, or missing entirely. Concretely, you expected INVALID but got SATISFIABLE because a missing or too-permissive rule lets a bad answer through. Or you expected SATISFIABLE but got INVALID because an overly strict rule blocks a correct answer. Mental model: The system understood the question perfectly but applied the wrong logic. You need to fix the rules . When a test returns TRANSLATION_AMBIGUOUS , the validation engine runs and produces different outcomes depending on which interpretation it follows. In some cases, the translation models disagreed on how to map the natural-language input to your policy’s variables, and each competing interpretation led to a different validation result. The finding surfaces two or more options, each with its own translation and conclusion, plus differenceScenarios showing where the interpretations diverge in practice. Common root causes include overlapping variable definitions (“tenure” compared to “years of service”), vague descriptions, and inconsistent value formats (5 compared to 0.05 for “5%”). This table summarizes which refinement mode addresses which failure type: Use Ambiguous Variable Refinement when the system cannot determine a single translation. The next two sections walk through each mode in turn: what it does, when to use it, how the review gate works, and how to launch it programmatically. We start with Iterative Refinement because rule-issue failures are the more common case. When tests fail because the logic is wrong (the translation is clean but the validation result doesn’t match your expectation), the problem lives in your rules. Iterative Refinement ( ITERATIVELY_REFINE_POLICY ) automates the diagnose-and-fix cycle so you don’t need to manually trace each rule, hypothesize a correction, and hand-edit formal logic. Consider a policy with 10–30 rules. Previously, a fix would take a subject matter expert multiple rounds of manual diagnosis and hand-editing of SMT-LIB formal logic. That work now compresses to a single review-and-approve step, with no formal logic written by hand. Iterative Refinement takes three inputs. The first is your existing policy definition (the current rules, variables, and types). The second is a source document containing the authoritative natural-language text that describes how things should work. The third input is optional: natural language feedback with explicit instructions describing the change you want. For example, the feedback field might contain: “Update the tenure requirement for parental leave from 12 months to 6 months, as specified in section 3 of the revised document.” Given these inputs, the refinement engine analyzes how the current rules diverge from the source document and your feedback. It proposes a set of candidate changes (new rules, edited rules, added variables) that bring the policy in line. Iterative Refinement, as the name suggests, iterates. Behind the scenes, the engine generates a candidate change, simulates its effect on your saved tests, checks whether the previously failing tests now pass, and adjusts if they don’t. This can involve several internal cycles for a single request, especially when a fix in one rule ripples into others. The iteration happens internally , though: you don’t observe each intermediate attempt, and you don’t need to shepherd it. What you receive is the converged result: a proposed diff that shows exactly which rules changed, which variables changed, and how the change affects every test in your suite. After convergence, the Review policy changes screen appears. You then select Accept changes or Discard changes . Accepting writes the changes to your DRAFT policy. Discarding leaves everything exactly as it was. Iterative Refinement requires at least one test attached to your policy. Without a failing test signal, there’s nothing to drive the refinement. Use this mode when the translation is correct (right variables, right values) but the validation result is unexpected. Do not use it when the finding is TRANSLATION_AMBIGUOUS . That’s a language problem better addressed by Ambiguous Variable Refinement . Refinement runs as an asynchronous build workflow. Using the AWS SDK for Python (Boto3), the flow has four steps: export the current policy definition, start the workflow, poll for completion, and retrieve the proposed changes. Set buildWorkflowType to ITERATIVELY_REFINE_POLICY . The iterativeRefinementContent block accepts one to five source documents (required) and up to 4,000 characters of optional feedback: The call returns immediately with a buildWorkflowId , not the proposed changes. The workflow moves from SCHEDULED to BUILDING until it reaches COMPLETED , FAILED , or CANCELLED . Convergence typically takes one to a few minutes, depending on policy size. Poll get_automated_reasoning_policy_build_workflow until the status reaches a terminal state.
由 tencent/hy3:free 自動生成