AISpot

llama.cpp server 的 prompt cache 只儲存可恢復狀態

llama.cpp releases版本更新開發工具地端推論開源

llama.cpp 更新 server 的 prompt cache 邏輯:現在只儲存可恢復的 slot 狀態(PR #30498)。此前每個任務啟動時都會把空閒 slot 全部寫入快取,rerank、embedding、decision、infill 的狀態填滿快取卻從不被讀回;

原標題:b11642
閱讀原文

評分48 / 45(平均 46,門檻 60)
狀態未入選

原文

server: save only restorable slot states to the prompt cache ( #30498 ) server: save only restorable slot states to the prompt cache The idle-slot save loop stores every idle slot whenever a task starts, while only completion tasks restore from the prompt cache. Rerank, embedding, decision and infill states fill the cache up to its limit without ever being read back, and slots already cached are offered again at every task start. Each slot now tracks with cache_pending whether its state is restorable and missing from the cache: a completion release or an explicit slot restore sets it, prompt_save consumes it, prompt_clear resets it. Both save paths share this rule, and the LRU path restores only for completion tasks. server: test that decision slots skip the prompt cache Decision tasks never mark their slot as cacheable, so starting new tasks must not save their idle slots to the RAM prompt cache, with or without a unified KV cache. server: restore any reusing task from the prompt cache Embedding and rerank tasks never reuse their state, so their slots are cleared on release like child slots and the cache only holds states that a later task can restore. Infill and decision tasks now restore from the cache too, which replaces the cache_pending flag. Decision models disable the prompt cache unless --cache-ram is given, since their states seldom repeat. Website: https://llama.app Attestations: https://github.com/ggml-org/llama.cpp/attestations/56156929 macOS/iOS: macOS Apple Silicon (arm64) macOS Apple Silicon (arm64, KleidiAI enabled) DISABLED macOS Intel (x64) iOS XCFramework Linux: Ubuntu x64 (CPU) Ubuntu arm64 (CPU) Ubuntu s390x (CPU) Ubuntu x64 (Vulkan) Ubuntu arm64 (Vulkan) Ubuntu x64 (CUDA 12) - CUDA 12.8 libraries Ubuntu x64 (CUDA 13) - CUDA 13.4 libraries Ubuntu arm64 (CUDA 13) - CUDA 13.4 libraries Ubuntu x64 (ROCm 10.0) Ubuntu x64 (OpenVINO) Ubuntu x64 (SYCL FP32) Ubuntu x64 (SYCL FP16) Linux arm64 (Snapdragon: CPU, Adreno GPU, Hexagon NPU) - setup guide Android: Android arm64 (CPU) Android arm64 (Snapdragon: CPU, Adreno GPU, Hexagon NPU) - setup guide Windows: Windows x64 (CPU) Windows arm64 (CPU) Windows arm64 (OpenCL Adreno) Windows x64 (CUDA 12) - CUDA 12.4 DLLs Windows x64 (CUDA 13) - CUDA 13.4 DLLs Windows arm64 (CUDA 13) - CUDA 13.4 DLLs Windows x64 (Vulkan) Windows arm64 (Vulkan) Windows x64 (OpenVINO) Windows x64 (SYCL) Windows x64 (ROCm 10.0) openEuler: DISABLED openEuler x86 (310p) openEuler x86 (910b, ACL Graph) openEuler aarch64 (310p) openEuler aarch64 (910b, ACL Graph) UI: UI

相關報導

llama.cpp releasesAI 評分46

llama.cpp 修復繁忙 slot 被載入錯誤上下文的問題

llama.cpp 新版修復了請求指定繁忙 id_slot 時的上下文錯亂問題。此前這類請求仍會先在該 slot 上執行 prompt cache 更新,若 RAM 快取命中更好的匹配,就會把新上下文載入仍在生成中的 slot,導致生成在錯誤上下文上繼續;現在繁忙 slot 會原樣返回,請求排隊等待(#30295)。

llama.cpp releasesAI 評分41

llama.cpp b11583:無快取路徑避免記憶體重複分配

llama.cpp 發布 b11583,主要改動是在「no cache」路徑下避免圖記憶體的重複分配(#30439),即不使用 prompt 快取時可減少反覆申請與釋放視訊記憶體/記憶體。該版本照例提供 macOS、Linux、Windows、Android 等平台的預編譯包,其中 macOS Apple Silicon 的 KleidiAI 建置和 openEuler 建置本次標記為 DISABLED。

llama.cpp releasesAI 評分47

llama.cpp b11411 修復 KV cache 旋轉後設資料不匹配問題

llama.cpp 發布 b11411,修復恢復 KV cache 時 rotation 後設資料不匹配的問題:現在會儲存精確的 rotation 後設資料,並拒絕恢復與之不匹配的快取。原先的 state rotation 測試被移入 test-save-load-state,納入儲存/載入測試矩陣,對所有受測模型執行,並探測模型支援的 KV cache 型別組合,不使用 attention rotation 的模型視為空通過。

llama.cpp releasesAI 評分40

llama.cpp b11600 修復 T5 無快取注意力的 KQ 偏置填充

llama.cpp 發布建置 b11600,主要修復無快取注意力中 KQ 偏置未填充的問題:T5 會額外加入形狀為 [n_tokens, n_tokens] 的相對位置偏置,當 n_tokens 不能整除填充後的寬度時,與 KQ 相加會失敗,現在按 K、V 的做法用零把偏置填充到 mask 的 KV 維度。