AWS ML ★ 77 5 min

Sweep thousands of leases for compliance using Amazon Quick and the Adjudicated Query pattern

Advanced (300)Amazon Quick SuiteTechnical How-to

🔗 https://aws.amazon.com/blogs/machine-learning/sweep-thousands-of-leases-for-compliance-using-amazon-quick-and-the-adjudicated-query-pattern/

📌 規則引擎加對話介面:用AI稽核上萬份租約

TL;DR:AWS提出Adjudicated Query模式,用決定論規則引擎做合規判定,LLM只負責翻譯問題與講解結果。

當RAG的相似度搜尋說「這是最相關的結果」,卻沒人能說出「這代表全部」時,合規稽核這種高風險場景就會出問題,而且錯了也看不出來。

🤔 五萬份租約,遇上不斷變動的法規

文章設定的情境是:一個持有五萬份租約、橫跨多州的不動產營運商,每個州的房東房客法規(滯納金上限、通知期限、押金上限等)各自獨立修法。法規一變,合規團隊就得找出哪些租約已經不合規。小規模時人工審閱還可信,一旦量體變大,工作只能交給軟體,卻冒出新問題:螢幕上跳出的數字,沒有人能獨立驗證。文章指出,這正是合規稽核和一般企業搜尋的本質差異:RAG能解決「找得到資料」的問題,卻解決不了「判定是否完整、正確」這兩個要求。相似度搜尋沒有一個閾值能代表「全部都檢查過了」;排序後取樣,也永遠不知道被排除在外的是什麼。Text-to-SQL雖然能縮小這個落差,但帶著一種類別層級的風險:模型幻覺出的查詢條件,可能悄悄縮小了查詢母體範圍,而算出來的數字看起來依然精確,實際範圍卻是錯的。

🧩 Adjudicated Query:讓LLM只做翻譯與講解

AWS提出的Adjudicated Query模式,把對話介面做成一層有邊界的外殼,包在決定論式的規則引擎外面。模型只做兩件事:把自然語言問題翻譯成對一組固定、型別化操作(typed operations)的呼叫,以及把回傳結果用白話講出來。它不會自己寫查詢、不會決定查詢母體範圍,也不做任何合規判定。規則引擎本身把規則視為「版本化的資料」而非程式碼,只認得gte、lte、equals、exists這類通用比較運算子,程式碼裡不含任何指名特定州或主題的分支。法規一變,只是改一列規則表資料,而不是一次程式部署。每次合規掃描都會產出一張「完整性收據(completeness receipt)」:合規數加違規數加模糊案件數加無法判讀數必須等於掃描總數,這個等式在任何資料落地之前就先被計算與驗證,算不出這筆帳的掃描,根本不會被視為完成,也就沒有紀錄被悄悄漏掉的空間。對話介面只呈現統計數字、完整性收據與抽樣案例;完整的結果集(可能高達數萬列)則留在另一個直接讀同一份資料的儀表板上,逐筆可下鑽查核。

📊 架構組成

整體架構中,合規人員在Amazon Quick裡同時使用對話代理與Quick Sight儀表板兩個介面。對話代理先透過Amazon Cognito取得OAuth權杖,再以MCP(Model Context Protocol)請求經由Amazon API Gateway HTTP API驗證後送進AWS Lambda;Lambda裡同時跑著MCP伺服器與規則引擎,透過RDS Data API讀寫Amazon Aurora Serverless v2(Postgres + pgvector)。Quick Sight儀表板則直接透過VPC連線讀同一份Aurora資料,確保兩個介面看到的是同一套真相來源。Amazon Bedrock只在「探索式條款搜尋」這條支線路徑被呼叫:用Amazon Titan Text Embeddings V2做語意相似度排序,用Anthropic Claude Sonnet 5(透過跨區域推論設定檔)做條款的定性評估,但這條路徑完全不涉及正式的合規判定。MCP伺服器只對外暴露六個工具,每個工具語意明確單一,讓模型沒有辦法組合出錯誤的查詢母體範圍。

⚠️ 模型講解結果時仍要防堵改寫風險

文章特別提醒,把模型排除在「判定」之外,卻又讓它負責把結果「講出來」,等於在流程尾端重新引入風險:團隊在實測中發現講解時可能出現改寫(paraphrase)導致的問題,因此設計了三項工程防護手段來因應,核心原則是,安全保障機制如果撐不過模型的改寫,就等於沒有防護。

🎯 實務啟示

這個模式的適用場景很明確:當使用者需要用對話方式存取資料,而漏掉一筆紀錄會構成真正的法律或財務風險(而不只是體驗上的小瑕疵)時,就該讓LLM只負責「問」與「答」,把「判定」牢牢留在可稽核、可版本控管的規則引擎裡。同樣的架構思路也能套用到制裁名單篩查、保險理賠裁定、出口管制等其他高風險合規領域。

🔗 來源

#AWS #AmazonBedrock #ComplianceAI #RAG #MCP #LLMArchitecture #RulesEngine #AmazonQuick #AuroraServerless #AIGovernance

原始資料 AWS ML · 收集於 2026-10-02
來源原標題
Sweep thousands of leases for compliance using Amazon Quick and the Adjudicated Query pattern
作者
Anand Komandooru
原始標籤
Advanced (300) · Amazon Quick Suite · Technical How-to
原始連結
https://aws.amazon.com/blogs/machine-learning/sweep-thousands-of-leases-for-compliance-using-amazon-quick-and-the-adjudicated-query-pattern/

摘要原文

Checking tens of thousands of apartment leases against constantly changing state landlord-tenant laws, and proving you actually checked all of them, has been beyond the reach of most compliance teams. But with generative AI in Amazon Quick , paired with the right backend, it’s now possible. In this post, we introduce a design pattern called Adjudicated Query. Business users can use it to ask compliance questions in a chat interface (Amazon Quick), while the actual pass/fail decisions stay in a deterministic (non-AI) rules engine. We walk through an AWS reference architecture that implements the pattern, and deploy a working sample you can run end to end. The pattern applies to other high-stakes compliance domains as well (sanctions screening, insurance claims adjudication, export control), but lease compliance serves as our concrete example. A portfolio operator holds 50,000 leases across multiple states. Each state publishes landlord-tenant statutes (late-fee caps, notice periods, security-deposit limits) that change on the legislature’s schedule, not the operator’s. When a regulation changes, the team responsible for compliance must determine which leases are now out of line. At small volume a paralegal reads the leases. The answer is trustworthy because a human stands behind it. Past some threshold, that stops being possible. The work moves to software, and a new problem appears: the answer is now a number on a screen that nobody can independently verify. Two properties follow from that reality: These two properties are what distinguish this problem from enterprise search. Retrieval Augmented Generation (RAG) addresses the accessibility gap but cannot satisfy either property. Similarity search has no threshold that means all of them . A ranked sample never knows what it excluded. Text-to-SQL narrows this gap, but carries a category-level risk: a hallucinated predicate can silently reduce the population, and the resulting number looks exact even when the scope is wrong. The Adjudicated Query pattern is a bounded conversational layer over a deterministic rules engine. The model does exactly two things: translate a natural-language question into a call on a fixed set of typed operations, and narrate the result that comes back. It never writes a query, never fixes the population, and never performs a determination. Behind the boundary sits a rules engine. Rules are versioned data, not code. The engine knows generic comparison operators ( gte , lte , equals , exists ) and contains no branch naming a jurisdiction or topic. A law change is a rulebook row edit, not a code deployment. Every compliance sweep produces a completeness receipt: an asserted invariant where compliant + in-breach + ambiguous + unreadable must equal scanned. This is computed from counts and asserted before anything persists. A run that can’t account for its population never finishes. There’s no path by which a record is silently skipped. The conversational surface carries counts, the receipt, and a labeled sample. The full result set (potentially tens of thousands of rows) lives on a dashboard surface reading the same data store, drillable per record. This separation means the model never summarizes away the guarantee. The Adjudicated Query pattern adds natural-language access to the rules engine plus business intelligence (BI) approach without sacrificing the guarantee. It’s the right choice when accountable users need conversational access, and a missed record is a liability rather than a mild inconvenience. The following diagram shows how the components fit together end to end. A compliance officer interacts with two surfaces in Amazon Quick: a chat agent for asking questions and an Amazon Quick Sight dashboard for browsing the full result set. The chat agent first fetches an OAuth token from Amazon Cognito. It then sends Model Context Protocol (MCP) requests over an Amazon API Gateway HTTP API, which validates the token before forwarding to an AWS Lambda function. The Lambda function hosts the MCP server and the rules engine, reads and writes to Amazon Aurora Serverless v2 through the RDS Data API, and calls Amazon Bedrock only for the exploratory clause-search path. The Amazon Quick Sight dashboard reads the same Aurora store directly through a virtual private cloud (VPC) connection. Both surfaces therefore read from one store, which is what makes the completeness receipt a single source of truth. Figure 1: Reference architecture for the Adjudicated Query pattern Both surfaces read the same store. The chat agent carries the completeness receipt and a link to the dashboard. The dashboard carries the volume, because 10,800 rows don’t render in a chat message. Amazon Bedrock is called from AWS Lambda only by the exploratory operation. No model is involved in compliance sweeps, and Amazon Aurora Serverless v2 doesn’t call a model. The MCP server exposes exactly six tools, each with a distinct semantic: This bounded surface removes the path to the silent-narrowing risk of generated queries. Because the model can only select from a fixed set of operations whose population logic was written, reviewed, and tested by people, it has no way to compose a wrong population. With the Amazon Quick conversational interface and agent orchestration layer, you can ask natural-language compliance questions that the Amazon Quick chat agent translates into calls on the bounded MCP operation surface. Amazon Quick authenticates to the MCP server by using OAuth 2LO through Amazon Cognito and handles tool discovery and response narration. The deterministic engine handles the compliance logic. Amazon Aurora Serverless v2 (Postgres + pgvector) stores the rulebook, lease records, extraction status, determinations, and runs in a single relational store. Putting everything in one database makes the completeness receipt a SQL count, a cost-effective way to make the central guarantee inspectable. AWS Lambda hosts the MCP server (JSON-RPC 2.0 over Streamable HTTP, using Server-Sent Events framing for responses, which the Amazon Quick client requires) and the rule engine. Bounded operations translate to set-based SQL by using rule values bound as parameters. No natural language reaches the query layer. Amazon API Gateway HTTP API provides the front door with a JSON Web Token (JWT) authorizer backed by Amazon Cognito. No unauthenticated route exists. Amazon Cognito issues OAuth tokens through a two-legged (client credentials) flow. The client secret is read from Amazon Cognito at registration time and not written to disk. Amazon Bedrock powers the exploratory path only, using Amazon Titan Text Embeddings V2 ( amazon.titan-embed-text-v2:0 ) for semantic similarity ranking and Anthropic Claude Sonnet 5, invoked through a cross-region inference profile, for qualitative clause assessment. It isn’t consulted for an official compliance determination. Amazon Bedrock model availability, including Amazon Titan Text Embeddings V2 and Anthropic Claude Sonnet 5, varies by AWS Region, so confirm the models are available in your Region before deploying. Amazon Quick Sight connects to Aurora through a VPC connection and renders the full findings table, filterable by sweep and severity band, with every column needed to defend a determination already on the row. One design element deserves its own section because it will look unfamiliar: engineering safeguards to survive paraphrase by the chat model. Excluding the model from the decision path but putting one back in the delivery path reintroduces risk at the end of the chain. In practice, we observed: Three techniques address this: The principle: a safeguard in the payload is only as strong as its survival through paraphrase. The complete reference implementation is available on GitHub. It ships with synthetic data (no real customer lease data), deterministic corpus generation, and acceptance tests against the deployed stack.

由 claude-code/sonnet 自動生成