← 回到 Reading
Daily Dose of DS 2026-11-19

GPU architecture, clearly explained

Redis 推出了 Redis Iris,這是一款專為 production AI agent 提供精準 context 的 real-time engine。一般的 semantic cache 在處理 dynamic data 時會回傳過期(stale)的回應,而單純的 agent 則會在每個 request 重複 re-planning 消耗過多 token;相較之下,Iris 快取的是 execution steps 而非靜態答案。透過使用 Intent Router 來檢索 Agent Playbook,Iris 讓 agent 能跳過 planning 階段,同時依然能評估 live data。在針對 dynamic requests 比較 plain agent、semantic cache 與 Iris 的 benchmark 中,Iris 的執行速度約為 plain agent 的兩倍,且是唯一在所有 turns 中都能提供準確答案的架構。在 LLM inference 中,GPU 的 token generation 往往受限於 memory bandwidth,而非 arithmetic compute capacity。在逐一生成 token 時,GPU 為了極少的計算量而搬移 weight,但 batching 多個 request 可以在多次操作中有效重複利用 weight。為了最佳化 memory 搬移,GPU 依賴一套 execution hierarchy——threads、warps、thread blocks 與 streaming multiprocessors——以及從 register 到 high bandwidth memory 的分層 memory 系統。像 FlashAttention 這樣的演算法透過將 intermediate attention 計算保留在 local memory 中來提升效能,大幅減少與 external memory 之間昂貴的 round trips。Loop engineering 涉及在四種不同的 agent loop 結構之間做選擇,而不是將 agent steering 視為單一架構。Loop 系統主要解決兩個核心功能:什麼觸發 run,以及什麼決定 task 完成。手動執行的 session 完全仰賴人類輸入,而 turn-based、goal-based、time-based 與 proactive loops 則逐步將這些職責委派給系統。最佳的設計選擇取決於 task 是 exploratory、measurable、recurring 還是 standing。

目錄 3 段
  1. 01Redis 正全力押注 AI。
  2. 02GPU 架構詳解
  3. 03四種 agent loop 類型
AI AGENTS

Redis 正全力押注 AI。

Redis 推出了 Redis Iris,這是一款專為 production AI agent 提供精準 context 的 real-time engine。一般的 semantic cache 在處理 dynamic data 時會回傳過期(stale)的回應,而單純的 plain agent 則會在每個 request 重複 re-planning 消耗過多 token;相較之下,Iris 快取的是 execution steps 而非靜態答案。透過使用 Intent Router 來檢索 Agent Playbook,Iris 讓 agent 能跳過 planning 階段,同時依然能評估 live data。在針對 dynamic requests 比較 plain agent、semantic cache 與 Iris 的 benchmark 中,Iris 的執行速度約為 plain agent 的兩倍,且是唯一在所有 turns 中都能提供準確答案的架構。

  • Redis Iris 快取的是 workflow steps(Agent Playbook)而非靜態 response,讓 agent 無需重新 re-planning 即可對 live data 執行 action。
  • 標準 semantic caching 在面對 non-static data 時會失效,因為當底層狀態改變時它會回傳 stale response。
  • Plain agent 透過在每個 request 執行完整的 reasoning loops 來避免 stale data,但這會帶來極高的 latency 和 token 成本。
  • 在一個包含兩個 turn 的 benchmark 中,Iris 每個問題僅需 1 次 LLM call(耗時 5.9s 與 5.6s),相較之下 plain agent 則需要 2 次 LLM calls(耗時 9.4s 與 12.7s)。
  • Iris 的執行速度比 plain agent 快約 2 倍,且是受測架構中唯一在兩個 dynamic query 上都能給出正確答案的架構。
GPU

GPU 架構詳解

在 LLM inference 中,GPU 的 token generation 往往受限於 memory bandwidth,而非 arithmetic compute capacity。在逐一生成 token 時,GPU 為了極少的計算量而搬移 weight,但 batching 多個 request 可以在多次操作中有效重複利用 weight。為了最佳化 memory 搬移,GPU 依賴一套 execution hierarchy——threads、warps、thread blocks 與 streaming multiprocessors——以及從 register 到 high bandwidth memory 的分層 memory 系統。像 FlashAttention 這樣的演算法透過將 intermediate attention 計算保留在 local memory 中來提升效能,大幅減少與 external memory 之間昂貴的 round trips。

  • Token generation 通常受限於 memory bandwidth,因為在單一 request 的 generation 中,GPU 讀取 weights 的速度遠快於對其執行 operation 的速度。
  • 在 16-bit precision 下,讀取一個 weight 會傳輸 2 bytes,卻僅執行兩次算術運算(一次乘法與一次加法),導致 arithmetic intensity 非常低。
  • Batching 多個 request 能透過在多個 concurrent 計算中重複利用 weight,從而攤平 memory 讀取成本。
  • GPU 的 execution 採階層式架構,分為 threads、32-thread warps、thread blocks 以及 streaming multiprocessors (SMs)。
  • GPU memory 層級涵蓋了極速的 local storage(registers、shared memory 與 L1/L2 caches),到容量更大但速度較慢的 off-chip High Bandwidth Memory (HBM)。
  • FlashAttention 透過將 intermediate attention 結果快取在 local storage 中,而非對 HBM 讀寫完整的 attention tables,從而大幅提升效率。
AGENTS

四種 agent loop 類型

Loop engineering 涉及在四種不同的 agent loop 結構之間做選擇,而不是將 agent steering 視為單一架構。Loop 系統主要解決兩個核心功能:什麼觸發 run,以及什麼決定 task 完成。手動執行的 session 完全仰賴人類輸入,而 turn-based、goal-based、time-based 與 proactive loops 則逐步將這些職責委派給系統。最佳的設計選擇取決於 task 是 exploratory、measurable、recurring 還是 standing。

  • Loop engineering 設計的是引導(steer)AI agent 的系統,而非手動逐個 turn 驅動它。
  • 每個 agent loop 設計都必須確定由什麼來啟動 run,以及由什麼來判定工作已完成。
  • Turn-based loops 由使用者 prompt 啟動,適用於需求會持續演變的 exploratory tasks。
  • Goal-based loops 透過 criteria 與 evaluator model 自動化評估任務是否完成,適用於具備可衡量成果(measurable outcomes)的場景。
  • Time-based loops 依固定時間間隔(clock intervals)執行 recurring tasks,可使用本地的 /loop 或雲端的 /schedule 等指令。
  • Proactive loops 能在無人介入的情況下自主回應外部事件,部署包括 triage、fix 與 reviewer agents 在內的 multi-agent workflows。
  • 選擇 loop 架構取決於 task 類型:exploratory、measurable、recurring 還是 standing。