NarrateAI: production-ready LLM quality assurance on Amazon Bedrock
https://aws.amazon.com/blogs/machine-learning/narrateai-production-ready-llm-quality-assurance-on-amazon-bedrock/📌 NarrateAI 揭密:Bedrock 上五招把即時問答準確率做到 99%
TL;DR:AWS 公開 NarrateAI 如何用五項機制在 Bedrock 上兼顧速度與準確,讓主管級即時問答不再出包。
高階主管在業務會議上問「哪些地區沒達標、為什麼」,系統要在幾秒內給出正確數字。數字錯一個、回應慢半拍,在主管面前都是立即的專業風險,而光靠一顆強大的 LLM 並無法同時保證這兩件事。
🤔 LLM 落地的落差:幻覺數字、API 節流、驗證延遲
NarrateAI 服務超過 4,000 位 AWS 高階主管,架構建立在 Amazon Bedrock AgentCore 之上,分成兩層:負責批次處理的「自動化敘事生成層」,以及負責即時互動的「對話式 AI 介面層」。文章指出,生產環境中常見的落差包含幻覺數字、API 節流、驗證延遲與語言表達不夠客觀,要補上這個落差需要把品質保證內建在從資料檢索到回應輸出的每一步。這篇文章聚焦即時層裡的五項技術:自適應管線編排、跨帳號多模型故障轉移、即時串流評估、複合評估框架,以及資料準確性驗證,彼此形成一條分層依賴鏈,共同把原始查詢轉成經過驗證的即時回應。
🧩 依資料量分流,而不是每筆查詢都跑重的
文中著墨最深的是「自適應管線編排」。企業知識文件量龐大,查詢對資料的需求卻差異極大:一句「我這一季的達成率」可能只需幾個知識片段,而「給我完整的區域績效分析」則要橫跨數百個片段做綜合。單一策略無法兩者兼顧,一次性串接雖快但超過模型上下文窗口(通常 200K tokens)就得截斷、犧牲品質;固定式多輪批次處理雖然不會截斷,卻讓所有查詢都要付出多次 LLM 呼叫的成本,即使九成查詢根本用不到。
NarrateAI 的作法是依檢索到的知識片段總量做路由,分三階段執行:
- 「模式感知整合」用貪婪最先適配(first-fit)打包策略,在保留片段優先順序與邊界的前提下,把片段塞進上下文窗口;資料量小於門檻值時整批合併走「快速路徑」,超過門檻則切成多個批次走「一般路徑」。門檻值依模型上下文窗口校準,目標是讓 70–90% 的查詢落在快速路徑。
- 「分歧式分析」依前一階段選定的路徑執行:快速路徑用單次 LLM 呼叫並直接串流結果;一般路徑則把批次分派給 N 個並行 LLM 呼叫,各自獨立分析以取得接近線性的加速。
- 「條件式整合」只在一般路徑觸發,把 N 份獨立分析連同原始問題一起交給整合用的 LLM,套用衝突解決規則並串流輸出最終答案;快速路徑因為只有一份分析,直接跳過這一階段。
🧩 其餘四項技術各司其職
管線編排之後,「跨帳號多模型故障轉移」把可用推論容量擴展到多個獨立的模型/帳號配額空間,降低使用者可感知的節流;「即時串流評估」在每個段落一產生就立刻驗證,讓品質檢查與生成過程重疊進行;「複合評估框架」對每個段落平行跑多個獨立評估器;「資料準確性驗證」則用兩階段串接抓出數字幻覺,先做成本低的精確比對,必要時才升級到語意層級的驗證。
📊 九成查詢走快速路徑,LLM 呼叫量減少 72%
實際生產數據顯示,約 90% 的查詢走快速路徑,首字延遲(TTFT)僅數秒,總延遲通常在 25 秒以內;剩下約 10% 的複雜多文件查詢走完整並行批次處理,耗時約 50–75 秒,與其複雜度相稱。在一般路徑典型批次數 N=4 的情況下,每筆查詢的平均成本約為 1.4 次 LLM 呼叫,相較於「每筆查詢都固定走多輪批次」的策略,LLM 呼叫次數減少了 72%,同時複雜查詢的品質覆蓋率沒有被犧牲。
💡 門檻校準是整個設計的關鍵槓桿
這套架構的核心洞察在於:與其對所有查詢一視同仁,不如先用一次分類決定路徑,再讓下游每個階段只針對自己的路徑做最佳化,而不必同時兼顧兩種情境。門檻值的校準直接決定了快速路徑的覆蓋率,也因此決定了整體成本結構——這也是為什麼文章特別強調門檻是「依模型上下文窗口校準」而非隨意設定的參數。
🎯 實務啟示
對正在打造 LLM 應用的工程師而言,這篇文章示範了一個可複製的思路:先用資料量做路由分流,把多數查詢導向便宜的單次路徑,只有真正需要的複雜查詢才承擔多次呼叫的成本;品質保證則不該是生成完之後的單一關卡,而是拆成可以和生成過程重疊執行的多層檢查,才能在維持即時串流體驗的同時兼顧準確性。
🔗 來源
- 標題:NarrateAI: production-ready LLM quality assurance on Amazon Bedrock
- 作者/機構:Felicia Yue Xiong,AWS Machine Learning Blog
- 連結:https://aws.amazon.com/blogs/machine-learning/narrateai-production-ready-llm-quality-assurance-on-amazon-bedrock/
#AmazonBedrock #LLM #AgenticAI #ProductionAI #QualityAssurance #AWSMachineLearning #PromptEngineering #Streaming #AIArchitecture #EnterpriseAI
原始資料 AWS ML · 收集於 2026-09-25
摘要原文
Executives need to make data-driven decisions during live business reviews, where accuracy and speed matter. A conversational agentic AI assistant can meet this need by answering data questions instantly. But the stakes are high: a wrong number or a slow response in front of leadership carries immediate professional consequences, and a capable large language model (LLM) alone can’t guarantee either. In production, that gap shows up as hallucinated metrics, API throttling, validation latency, and subjective language. Closing it requires production-ready quality assurance built into every step, from data retrieval to response delivery. This post details five techniques, implemented on Amazon Bedrock , that work together to deliver it: adaptive pipeline orchestration, cross-account multi-model failover, real-time streaming evaluation, composite evaluation framework, and data accuracy verification. Each addresses a distinct failure mode while operating as a coordinated system. This post is the second in our NarrateAI series. NarrateAI transforms business intelligence for over 4,000 AWS executive leaders through a two-layer architecture built on Amazon Bedrock AgentCore , a platform to build, connect, and optimize agents at scale, with any framework or model. The architecture comprises an Automated Narrative Generation Layer for batch processing and a Conversational AI Interface Layer for real-time interaction. Our previous post covered the business challenges, overall architecture, user experience, and enterprise deployment. This one goes deeper into the engineering, showing how the five techniques achieve approximately 99 percent numerical accuracy while streaming responses in real time. It’s written for engineers and architects building LLM applications who are familiar with LLM APIs and streaming responses. This post focuses exclusively on the advanced quality assurance mechanisms within the real-time layer. Consider an executive asking “Which regions aren’t meeting their targets and why?” The five techniques work together so that the response is numerically accurate and arrives in real time. It also maintains throughput under concurrent global usage and is professionally formatted for direct use in business reviews. Figure 1 shows how these five techniques form a layered dependency chain, where each layer feeds the one below it to produce a validated real-time response from raw queries. Adaptive Pipeline Orchestration routes queries by data volume so that most complete in a single fast pass while complex queries receive full parallel treatment. Cross-Account Multi-Model Failover expands available inference capacity across independent model-account quota spaces, reducing user-visible throttling. Real-Time Streaming Evaluation validates each paragraph the moment it’s produced, overlapping quality checks with generation. The Composite Evaluation Framework runs multiple independent evaluators in parallel against each paragraph. Data Accuracy Verification catches numerical hallucinations through a two-stage cascade. It starts with cheap exact matching and escalates to semantic verification only when needed. The following sections walk through each technique in the order it appears in the pipeline, from data retrieval through generation to quality assurance. Figure 1: How the five quality assurance techniques layer together to turn raw queries into validated real-time responses Enterprise knowledge documents contain extensive information and queries vary enormously in how much of it they need. A focused question like “What’s my team’s quarterly attainment?” might draw on a handful of sections (discrete chunks of enterprise knowledge documents retrieved). A comprehensive request like “Give me a full regional performance analysis” requires synthesis across hundreds. Users expect the same response time either way. This heterogeneity requires a routing strategy that handles the common case quickly without sacrificing thoroughness for complex scenarios. No single processing strategy works for all queries, because the right approach depends on how much data a query actually requires. Single-pass concatenation is fast and cheap, but it breaks down when aggregated sections exceed the model’s context window (typically 200K tokens), forcing truncation and quality loss. Fixed multi-pass batch processing avoids truncation, but it pays for multiple LLM invocations on every query, including the roughly 90 percent that don’t need them. Our approach routes each query based on its total aggregated section volume ∣D∣ (where D is the set of retrieved document sections): single pass when the data fits, batch processing only when necessary. The result is a three-phase pipeline that classifies each query once and then processes it along the cheapest path that preserves quality. The pipeline processes every query in up to three phases: Mode-Aware Consolidation packs retrieved sections and picks a route, Bifurcated Analysis executes that route as either a single fast-path call or parallel normal-path batches, and Conditional Consolidation merges the parallel results when needed. The following table summarizes how the two paths move through these phases before we walk through each phase in detail. The first phase, Mode-Aware Consolidation, operates on retrieved document sections. It applies a greedy first-fit packing strategy to fill context windows up to the token limit while preserving section priority order and section boundaries. For smaller volumes (∣D∣≤θ, where θ is an empirically calibrated character-count threshold), all sections are concatenated into a single chunk, and this is called “fast path”. For large volumes (∣D∣>θ), sections are packed into optimal batches that respect document boundaries and this is called “normal path”. Threshold θ is set relative to the model’s context window limit and calibrated to capture 70–90 percent of queries on the fast path (in practice, approximately 90 percent take this path, as shown in the Results section). Because the execution mode is fixed in this first phase, each downstream phase can optimize for its specific path rather than handling both. The second phase, Bifurcated Analysis, executes the chosen path. The fast path makes a single LLM call with the complete context and streams results directly to the evaluation pipeline. The normal path distributes batches across N parallel LLM invocations (where N is the number of batches produced by Phase 1) that analyze chunks independently to achieve near-linear speedup. The third phase, Conditional Consolidation, operates exclusively on the normal path by synthesizing N independent analyses into a unified response. The consolidation LLM receives partial analyses with the original question and applies conflict resolution heuristics while streaming the final answer. The fast path bypasses this phase entirely because the final response only uses one analysis. Figure 2 shows the complete flow, with both paths converging on the streaming response. Figure 2: End-to-end flow of the three-phase pipeline, showing the fast path bypassing consolidation In production, this threshold-based routing delivers outsized efficiency. Approximately 90 percent of queries take the fast path (single LLM call, time-to-first-token (TTFT) within a few seconds, total latency typically under 25 seconds). The remaining 10 percent (complex multi-document queries) receive the full parallel batch treatment (approximately 50–75 seconds compared to under 25 seconds on the fast path) commensurate with their complexity. With N=4 typical batches for normal-path queries, the blended cost per query is approximately 1.4 LLM invocations. That is a 72 percent reduction in LLM invocations per query versus always using the multi-pass strategy, while maintaining full quality coverage for complex queries.
由 claude-code/sonnet 自動生成