跳到正文
DEV Community· 王果ai·· 3 小時前AI 評分37

qwen3.8-max、kimi-k3.1-pro 與 qwen3.8-flash 的 128K 長上下文大海撈針基準測試:多跳合約審核及上下文快取成本

128K Long-Context Needle-in-a-Haystack: Multi-Hop Contract Audits & Context Caching Economics

AI 導讀

基準測試以合成合約比較 qwen3.8-max、kimi-k3.1-pro 與 qwen3.8-flash 的長上下文檢索及多跳計算,18 次請求全部通過。qwen3.8-max 使用上下文快取後,每次查詢成本由約 ¥1.40 降至約 ¥0.20;冷啟動 128K 的首次 token 延遲則為 4.8–5.2 秒。

正文

王果ai

200K and 1M context windows are standard marketing claims now, often pitched as a drop-in replacement for RAG. Yet anyone who has built contract or financial audit pipelines knows that accepting 128K tokens is very different from catching an unmarked amendment buried at clause 1,749 and combining it with a fee table on page 1.

In this benchmark (2026-11-17, 18 requests via DashScope with enable_thinking=false), we generated a deterministic 219,938-character synthetic outsourcing contract (fixed seed 20261117) and planted two unmarked needles side by side at 10%, 50%, and 90% depth:

  • ADV (Adversarial Unmarked Needle): A conversational clause stating liquidated damages are reduced from 500,000 to 376,000 RMB with late fees waived.
  • HOP (Multi-Hop Calculation): States that the training fee in Clause 2 is waived—forcing the model to retrieve 1,286,000 and 48,500 from the top of the contract to compute 1,237,500.

Results: 18/18 Passed, Zero Lost-in-the-Middle on Clean Synthetic Text

Model Tier / Depth Actual Input Tokens Cached Tokens ADV c_ttft HOP c_ttft Result (ADV / HOP)
qwen3.8-max 32K / 50% 32,363 ADV 0 / HOP 31,744 2.53s 1.51s ✅ / ✅
qwen3.8-max 128K / 10% 127,313 ADV 12,288 / HOP 126,976 5.25s 1.55s ✅ / ✅
qwen3.8-max 128K / 50% 127,313 ADV 15,360 / HOP 126,976 4.81s 1.83s ✅ / ✅
qwen3.8-max 128K / 90% 127,313 ADV 62,464 / HOP 126,976 4.94s 1.67s ✅ / ✅
kimi-k3.1-pro 32K / 50% 29,050 ADV 28,672 / HOP 28,672 3.63s 3.68s ✅ / ✅
kimi-k3.1-pro 128K / 10% 114,125 ADV 11,264 / HOP 113,664 9.08s 3.75s ✅ / ✅
kimi-k3.1-pro 128K / 50% 114,125 ADV 14,336 / HOP 113,664 11.26s 4.14s ✅ / ✅
kimi-k3.1-pro 128K / 90% 114,125 ADV 113,664 / HOP 113,664 7.15s 3.09s ✅ / ✅
qwen3.8-flash 128K / 50% 127,326 ADV 0 / HOP 127,232 6.64s 1.47s ✅ / ✅

3 Practical Engineering Takeaways

  1. Cold 128K Latency Is 2–3x Slower: Cold 128K c_ttft hit 4.8–5.2s (qwen3.8-max), 9.1–11.3s (kimi-k3.1-pro), and 6.6s (qwen3.8-flash). For interactive UX, cold 128K feels noticeably sluggish.
  2. Context Caching Changes the Unit Economics: When the document sits as a static prefix and the second question (HOP) hits cache, qwen3.8-max per-query cost dropped from ~¥1.40 to ~¥0.20 (~85% per-hit savings), and c_ttft fell to 1.5–1.8s. Total run cost across 18 requests was ¥8.301 vs ~¥19.87 uncached.
  3. 10% Tokenizer Difference on Identical Text: The exact same 219,938-character contract tokenized to 127,313 tokens on Qwen vs 114,125 on Kimi—a 10% gap that directly affects cross-model cost comparisons.

Scope & When to Stick with RAG

  • Scope: Clean synthetic text, 1 sample per cell, no distractor clauses from third-party entities, and no PDF layout/OCR noise.
  • Decision rule: Use Long Context + Prefix Caching for low-frequency deep reads of single contracts (always require verbatim clause citations verified by code). Use Hybrid RAG + Rerank for high-frequency QA across hundreds of documents.

Next in **Production AI Benchmarks: Structured Output (json_object) & Function Calling Stability Across 201 Live Requests.

Reproducible scripts & Benchmark Requests: github.com/wangguode/llm-prod-bench — Chinese version published on Zhihu.

來源:DEV Community · dev.to