← 回到 Reading
Daily Dose of DS 2026-10-23

6 KV Cache Quantization Approaches

打造 AI agents 的競爭優勢不會來自底層的 model,而是來自於捕捉全端 user trajectories,並持續從 user interactions 中學習。透過觀察使用者在何處介入、手動執行了什麼,以及反覆要求什麼,agent 可以持續更新其 skills、evaluations 與 datasets。CopilotKit 推出了 CLiF,這是一個可 self-host 的 continual learning 平台,它利用 AG-UI protocol 來同時捕捉 agent traces 和 user actions。建議打造 user-facing agents 的團隊儘早開始收集全端 trajectory 資料,以建立可持續的護城河。對 model weights 進行 quantization 並不會自動縮減 KV cache 的 memory footprint,而 KV cache 會隨著 sequence length 和 concurrency 而增長。為了壓縮 KV cache 記憶體,開發人員採用了 FP8 precision、INT8/INT4 integer representation、fine-grained grouping、mixed-precision high-precision buffers 以及 outlier management 等技術。像 KIVI 這類方法會為 keys 和 values 獨立自訂 grouping 規則以達到 2-bit representations,而 KVQuant 則將 outlier values 分離至 sparse storage 中。雖然 KV cache quantization 能支援更大的 context windows 和更高的 batch sizes,但仍必須在對 decoding latency 與 accuracy 的影響,以及 metadata 和 dequantization 的 overhead 之間取得平衡。Retrieval-augmented generation (RAG) 正在從特定應用程式的 static pipelines,轉變為作為 tools 開放給 agents 使用的常設、shared retrieval layers。像 Google 和 Anthropic 這樣的領先 AI 提供商將 retrieval 視為 on-demand API,而非死板且單次執行的初始步驟。傳統的 naive RAG 架構面臨 data staleness 以及跨多個 applications 重複工程的問題。相較之下,獨立的 retrieval layer 能持續同步 data 變更,並支援 autonomous agents 以及應用程式進行 iterative、基於 tool 的查詢。

閱讀原文 ↗
目錄 3 段
  1. 01Agents 正在重蹈軟體界最愚蠢的錯誤
  2. 026 種 KV cache quantization 方法圖解:
  3. 03retrieval layer 的演進
AGENTS

Agents 正在重蹈軟體界最愚蠢的錯誤

打造 AI agents 的競爭優勢不會來自底層的 model,而是來自於捕捉全端 user trajectories,並持續從 user interactions 中學習。透過觀察使用者在何處介入、手動執行了什麼,以及反覆要求什麼,agent 可以持續更新其 skills、evaluations 與 datasets。CopilotKit 推出了 CLiF,這是一個可 self-host 的 continual learning 平台,它利用 AG-UI protocol 來同時捕捉 agent traces 和 user actions。建議打造 user-facing agents 的團隊儘早開始收集全端 trajectory 資料,以建立可持續的護城河。

  • AI agent 開發中可持續的護城河取決於捕捉全端 user trajectories,而不是依賴底層的 base models。
  • Continuous learning 讓 agents 能夠每週持續改進,將使用者的介入點與重複的請求轉換為新的 skills、evaluations 以及 fine-tuning datasets。
  • CLiF 是整合進 CopilotKit 的 learning 平台,專為記錄 agent execution traces 與 user interactions 而設計。
  • AG-UI protocol 運作於 agent 與 UI 之間,能夠從真實 session 中生成可匯出的全端 trajectories 與 fine-tuned models。
  • CLiF 為部署 user-facing agents 的開發者提供可 self-host 的 continual learning 基礎設施。
LLMOps

6 種 KV cache quantization 方法圖解:

對 model weights 進行 quantization 並不會自動縮減 KV cache 的 memory footprint,而 KV cache 會隨著 sequence length 和 concurrency 而增長。為了壓縮 KV cache 記憶體,開發人員採用了 FP8 precision、INT8/INT4 integer representation、fine-grained grouping、mixed-precision high-precision buffers 以及 outlier management 等技術。像 KIVI 這類方法會為 keys 和 values 獨立自訂 grouping 規則以達到 2-bit representations,而 KVQuant 則將 outlier values 分離至 sparse storage 中。雖然 KV cache quantization 能支援更大的 context windows 和更高的 batch sizes,但仍必須在對 decoding latency 與 accuracy 的影響,以及 metadata 和 dequantization 的 overhead 之間取得平衡。

  • Weight quantization 不會縮減 KV cache;KV cache precision 必須獨立降低。
  • 將 KV cache 從 16-bit 轉移到 8-bit 可將原始 data size 減半,但像 scales 和 buffers 等 metadata 會減少淨節省的空間。
  • INT8 提供 256 個 levels,而 INT4 僅提供 16 個,這會增加 rounding error 並可能降低 attention distinction。
  • KIVI 針對 keys 跨 token blocks 應用 per-channel grouping,並針對 values 採用 per-token grouping,目標是在不進行 fine-tuning 的情況下實現 2-bit KV 儲存。
  • Mixed-precision 方法將近期的 tokens 保留在 high-precision buffer 中,以防止近期 context 出現 quantization errors,同時壓縮較舊的 tokens。
  • KVQuant 透過 positional tracking 將 outlier values 隔離至 sparse storage 中,讓其餘 values 能對應到更窄的 quantization 範圍。
RAG

retrieval layer 的演進

Retrieval-augmented generation (RAG) 正在從特定應用程式的 static pipelines,轉變為作為 tools 開放給 agents 使用的常設、shared retrieval layers。像 Google 和 Anthropic 這樣的領先 AI 提供商將 retrieval 視為 on-demand API,而非死板且單次執行的初始步驟。傳統的 naive RAG 架構面臨 data staleness 以及跨多個 applications 重複工程的問題。相較之下,獨立的 retrieval layer 能持續同步 data 變更,並支援 autonomous agents 以及應用程式進行 iterative、基於 tool 的查詢。

  • Anthropic 的 Model Context Protocol (MCP) 與 Google 的 RAG Engine 將 retrieval 作為可由 AI agents 呼叫的 on-demand tool 開放出來。
  • Naive RAG 架構在規模化時會因為 data staleness 以及跨 apps 重複的 retrieval logic 而崩潰。
  • 常設的 retrieval layer 將 ingestion 與 querying 解耦,作為底層獨立系統在 applications 之下運作。
  • Continuous ingestion 使用 content hashing 與 change detection,僅對修改過的 data 重新進行 embedding,而非處理整個 corpora。
  • Agents 在 reasoning loop 中將 retrieval 作為 tool 進行 iterative 調用,而不是作為固定、單次執行的 pipeline 步驟。