iT邦幫忙

鐵人檔案

2026 iThome 鐵人賽
回列表
Software Development

LLM infra 學習日記 系列

作者學習LLM infra的日記,預計會涵蓋各種LLM inference, data, RL 相關開源專案的探索。

參賽天數 20 天 | 共 20 篇文章 | 1 人訂閱 訂閱系列文 RSS系列文 團隊源來適愛開緣
DAY 11

KV Cache 到底有多大?手算 MHA、GQA 與 MQA

上一篇提到,Decode Attention 的主要成本之一,是反覆讀取前面 tokens 的 K 和 V。 為什麼不能每次都重新算? 因為產生第 t 個 to...

2026-08-27 ‧ 由 ryankert01 分享
DAY 12

PagedAttention:為什麼 KV Cache 也需要分頁?

上一篇算過,Llama-3.2-1B 的 bf16 GQA KV Cache,每個 token 約需要 32 KiB。 如果只有一條固定長度的 sequence...

2026-08-28 ‧ 由 ryankert01 分享
DAY 13

TurboQuant:把 KV Cache 壓到 3–4 bit,真的會更快嗎?

上一篇用 PagedAttention 解決了 KV Cache「怎麼放」的問題:切成 blocks、按需配置、用 block table 找到實體位置。 但每...

2026-08-29 ‧ 由 ryankert01 分享
DAY 14

一個 Request 怎麼走進 vLLM?從 API 到下一個 Token

The everything Client │ POST /v1/chat/completions ▼ API Server Process │...

2026-08-30 ‧ 由 ryankert01 分享
DAY 15

Continuous Batching:Batch 為什麼可以中途換人?

昨天 vLLM Engine Core 的主迴圈: schedule → execute → update 關鍵是這個迴圈只推進一個 engine step,...

2026-08-31 ‧ 由 ryankert01 分享
DAY 16

Chunked Prefill:讓長 Prompt 不要卡住正在生成的 Request

Day 15 的 Continuous Batching 解決了「完成一條,就補進一條」。 但還有另一種卡頓:一條很長的新 prompt 進來,Prefill...

2026-09-01 ‧ 由 ryankert01 分享
DAY 17

Prefix Caching:相同 Prompt 為什麼不用再算一次?

它快取的不是 Prompt 文字 假設兩條 requests 是: Request A = [system prompt][shared document][q...

2026-09-02 ‧ 由 ryankert01 分享
DAY 18

Prefix Caching:相同 Prompt 為什麼不用再算一次KV?

它快取的不是 Prompt 文字 假設兩條 requests 是: Request A = [system prompt][shared document][q...

2026-09-03 ‧ 由 ryankert01 分享
DAY 19

LLM Serving Benchmark:如何對serving system 做benchmark

一條 request 上有四種時間 t0 送出 request │── transport + queue + Prefill + first decode ─...

2026-09-04 ‧ 由 ryankert01 分享
DAY 20

Prefill 和 Decode 為什麼要分家?

昨天把 LLM serving 的速度拆成 TTFT 與 ITL。今天會發現,這兩個指標背後剛好是兩種不同的工作。 Prefill:一次處理整段 promp...

2026-09-05 ‧ 由 ryankert01 分享