[{"data":1,"prerenderedAt":3550},["ShallowReactive",2],{"post-tideway-one-memory-pool":3,"site-info":1639,"related-en-tideway-one-memory-pool":1735},{"zh":4,"en":859},{"id":5,"title":6,"author":7,"body":8,"cover":838,"coverAlt":839,"date":840,"description":841,"draft":842,"extension":843,"featured":842,"lang":844,"meta":845,"navigation":846,"ogImage":847,"path":848,"seo":849,"slug":850,"stem":851,"tags":852,"translationKey":850,"updated":857,"__hash__":858},"blog\u002Fblog\u002Fzh-TW\u002Ftideway-one-memory-pool.md","你不需要 512 GB 記憶體，你需要更好的記憶體管理","Jecision",{"type":9,"value":10,"toc":826},"minimark",[11,34,37,45,48,51,54,57,60,65,72,75,93,100,181,184,187,190,194,197,269,272,280,283,289,293,296,299,302,308,311,320,323,330,334,337,347,407,410,413,416,423,441,447,450,453,457,463,469,475,481,487,491,498,505,508,570,573,646,649,652,655,658,662,665,735,738,745,748,751,754,775,778,798,815,823],[12,13,14,18],"blockquote",{},[15,16,17],"p",{},"這篇沒有我們的實測。數據來自 arXiv 2611.14848〈Tideway〉（Duke University，2026-11-10）與作者開源的程式碼：這是 preprint，我們沒有找到獨立複現；四套對照組裡有兩套是作者在別的引擎上重現機制，不是原系統。文中的倍數與表格，凡是我們自己算的都會標出來。",[15,19,20,21,28,29],{},"論文：",[22,23,27],"a",{"href":24,"rel":25},"https:\u002F\u002Farxiv.org\u002Fabs\u002F2611.14848",[26],"nofollow","arXiv 2611.14848","｜程式碼：",[22,30,33],{"href":31,"rel":32},"https:\u002F\u002Fgithub.com\u002FAfterglow231\u002FTideway",[26],"Afterglow231\u002FTideway",[15,35,36],{},"一台 64 GiB 記憶體、32 GB 顯示記憶體的機器，正在讀一段 32K 的 prompt。",[15,38,39,40,44],{},"它的 RAM 裝得下 44% 的專家權重，但 prefill 跑完，有 ",[41,42,43],"strong",{},"86–99%"," 的專家流量是從 SSD 讀進來的。",[15,46,47],{},"這篇拆的就是這 86% 怎麼來的——為什麼同樣的記憶體，換一種管理方式能快 1.97 倍，以及你的機器該不該為它多買記憶體。",[15,49,50],{},"名詞先對齊。MoE（混合專家）把每層的 FFN 切成很多個「專家」，每個 token 只啟動少數幾個。prefill 是讀 prompt 的階段，decode 是逐個產生 token 的階段，TPOT 是每個輸出 token 的平均時間，KV cache 是對話越長越大的注意力快取。",[15,52,53],{},"剛剛那 44% 幾乎沒派上用場。而且不是哪個引擎寫壞了——四個對照組（FreeToken、llama.cpp、FlashMoE、SSD-LLaMA）都掉進同一個坑。",[15,55,56],{},"問題不在模型太大，在它們把記憶體當成三層各自獨立的快取：VRAM 快取 RAM、RAM 快取 SSD；三個階層各自決定踢誰——多數是 LRU（最久沒用的先踢），FlashMoE 用學出來的替換策略；llama.cpp 則把決定權交給作業系統的 mmap（粒度是分頁，碰到 SSD 就 thrash）。",[15,58,59],{},"先從帳單開始。",[61,62,64],"h2",{"id":63},"先看帳單512-gib-記憶體要四萬美元","先看帳單：512 GiB 記憶體要四萬美元",[15,66,67,68,71],{},"論文裡最大的那顆模型是 DeepSeek-V4-Flash。",[41,69,70],{},"檔案用 FP4 存，還是 155 GiB","。",[15,73,74],{},"先看市面上的機器長什麼樣。論文引了四份 2026 年的資料：預裝機報價、3DMark 提交、跑 BOINC 的主機、Steam 硬體調查。結論一致：",[76,77,78,85,90],"ul",{},[79,80,81,84],"li",{},[41,82,83],{},"16–64 GiB 是主流","：涵蓋三組 RTX 5090 族群的 64–84%、Steam 機器的 99%",[79,86,87],{},[41,88,89],{},"超過 128 GiB 的，任何一組都至多 11%",[79,91,92],{},"買得起最貴消費級顯卡的人，記憶體也停在 64 GiB",[15,94,95,96,99],{},"價格是另一回事。論文畫了一張預裝機報價圖：128 GiB 以內低於 $10k，然後斷崖——",[41,97,98],{},"256 GiB 約 $26k，512 GiB 約 $41k","（512 GiB 就是市面上俗稱的 512 GB）。",[101,102,103,122],"table",{},[104,105,106],"thead",{},[107,108,109,113,116,119],"tr",{},[110,111,112],"th",{},"記憶體",[110,114,115],{},"覆蓋率",[110,117,118],{},"預裝機約價",[110,120,121],{},"裝得下 155 GiB 的權重嗎",[123,124,125,140,153,167],"tbody",{},[107,126,127,131,134,137],{},[128,129,130],"td",{},"16–64 GiB",[128,132,133],{},"RTX 5090 族群 64–84%、Steam 99%",[128,135,136],{},"低於 $10k",[128,138,139],{},"不行",[107,141,142,145,148,150],{},[128,143,144],{},"128 GiB",[128,146,147],{},"論文未給",[128,149,136],{},[128,151,152],{},"不行，權重就多 27 GiB",[107,154,155,158,161,164],{},[128,156,157],{},"256 GiB",[128,159,160],{},">128 GiB 合計至多 11%",[128,162,163],{},"約 $26k",[128,165,166],{},"可以，KV cache 另計",[107,168,169,172,175,178],{},[128,170,171],{},"512 GiB",[128,173,174],{},"同上",[128,176,177],{},"約 $41k",[128,179,180],{},"可以",[15,182,183],{},"（覆蓋率與價格來自論文：16–64 GiB 涵蓋 RTX 5090 族群的 64–84% 與 Steam 的 99%，超過 128 GiB 的至多 11%；論文沒有單獨給 128／256／512 GiB 的比例。「27 GiB」是 155 − 128 的算術。）",[15,185,186],{},"「買更多記憶體」不是一個選項，是兩倍到四倍價格的機器。而且就算真的買到 256 GiB，155 GiB 的權重佔掉六成（155 ÷ 256，我們的算術），剩下的 101 GiB 要放 KV cache 與啟動區。",[15,188,189],{},"那如果問題不是「記憶體不夠」，而是「記憶體用得不好」呢？",[61,191,193],{"id":192},"模型只能往下溢vramramssd","模型只能往下溢：VRAM、RAM、SSD",[15,195,196],{},"測試機是 RTX 5090，32 GB VRAM。論文把系統記憶體上限壓在 16 到 128 GiB 之間，模擬不同預算的機器。三顆模型：",[101,198,199,218],{},[104,200,201],{},[107,202,203,206,209,212,215],{},[110,204,205],{},"模型",[110,207,208],{},"總參數（啟動）",[110,210,211],{},"精度",[110,213,214],{},"權重大小",[110,216,217],{},"32 GB 卡上的缺口",[123,219,220,237,253],{},[107,221,222,225,228,231,234],{},[128,223,224],{},"Qwen3.6-35B-A3B",[128,226,227],{},"35B（3B）",[128,229,230],{},"BF16",[128,232,233],{},"約 70 GB",[128,235,236],{},"約 38 GB",[107,238,239,242,245,247,250],{},[128,240,241],{},"Gemma4-26B-A4B",[128,243,244],{},"26B（4B）",[128,246,230],{},[128,248,249],{},"約 52 GB",[128,251,252],{},"約 20 GB",[107,254,255,258,260,263,266],{},[128,256,257],{},"DeepSeek-V4-Flash",[128,259,147],{},[128,261,262],{},"原生 FP4",[128,264,265],{},"155 GiB",[128,267,268],{},"約 123 GiB",[15,270,271],{},"前兩顆的權重大小是我們按 BF16 每參數 2 bytes 算的，缺口是減掉顯卡標示的 32 GB；DeepSeek 的 123 GiB 是 155 − 32 GiB。都不是論文給的數字。",[15,273,274,275,279],{},"三顆都裝不進 32 GB。DeepSeek-V4-Flash 更極端：它已經是 FP4（每參數 4 bit），再壓下去要面對品質問題，不是換個格式就好。我們在",[22,276,278],{"href":277},"\u002Fblog\u002Fmacaq-one-layer-at-a-time","量化那篇","寫過，量化不是免費的。",[15,281,282],{},"所以權重只能往下一層溢：VRAM 放不下的進 RAM，RAM 也放不下的進 SSD。這件事叫 spill，不是「載入失敗」，是每一次 forward 都可能發生的搬運。",[15,284,285,286,71],{},"接下來只剩一個問題：",[41,287,288],{},"三層要怎麼擺，搬運才不會變成主要成本",[61,290,292],{"id":291},"現有系統錯在哪三層被當成三個獨立快取","現有系統錯在哪：三層被當成三個獨立快取",[15,294,295],{},"大部分推論引擎的記憶體管理，照的是資料中心的成本模型：DRAM 貴、SSD 便宜，所以讓 VRAM 快取 RAM、RAM 快取 SSD；每一個階層自己決定踢誰，彼此不知道對方踢了什麼。",[15,297,298],{},"資料中心有充足的 DRAM，這個假設通常成立。",[15,300,301],{},"在消費級 PC 上，它會把系統弄死。原因分兩個階段。",[15,303,304,307],{},[41,305,306],{},"Prefill（讀 prompt）。"," 一段 8K token 的 chunk 幾乎會啟動每一層的每個專家。prefill 要的不是「少數專家」，是「整個模型掃一遍」。當專家池大於 RAM，掃描就變成循環：載入後面幾層的專家，把前面幾層的踢掉；下一個 chunk 再從頭讀。",[15,309,310],{},"64 GiB 的 RAM 明明裝得下 44% 的池，SSD 還是供應了 baseline 86–99% 的 prefill 專家流量。Tideway 在同一個場景是 52%。（如圖 1；斜紋是四個對照組之間的區間，最低 86%、最高 99%。）",[15,312,313,316,317,71],{},[41,314,315],{},"Decode（生成）。"," 每一步只碰少數專家，但缺一個就卡住。動態 paging 又會打斷 CUDA Graph——固定形狀的圖捕獲不了「這一層要臨時去 SSD 拿一個專家」，所以引擎退回 eager 執行，每個 token 多一段 CPU 調度與同步。llama.cpp 是另一種極端：它幾乎沒有啟動開銷，但 ",[41,318,319],{},"92% 的 decode 時間花在用 CPU 算專家",[15,321,322],{},"注意這兩件事的性質不同。prefill 是「留不住」，decode 是「執行不好」。要同一個系統同時解，才會有後面的設計。",[15,324,325],{},[326,327],"img",{"alt":328,"src":329},"如圖 1：同樣 64 GiB 記憶體，四個對照組的 prefill 專家流量有 86–99% 來自 SSD，Tideway 是 52%；第一列是 RAM 實際裝得下的比例，44%","\u002Fimages\u002Fblog\u002Ftideway-one-memory-pool\u002F01-prefill-traffic.svg",[61,331,333],{"id":332},"洞見一pcie-比-ssd-快所以-ram-裡的專家是副本","洞見一：PCIe 比 SSD 快，所以 RAM 裡的專家是副本",[15,335,336],{},"論文先量了一件事，我認為那是整篇的地基。",[15,338,339,340,343,344,71],{},"同一台機器上，PCIe 5.0 實測 ",[41,341,342],{},"57.6 GB\u002Fs（RAM→VRAM）、57.3 GB\u002Fs（VRAM→RAM）、雙向 102.1 GB\u002Fs","；NVMe SSD 讀取是 ",[41,345,346],{},"6.8 GB\u002Fs",[101,348,349,362],{},[104,350,351],{},[107,352,353,356,359],{},[110,354,355],{},"路徑",[110,357,358],{},"實測頻寬",[110,360,361],{},"相對 SSD",[123,363,364,375,386,397],{},[107,365,366,369,372],{},[128,367,368],{},"PCIe H2D（RAM→VRAM）",[128,370,371],{},"57.6 GB\u002Fs",[128,373,374],{},"約 8.5×",[107,376,377,380,383],{},[128,378,379],{},"PCIe D2H（VRAM→RAM）",[128,381,382],{},"57.3 GB\u002Fs",[128,384,385],{},"約 8.4×",[107,387,388,391,394],{},[128,389,390],{},"PCIe 雙向",[128,392,393],{},"102.1 GB\u002Fs",[128,395,396],{},"約 15×",[107,398,399,402,404],{},[128,400,401],{},"NVMe 讀取（SSD→RAM）",[128,403,346],{},[128,405,406],{},"1×",[15,408,409],{},"倍數是我們拿論文數字相除的，不是論文寫的。",[15,411,412],{},"這代表什麼？一個躺在 RAM 裡的專家，重新服務給 GPU 的成本，大約是從 SSD 讀一次的八分之一。",[15,414,415],{},"但在「三層各自快取」的設計裡，VRAM 踢出來的專家如果 RAM 沒有副本，就直接丟掉。下次要用，得從 SSD 重讀。等於把最有價值的副本當垃圾。",[15,417,418,419,422],{},"Tideway 把 VRAM 和 RAM 合成",[41,420,421],{},"一個池","：",[76,424,425,428,431,438],{},[79,426,427],{},"一份統一的目錄（Residency Table），記每個專家在 VRAM 與 RAM 的哪個槽位",[79,429,430],{},"兩層都有的專家去重，但少數熱門專家允許兩層各留一份",[79,432,433,434,437],{},"VRAM 要踢人時，先看 RAM 有沒有副本：有就放掉 GPU 那份，沒有就",[41,435,436],{},"寫回 RAM","，不是丟掉",[79,439,440],{},"都不行時，才真的回 SSD",[15,442,443,444,71],{},"重點不是「Tideway 做了什麼」，是那個判斷：",[41,445,446],{},"在消費級 PC 上，跨層的價差是好幾倍，不是便宜很多",[15,448,449],{},"所以「留在上一層」本身就有價值。",[15,451,452],{},"（8.5 倍是 PCIe 5.0 與 WD_BLACK SN850X 的實測。換成 PCIe 4.0 或慢一點的 SSD，倍數會縮小，但「PCIe 比 SSD 快數倍」在主流平台成立。）",[61,454,456],{"id":455},"洞見二prefill-要串流decode-要快取","洞見二：prefill 要串流，decode 要快取",[15,458,459,460,71],{},"第二個洞見：兩個階段對記憶體的需求不只是不同，是",[41,461,462],{},"相反",[15,464,465,468],{},[41,466,467],{},"Prefill 要吞吐。"," 反正每個 chunk 都會掃過所有專家，那就別想命中率，想「搬運能不能被計算蓋掉」。Tideway 在 prefill 時把 VRAM 切成三塊：專家、雙緩衝、啟動區。雙緩衝的意思是：第 l 層在算，第 l+1 層的權重已經在搬。RAM 這邊，可重用的專家被 anchors 釘住，只留一個小視窗讓 SSD 的專家流進來。",[15,470,471,474],{},[41,472,473],{},"Decode 要容量。"," 每一步只碰少數專家，但會反覆碰。所以 VRAM 要回到固定位址的槽位，命中率才穩；RAM 當 LRU。執行上把每層切成三段 CUDA Graph（attention、router、experts），在 warmup 時捕獲一次。之後不管命中還是 miss，都只更新槽位、重播同一組圖，不重錄。",[15,476,477,480],{},[41,478,479],{},"階段切換。"," prefill 結束，anchors 放開、借來的 VRAM 還回去、佈局換成 decode 版。多數系統只維護一套佈局（SSD-LLaMA 就固定一套），所以兩個階段至少有一邊不是最佳。（如圖 2，以 64 GiB RAM 的設定為例。）",[15,482,483],{},[326,484],{"alt":485,"src":486},"如圖 2：同一個記憶體池，prefill 時切成串流用的雙緩衝與 anchors，decode 時換回固定槽位與 LRU 快取","\u002Fimages\u002Fblog\u002Ftideway-one-memory-pool\u002F02-phase-layout.svg",[61,488,490],{"id":489},"快多少197-倍的組成","快多少：1.97 倍的組成",[15,492,493,494,497],{},"先講清楚「快 1.97 倍」是什麼意思：",[41,495,496],{},"相對四套對照組裡最快的那一套","，在 270 組固定形狀的配置上平均。不是絕對秒數，也不是「2 秒變 1 秒」。",[15,499,500,501,504],{},"但最值得看的不是平均。",[41,502,503],{},"當 VRAM＋RAM 這個池大到所有專家都放得下時，Tideway 還是快 1.13–1.58 倍","。那時候已經沒有 SSD 的事了；差距來自把 CPU 調度拿掉、把 PCIe 搬運疊到計算後面。也就是說，「管理記憶體」不只是「減少 spill」，它本身就是效能。",[15,506,507],{},"平均與範圍是這樣：",[101,509,510,526],{},[104,511,512],{},[107,513,514,517,520,523],{},[110,515,516],{},"指標",[110,518,519],{},"平均",[110,521,522],{},"範圍",[110,524,525],{},"看的是什麼",[123,527,528,542,556],{},[107,529,530,533,536,539],{},[128,531,532],{},"端到端延遲（static 平均）",[128,534,535],{},"1.97×",[128,537,538],{},"static 1.13–3.18×、agent 軌跡 1.20–3.14×",[128,540,541],{},"一整輪請求",[107,543,544,547,550,553],{},[128,545,546],{},"TTFT（首字延遲）",[128,548,549],{},"2.40×",[128,551,552],{},"1.15–9.04×",[128,554,555],{},"prefill",[107,557,558,561,564,567],{},[128,559,560],{},"Decode 吞吐",[128,562,563],{},"1.61×",[128,565,566],{},"1.20–2.28×",[128,568,569],{},"生成階段",[15,571,572],{},"再往下拆，三個機制各值多少：",[101,574,575,591],{},[104,576,577],{},[107,578,579,582,585,588],{},[110,580,581],{},"版本",[110,583,584],{},"相對上一版",[110,586,587],{},"累積",[110,589,590],{},"做了什麼",[123,592,593,606,619,633],{},[107,594,595,598,601,603],{},[128,596,597],{},"Base：per-tier LRU、同步載入、eager",[128,599,600],{},"—",[128,602,406],{},[128,604,605],{},"起點",[107,607,608,611,614,616],{},[128,609,610],{},"+ 跨層記憶體管理",[128,612,613],{},"1.23×",[128,615,613],{},[128,617,618],{},"prefill 不再 thrash、去重",[107,620,621,624,627,630],{},[128,622,623],{},"+ 非同步搬運與 prefill 管線",[128,625,626],{},"1.36×",[128,628,629],{},"1.67×",[128,631,632],{},"搬運疊在計算後面",[107,634,635,638,640,643],{},[128,636,637],{},"+ 分段的 decode graph",[128,639,626],{},[128,641,642],{},"2.28×",[128,644,645],{},"拿掉 paging 時的 CPU 開銷",[15,647,648],{},"（累積欄是我們把三項增量乘起來的：1.23 × 1.36 ≈ 1.67，再 × 1.36 ≈ 2.28；論文給的總數是 2.28×。）",[15,650,651],{},"TTFT 那邊，前兩項把它推到 2.94×；TPOT 則靠 decode graph 到 2.04×。",[15,653,654],{},"還有一個敏感參數：prefill 的 chunk 大小。從 1K 到 8K，Tideway 相對最快 baseline 的優勢從 1.18× 拉開到 1.57×——chunk 越大，每層算得越久，搬運越藏得住。",[15,656,657],{},"至於絕對時間：如果 baseline 的 TTFT 是 100 秒，2.40 倍大約是 42 秒；如果 baseline 一次固定形狀的請求要 10 分鐘，1.97 倍大約是 5 分鐘；換成 agent 軌跡（1.20–3.14 倍），10 分鐘大約變 3 到 8 分鐘。（這些換算是我們的假設，不是論文量到的絕對值。）",[61,659,661],{"id":660},"它沒解決的限制與代價","它沒解決的：限制與代價",[15,663,664],{},"到這裡該踩煞車了。",[101,666,667,677],{},[104,668,669],{},[107,670,671,674],{},[110,672,673],{},"限制",[110,675,676],{},"對你的意思",[123,678,679,687,695,703,711,719,727],{},[107,680,681,684],{},[128,682,683],{},"仍要 SSD backing",[128,685,686],{},"155 GiB 不會變小；省的是「每次重讀」",[107,688,689,692],{},[128,690,691],{},"單卡、單機",[128,693,694],{},"多卡、多請求、排隊都沒有評測",[107,696,697,700],{},[128,698,699],{},"KV cache 先佔位",[128,701,702],{},"context 越長，專家能用的槽位越少",[107,704,705,708],{},[128,706,707],{},"兩套對照組是重現的",[128,709,710],{},"FlashMoE、SSD-LLaMA 沒開源，作者在 FreeToken 上重現機制，不是原系統對打",[107,712,713,716],{},[128,714,715],{},"沒有 vLLM 對照",[128,717,718],{},"論文沒測；我們認為這篇的服務前提（單卡、單流、模型放得下）和 vLLM 不同",[107,720,721,724],{},[128,722,723],{},"preprint、我們沒找到獨立複現",[128,725,726],{},"8 條 agent 軌跡是 TraceLab 的重播；實驗都出自同一組作者",[107,728,729,732],{},[128,730,731],{},"平台是 PCIe 5.0",[128,733,734],{},"倍數會隨平台變；16 GiB 是在 251 GiB 的機器上壓上限模擬的",[15,736,737],{},"它也還不是可以換進 llama.cpp 的套件。論文實作約 11.8K 行（Python 與 C，GPU kernel 用 Triton 與 CuTe DSL），是一套研究原型。",[15,739,740,741,744],{},"有一件事要說清楚：",[41,742,743],{},"它不是「把模型塞進記憶體」","。155 GiB 的模型在 64 GiB 的機器上，還是有大量權重要從 SSD 來。Tideway 做的是把 spill 的代價降到可接受。",[15,746,747],{},"還有兩件小事值得知道。開銷很小：圖捕獲幾秒、常駐緩衝不到 3% 的 VRAM。所有寫回都在 VRAM 與 RAM 之間，SSD 只讀不寫——對 SSD 壽命是好事。",[61,749,750],{"id":750},"所以你的機器該怎麼看",[15,752,753],{},"三個問題，按順序問。",[755,756,757,763,769],"ol",{},[79,758,759,762],{},[41,760,761],{},"權重和 (VRAM + RAM) 差多少？"," 先算帳：模型大小、KV cache、啟動區。差 10 GB 和差 90 GB，是完全不同的兩件事。",[79,764,765,768],{},[41,766,767],{},"瓶頸在 prefill 還是 decode？"," 長 prompt、多輪 agent、每次重讀大量 context，看 prefill（TTFT）。長輸出、單輪，看 decode（TPOT）。兩者的優化方向相反。",[79,770,771,774],{},[41,772,773],{},"你的 PCIe 與 SSD 是哪一級？"," 如果 SSD 只有 SATA 級（約 0.5 GB\u002Fs）、PCIe 也只有 4.0，那「留在 RAM」的價值比論文那台機器小，spill 的成本更高。",[15,776,777],{},"明天可以做的三件事：",[755,779,780,786,792],{},[79,781,782,785],{},[41,783,784],{},"算一次自己的記憶體帳。"," 權重（參數 × 每參數 byte）＋ KV cache（token × 層數 × KV head 數 × 維度 × 2 × byte）＋ 啟動與框架。十分鐘算得出來，比看十篇評測有用。拿這篇的數字試一次：155 − 32 − 64 ≈ 59 GiB 的權重必須從 SSD 來，還沒算 KV cache 與框架。",[79,787,788,791],{},[41,789,790],{},"量一次你自己的 TTFT\u002FTPOT 分解。"," 大部分引擎都有 log。拿一段 32K 的 prompt 跑一次，看時間花在讀 prompt 還是生成——這決定你該調 chunk size 還是 offload 策略。",[79,793,794,797],{},[41,795,796],{},"把「階段感知」寫進評估清單。"," 不管用 llama.cpp、FreeToken 還是別的，問一句：prefill 和 decode 用的是同一套佈局嗎？如果沒有，那就是這篇講的效率空間。",[15,799,800,801,805,806,809,810,814],{},"我們寫過同一件事的產品版：",[22,802,804],{"href":803},"\u002Fblog\u002Fstrata-125b-on-12gb","125B 跑在 12GB 顯卡上","。那篇講「怎麼用」，這篇講「為什麼現有系統慢、慢在哪一層」。量化那條路看",[22,807,808],{"href":277},"122B 一次只裝一層","；記憶體是瓶頸這個題目，",[22,811,813],{"href":812},"\u002Fblog\u002Flfm3-128k-kv-cache","LFM3 那篇","是另一個角度。",[15,816,817,818,822],{},"如果你在評估地端部署，",[22,819,821],{"href":820},"\u002Fservices","服務頁","有我們的做法。",[15,824,825],{},"記憶體不是不夠，是 VRAM 和 RAM 沒被當成同一個池用。你要的不是 512 GB，是一個不把 RAM 當垃圾桶的排程器。",{"title":827,"searchDepth":828,"depth":828,"links":829},"",2,[830,831,832,833,834,835,836,837],{"id":63,"depth":828,"text":64},{"id":192,"depth":828,"text":193},{"id":291,"depth":828,"text":292},{"id":332,"depth":828,"text":333},{"id":455,"depth":828,"text":456},{"id":489,"depth":828,"text":490},{"id":660,"depth":828,"text":661},{"id":750,"depth":828,"text":750},"\u002Fimages\u002Fblog\u002Ftideway-one-memory-pool.svg","標題「你不需要 512 GB 記憶體，你需要更好的記憶體管理」的技術筆記封面","2026-11-24","主流消費級 PC 的記憶體是 16–64 GiB，論文裡那顆 FP4 的 DeepSeek-V4-Flash 卻要 155 GiB。現有推論系統把 VRAM、RAM、SSD 當三層獨立快取，prefill 的專家流量有 86–99% 從 SSD 來。Tideway 把 VRAM 和 RAM 合成一個池、SSD 當備援：端到端 1.97 倍、TTFT 2.40 倍，以及這些數字的邊界。",false,"md","zh-TW",{},true,"\u002Fimages\u002Fblog\u002Ftideway-one-memory-pool.jpg","\u002Fblog\u002Fzh-tw\u002Ftideway-one-memory-pool",{"title":6,"description":841},"tideway-one-memory-pool","blog\u002Fzh-TW\u002Ftideway-one-memory-pool",[853,854,855,856],"local-llm","moe","memory","inference",null,"47mWcybFLxHcjYBjrJ1lojO-73eid-AMFjGrgB0gqrY",{"id":860,"title":861,"author":7,"body":862,"cover":1628,"coverAlt":1629,"date":840,"description":1630,"draft":842,"extension":843,"featured":842,"lang":1631,"meta":1632,"navigation":846,"ogImage":1633,"path":1634,"seo":1635,"slug":850,"stem":1636,"tags":1637,"translationKey":850,"updated":857,"__hash__":1638},"blog\u002Fblog\u002Fen\u002Ftideway-one-memory-pool.md","You Don't Need 512 GB of RAM",{"type":9,"value":863,"toc":1618},[864,879,882,885,888,891,894,897,900,904,910,913,930,937,1008,1011,1014,1017,1021,1024,1092,1095,1102,1105,1111,1115,1118,1121,1124,1130,1133,1143,1146,1152,1156,1159,1168,1224,1227,1230,1233,1240,1258,1265,1268,1272,1275,1281,1287,1293,1299,1303,1310,1366,1372,1375,1378,1446,1449,1452,1455,1458,1462,1465,1535,1538,1545,1548,1552,1555,1575,1578,1598,1608,1615],[12,865,866,869],{},[15,867,868],{},"No benchmarks of our own here. The numbers come from arXiv 2611.14848 (\"Tideway\", Duke University, Nov 10, 2026) and the authors' open-source code. It is a preprint: we found no independent reproduction, and two of the four baselines are the authors' reimplementation of mechanisms, not the original systems. Anything we computed ourselves is labeled.",[15,870,871,872,875,876],{},"Paper: ",[22,873,27],{"href":24,"rel":874},[26]," | Code: ",[22,877,33],{"href":31,"rel":878},[26],[15,880,881],{},"A machine with 64 GiB of RAM and a 32 GB GPU is reading a 32K-token prompt.",[15,883,884],{},"Its RAM can hold 44% of the expert weights, yet once prefill finishes, 86–99% of the expert traffic comes from the SSD.",[15,886,887],{},"This is where that 86–99% comes from — and why the same memory runs 1.97× faster under a different memory manager.",[15,889,890],{},"Some terms first. MoE (mixture of experts) splits each layer's feed-forward network into many small \"experts\" and routes each token to a few of them. Prefill is the phase that reads the prompt; decode is the phase that emits tokens one at a time. TTFT is the time to first token and TPOT the time per output token; the KV cache is the attention state that grows with the conversation, and a CUDA Graph is a captured sequence of GPU kernels that can be replayed without re-dispatching from the CPU.",[15,892,893],{},"Those 44% barely did any work. And this is not one engine being sloppy: all four baselines (FreeToken, llama.cpp, FlashMoE, SSD-LLaMA) fall into the same hole.",[15,895,896],{},"The problem is not that the model is too big. It is that they treat memory as three caches that never talk to each other. VRAM caches RAM, RAM caches the SSD, and each tier runs its own replacement policy — mostly LRU (least recently used), a learned policy in FlashMoE, and in llama.cpp the OS mmap (page granularity, which thrashes once it reaches the SSD).",[15,898,899],{},"Start with the bill.",[61,901,903],{"id":902},"start-with-the-bill-512-gib-of-ram-costs-41000","Start with the bill: 512 GiB of RAM costs $41,000",[15,905,906,907],{},"The largest model in the paper is DeepSeek-V4-Flash. ",[41,908,909],{},"Even stored in FP4, it is 155 GiB.",[15,911,912],{},"Now look at the machines people actually own. The paper pulls four 2026 datasets: prebuilt desktop quotes, 3DMark submissions, BOINC hosts, and the Steam hardware survey. Same story in all four:",[76,914,915,921,927],{},[79,916,917,920],{},[41,918,919],{},"16–64 GiB is the mainstream",": it covers 64–84% of the three RTX 5090 populations and 99% of Steam machines",[79,922,923,926],{},[41,924,925],{},"More than 128 GiB shows up in at most 11%"," of any population",[79,928,929],{},"Even people who bought the most expensive consumer GPU stop at 64 GiB",[15,931,932,933,936],{},"Price is a different matter. The paper plots prebuilt quotes against RAM size: under $10k up to 128 GiB, then a cliff — ",[41,934,935],{},"about $26k at 256 GiB, about $41k at 512 GiB"," (usually marketed as 512 GB).",[101,938,939,955],{},[104,940,941],{},[107,942,943,946,949,952],{},[110,944,945],{},"RAM",[110,947,948],{},"Coverage",[110,950,951],{},"Prebuilt price",[110,953,954],{},"Fits 155 GiB of weights?",[123,956,957,970,982,995],{},[107,958,959,961,964,967],{},[128,960,130],{},[128,962,963],{},"64–84% of RTX 5090 owners, 99% of Steam",[128,965,966],{},"under $10k",[128,968,969],{},"no",[107,971,972,974,977,979],{},[128,973,144],{},[128,975,976],{},"a minority",[128,978,966],{},[128,980,981],{},"no, 27 GiB short",[107,983,984,986,989,992],{},[128,985,157],{},[128,987,988],{},"under 11%",[128,990,991],{},"about $26k",[128,993,994],{},"yes, KV cache aside",[107,996,997,999,1002,1005],{},[128,998,171],{},[128,1000,1001],{},"rarer",[128,1003,1004],{},"about $41k",[128,1006,1007],{},"yes",[15,1009,1010],{},"(Coverage and prices are the paper's; \"27 GiB short\" is 155 − 128.)",[15,1012,1013],{},"\"Just buy more RAM\" is not an option. Such a machine costs two to four times as much. And even at 256 GiB, 155 GiB of weights takes 60% of it (our arithmetic: 155 ÷ 256), leaving 101 GiB for the KV cache and activations.",[15,1015,1016],{},"So what if the problem is not how much memory you have, but how it gets used?",[61,1018,1020],{"id":1019},"the-weights-have-to-spill-vram-ram-ssd","The weights have to spill: VRAM, RAM, SSD",[15,1022,1023],{},"The test machine has an RTX 5090 with 32 GB of VRAM. The authors cap host RAM between 16 and 128 GiB to simulate different budgets. Three models:",[101,1025,1026,1045],{},[104,1027,1028],{},[107,1029,1030,1033,1036,1039,1042],{},[110,1031,1032],{},"Model",[110,1034,1035],{},"Total params (active)",[110,1037,1038],{},"Precision",[110,1040,1041],{},"Weight size",[110,1043,1044],{},"Gap on a 32 GB card",[123,1046,1047,1062,1077],{},[107,1048,1049,1051,1054,1056,1059],{},[128,1050,224],{},[128,1052,1053],{},"35B (3B)",[128,1055,230],{},[128,1057,1058],{},"about 70 GB",[128,1060,1061],{},"about 38 GB",[107,1063,1064,1066,1069,1071,1074],{},[128,1065,241],{},[128,1067,1068],{},"26B (4B)",[128,1070,230],{},[128,1072,1073],{},"about 52 GB",[128,1075,1076],{},"about 20 GB",[107,1078,1079,1081,1084,1087,1089],{},[128,1080,257],{},[128,1082,1083],{},"not reported",[128,1085,1086],{},"native FP4",[128,1088,265],{},[128,1090,1091],{},"about 123 GiB",[15,1093,1094],{},"The first two weight sizes are our arithmetic at 2 bytes per parameter (BF16), and their gaps subtract the card's nominal 32 GB; DeepSeek's 123 GiB is 155 GiB − 32 GiB. None of it comes from the paper.",[15,1096,1097,1098,1101],{},"None of the three fits in 32 GB. DeepSeek-V4-Flash is the extreme case: it is already FP4, four bits per parameter. Compressing further is a quality decision, not a format switch. We wrote about that in ",[22,1099,1100],{"href":277},"our quantization piece",": quantization is not free.",[15,1103,1104],{},"So the weights spill: what does not fit in VRAM goes to RAM, and what does not fit in RAM goes to the SSD. This is not a failed load. It is a transfer that can happen on every forward pass.",[15,1106,1107,1108],{},"Which leaves one question: ",[41,1109,1110],{},"how should the tiers be arranged so that moving weights does not become the main cost?",[61,1112,1114],{"id":1113},"what-existing-systems-get-wrong-three-tiers-three-independent-caches","What existing systems get wrong: three tiers, three independent caches",[15,1116,1117],{},"Most inference engines manage memory the way a datacenter would. DRAM is expensive, SSD is cheap, so VRAM caches RAM and RAM caches the SSD, and each tier evicts on its own.",[15,1119,1120],{},"Datacenter servers have abundant DRAM, so the assumption usually holds.",[15,1122,1123],{},"On a consumer PC it kills the system. Two phases, two ways.",[15,1125,1126,1129],{},[41,1127,1128],{},"Prefill (reading the prompt)."," One 8K-token chunk activates nearly every expert in every layer. Prefill does not need \"a few experts\"; it needs a full sweep of the model. Once the expert pool exceeds RAM, the sweep becomes cyclic: loading later layers evicts earlier ones, and the next chunk starts over.",[15,1131,1132],{},"So a 64 GiB machine holds 44% of the pool, and the SSD still supplies 86–99% of the baselines' prefill expert traffic. Tideway comes in at 52% in the same setting. (Figure 1)",[15,1134,1135,1138,1139,1142],{},[41,1136,1137],{},"Decode (generating)."," Each step touches only a few experts, but a single miss stalls it. Dynamic paging also breaks CUDA Graph: a fixed-shape capture cannot express \"fetch one expert from the SSD mid-layer,\" so engines fall back to eager execution and pay host dispatch and sync on every token. llama.cpp is the opposite extreme: almost no launch overhead, but ",[41,1140,1141],{},"92% of its decode time goes to computing experts on the CPU",".",[15,1144,1145],{},"The two failures are different in kind. Prefill fails at retention; decode fails at execution. A system has to solve both.",[15,1147,1148],{},[326,1149],{"alt":1150,"src":1151},"Figure 1: On the same 64 GiB machine, four baselines pull 86–99% of prefill expert traffic from the SSD, while Tideway pulls 52%. The first row is what RAM actually holds, 44%.","\u002Fimages\u002Fblog\u002Fen\u002Ftideway-one-memory-pool\u002F01-prefill-traffic.svg",[61,1153,1155],{"id":1154},"insight-one-pcie-beats-the-ssd-so-the-ram-copy-is-worth-keeping","Insight one: PCIe beats the SSD, so the RAM copy is worth keeping",[15,1157,1158],{},"One measurement in the paper underpins everything else.",[15,1160,1161,1162,1165,1166,1142],{},"On the same machine, PCIe 5.0 delivers ",[41,1163,1164],{},"57.6 GB\u002Fs host-to-device, 57.3 GB\u002Fs device-to-host, and 102.1 GB\u002Fs bidirectional","; the NVMe drive reads at ",[41,1167,346],{},[101,1169,1170,1183],{},[104,1171,1172],{},[107,1173,1174,1177,1180],{},[110,1175,1176],{},"Path",[110,1178,1179],{},"Measured",[110,1181,1182],{},"vs SSD",[123,1184,1185,1195,1205,1215],{},[107,1186,1187,1190,1192],{},[128,1188,1189],{},"PCIe H2D (RAM→VRAM)",[128,1191,371],{},[128,1193,1194],{},"about 8.5×",[107,1196,1197,1200,1202],{},[128,1198,1199],{},"PCIe D2H (VRAM→RAM)",[128,1201,382],{},[128,1203,1204],{},"about 8.4×",[107,1206,1207,1210,1212],{},[128,1208,1209],{},"PCIe bidirectional",[128,1211,393],{},[128,1213,1214],{},"about 15×",[107,1216,1217,1220,1222],{},[128,1218,1219],{},"NVMe read (SSD→RAM)",[128,1221,346],{},[128,1223,406],{},[15,1225,1226],{},"The ratios are our division of the paper's numbers, not the paper's.",[15,1228,1229],{},"So re-serving an expert that already sits in RAM costs roughly one eighth of reading it back from the SSD.",[15,1231,1232],{},"Yet in a three-cache design, an expert evicted from VRAM and absent from RAM is simply dropped. The next access pays for an SSD read. The most valuable copy gets thrown away.",[15,1234,1235,1236,1239],{},"Tideway instead makes VRAM and RAM ",[41,1237,1238],{},"one pool",":",[76,1241,1242,1245,1248,1255],{},[79,1243,1244],{},"one directory (the Residency Table) recording which slot holds each expert in VRAM and in RAM",[79,1246,1247],{},"deduplication across tiers, with a small set of hot experts allowed to live in both",[79,1249,1250,1251,1254],{},"on VRAM eviction, check RAM first: if a copy exists, drop the GPU one; if not, ",[41,1252,1253],{},"write the victim back to RAM"," instead of discarding it",[79,1256,1257],{},"only when neither works does the expert leave for the SSD",[15,1259,1260,1261,1264],{},"The point is not what Tideway implements. The point is the judgment underneath: ",[41,1262,1263],{},"on a consumer PC, crossing a tier costs several times more than staying in it, not a little more."," Keeping the copy one tier up is worth real money.",[15,1266,1267],{},"(The 8.5× comes with a hardware caveat: PCIe 5.0 and a WD_BLACK SN850X. On PCIe 4.0 or a slower SSD the ratio shrinks, but \"PCIe is several times faster than the SSD\" still holds on mainstream hardware.)",[61,1269,1271],{"id":1270},"insight-two-prefill-streams-decode-caches","Insight two: prefill streams, decode caches",[15,1273,1274],{},"The second insight: the two phases do not merely want different layouts. They want opposite ones.",[15,1276,1277,1280],{},[41,1278,1279],{},"Prefill wants throughput."," Every chunk sweeps all experts anyway, so stop optimizing hit rate and start hiding transfers behind compute. Tideway splits VRAM three ways during prefill: experts, a double buffer, and workspace. Layer l computes while layer l+1's weights are already in flight. In RAM, reusable experts are pinned with anchors, and a small streaming window is left for experts arriving from the SSD.",[15,1282,1283,1286],{},[41,1284,1285],{},"Decode wants capacity."," Each step touches few experts, but it touches them again and again. VRAM returns to fixed-address slots so hit rates stay stable; RAM becomes an LRU cache. Each layer is captured as three CUDA Graph segments — attention, router, experts — once at warmup. After that, a hit or a miss only updates slot IDs and replays the same graphs; nothing is recaptured.",[15,1288,1289,1292],{},[41,1290,1291],{},"The switch."," When prefill ends, anchors are released, borrowed VRAM goes back, and the layout flips to the decode version. Most systems keep one layout across both phases (SSD-LLaMA fixes one), so at least one phase pays. Figure 2 shows the same pool under both layouts, using 64 GiB of RAM as the example.",[15,1294,1295],{},[326,1296],{"alt":1297,"src":1298},"Figure 2: The same memory pool under two layouts. During prefill it is split into streaming buffers and pinned anchors; during decode it returns to fixed slots and an LRU cache.","\u002Fimages\u002Fblog\u002Fen\u002Ftideway-one-memory-pool\u002F02-phase-layout.svg",[61,1300,1302],{"id":1301},"how-much-faster-and-where","How much faster, and where",[15,1304,1305,1306,1309],{},"First, what \"1.97× faster\" means: ",[41,1307,1308],{},"against the fastest of four baselines",", averaged over 270 fixed-shape configurations. It is not an absolute wall-clock number, and it is not \"two seconds become one.\"",[101,1311,1312,1328],{},[104,1313,1314],{},[107,1315,1316,1319,1322,1325],{},[110,1317,1318],{},"Metric",[110,1320,1321],{},"Average",[110,1323,1324],{},"Range",[110,1326,1327],{},"What it measures",[123,1329,1330,1343,1354],{},[107,1331,1332,1335,1337,1340],{},[128,1333,1334],{},"End-to-end latency (static average)",[128,1336,535],{},[128,1338,1339],{},"1.13–3.18× static, 1.20–3.14× agent traces",[128,1341,1342],{},"a full request",[107,1344,1345,1348,1350,1352],{},[128,1346,1347],{},"TTFT",[128,1349,549],{},[128,1351,552],{},[128,1353,555],{},[107,1355,1356,1359,1361,1363],{},[128,1357,1358],{},"Decode throughput",[128,1360,563],{},[128,1362,566],{},[128,1364,1365],{},"generation",[15,1367,1368,1369],{},"The most interesting number is not in the average: ",[41,1370,1371],{},"when the pool (VRAM + RAM) holds every expert, Tideway is still 1.13–1.58× faster.",[15,1373,1374],{},"At that point the SSD is out of the picture. The gap comes from removing CPU dispatch and overlapping PCIe transfers with compute. Managing memory is not only about reducing spill; it is performance by itself.",[15,1376,1377],{},"Here is what each mechanism is worth:",[101,1379,1380,1396],{},[104,1381,1382],{},[107,1383,1384,1387,1390,1393],{},[110,1385,1386],{},"Version",[110,1388,1389],{},"Incremental",[110,1391,1392],{},"Cumulative",[110,1394,1395],{},"What it added",[123,1397,1398,1410,1422,1434],{},[107,1399,1400,1403,1405,1407],{},[128,1401,1402],{},"Base: per-tier LRU, sync loads, eager",[128,1404,600],{},[128,1406,406],{},[128,1408,1409],{},"starting point",[107,1411,1412,1415,1417,1419],{},[128,1413,1414],{},"+ cross-tier memory manager",[128,1416,613],{},[128,1418,613],{},[128,1420,1421],{},"stops prefill thrash, dedups",[107,1423,1424,1427,1429,1431],{},[128,1425,1426],{},"+ async transfers and prefill pipeline",[128,1428,626],{},[128,1430,629],{},[128,1432,1433],{},"overlaps transfers with compute",[107,1435,1436,1439,1441,1443],{},[128,1437,1438],{},"+ piecewise decode graphs",[128,1440,626],{},[128,1442,642],{},[128,1444,1445],{},"removes paging dispatch cost",[15,1447,1448],{},"(The cumulative column is our multiplication: 1.23 × 1.36 ≈ 1.67, then × 1.36 ≈ 2.28; the paper's total is 2.28×.)",[15,1450,1451],{},"TTFT gets to 2.94× from the first two; TPOT reaches 2.04× mostly through the decode graphs.",[15,1453,1454],{},"One more sensitive knob: prefill chunk size. From 1K to 8K, Tideway's edge over the fastest baseline widens from 1.18× to 1.57×. Bigger chunks mean more compute per layer to hide transfers behind.",[15,1456,1457],{},"And in absolute terms: if a baseline TTFT is 100 seconds, 2.40× puts you near 42. On the static-shape average, a 10-minute request becomes about 5 minutes; on the agent traces the range is 1.20–3.14×, so 10 minutes becomes 3 to 8. (Those conversions are our hypotheticals, not measured absolute values.)",[61,1459,1461],{"id":1460},"what-it-does-not-fix","What it does not fix",[15,1463,1464],{},"Time to brake.",[101,1466,1467,1477],{},[104,1468,1469],{},[107,1470,1471,1474],{},[110,1472,1473],{},"Limit",[110,1475,1476],{},"What it means for you",[123,1478,1479,1487,1495,1503,1511,1519,1527],{},[107,1480,1481,1484],{},[128,1482,1483],{},"Still needs SSD backing",[128,1485,1486],{},"155 GiB does not shrink; what shrinks is re-reading it",[107,1488,1489,1492],{},[128,1490,1491],{},"One GPU, one machine",[128,1493,1494],{},"multi-GPU, concurrency, and queuing are not evaluated",[107,1496,1497,1500],{},[128,1498,1499],{},"KV cache is reserved first",[128,1501,1502],{},"longer context leaves fewer expert slots",[107,1504,1505,1508],{},[128,1506,1507],{},"Two baselines are reproductions",[128,1509,1510],{},"FlashMoE and SSD-LLaMA are closed-source; mechanisms were reproduced on FreeToken, not the original systems",[107,1512,1513,1516],{},[128,1514,1515],{},"No vLLM baseline",[128,1517,1518],{},"not tested; we think the paper's serving assumptions (single GPU, single stream, model fits) differ",[107,1520,1521,1524],{},[128,1522,1523],{},"Preprint, no independent reproduction we found",[128,1525,1526],{},"the 8 agent traces are TraceLab replays; the experiments come from one group",[107,1528,1529,1532],{},[128,1530,1531],{},"The platform is PCIe 5.0",[128,1533,1534],{},"ratios move with hardware; the 16 GiB case is a RAM cap on a 251 GiB box",[15,1536,1537],{},"It is not a drop-in replacement for llama.cpp. The implementation is about 11.8K lines (Python and C, with GPU kernels in Triton and CuTe DSL) — a research prototype.",[15,1539,1540,1541,1544],{},"One thing needs saying: ",[41,1542,1543],{},"it does not fit the model into memory."," A 155 GiB model on a 64 GiB machine still streams a lot of weights from the SSD. Tideway makes the price of spilling acceptable.",[15,1546,1547],{},"Two smaller notes. The overhead is small: graph capture takes seconds, and persistent buffers use under 3% of VRAM. All write-backs stay between VRAM and RAM; the SSD is read-only, which is good for its endurance.",[61,1549,1551],{"id":1550},"so-how-should-you-look-at-your-machine","So how should you look at your machine?",[15,1553,1554],{},"Three questions, in order.",[755,1556,1557,1563,1569],{},[79,1558,1559,1562],{},[41,1560,1561],{},"How far apart are the weights and (VRAM + RAM)?"," Do the arithmetic first: model size, KV cache, activation workspace. Ten gigabytes short and ninety gigabytes short are different problems.",[79,1564,1565,1568],{},[41,1566,1567],{},"Is prefill or decode your bottleneck?"," Long prompts, multi-turn agents, re-reading a large context: prefill (TTFT). Long outputs, single turns: decode (TPOT). The optimizations point in opposite directions.",[79,1570,1571,1574],{},[41,1572,1573],{},"What generation is your PCIe link, and how fast is your SSD?"," If your SSD is SATA-class (about 0.5 GB\u002Fs) and your bus is PCIe 4.0, keeping experts in RAM is worth less than on the paper's machine, and spilling costs more.",[15,1576,1577],{},"Three things you can do tomorrow:",[755,1579,1580,1586,1592],{},[79,1581,1582,1585],{},[41,1583,1584],{},"Do your own memory arithmetic."," Weights (params × bytes per parameter) + KV cache (tokens × layers × KV heads × head dim × 2 × bytes) + activations and framework overhead. Ten minutes of arithmetic beats ten benchmark posts.",[79,1587,1588,1591],{},[41,1589,1590],{},"Measure your own TTFT\u002FTPOT split."," Most engines log both. Run one 32K prompt and see where the time goes; that tells you whether to tune chunk size or offload policy.",[79,1593,1594,1597],{},[41,1595,1596],{},"Put \"phase-aware\" on your evaluation checklist."," Whether you run llama.cpp, FreeToken, or something else, ask: does prefill use the same layout as decode? If it does, that is the headroom this paper is talking about.",[15,1599,1600,1601,1604,1605,1142],{},"We wrote the product-side version of the same problem in Chinese: a 125B model running on a 12GB card. That piece is \"how to use it\"; this one is \"why the existing stack is slow, and where the time goes.\" For the quantization route, see ",[22,1602,1603],{"href":277},"122B one layer at a time","; for memory as the bottleneck from another angle, ",[22,1606,1607],{"href":812},"the LFM3 piece",[15,1609,1610,1611,1614],{},"If you are evaluating on-prem deployment, ",[22,1612,1613],{"href":820},"our services page"," describes how we approach it.",[15,1616,1617],{},"Memory is not too small. VRAM and RAM simply never get treated as one pool. What you need is not 512 GB — it is a scheduler that does not treat RAM as a trash can.",{"title":827,"searchDepth":828,"depth":828,"links":1619},[1620,1621,1622,1623,1624,1625,1626,1627],{"id":902,"depth":828,"text":903},{"id":1019,"depth":828,"text":1020},{"id":1113,"depth":828,"text":1114},{"id":1154,"depth":828,"text":1155},{"id":1270,"depth":828,"text":1271},{"id":1301,"depth":828,"text":1302},{"id":1460,"depth":828,"text":1461},{"id":1550,"depth":828,"text":1551},"\u002Fimages\u002Fblog\u002Fen\u002Ftideway-one-memory-pool.svg","Cover for the English essay, You Don't Need 512 GB of RAM","Most consumer PCs sit at 16–64 GiB; the paper's frontier MoE is 155 GiB at FP4. Engines keep VRAM and RAM apart, so the SSD supplies 86–99% of their prefill expert traffic. Tideway pools them: 1.97×.","en",{},"\u002Fimages\u002Fblog\u002Fen\u002Ftideway-one-memory-pool.jpg","\u002Fblog\u002Fen\u002Ftideway-one-memory-pool",{"title":861,"description":1630},"blog\u002Fen\u002Ftideway-one-memory-pool",[853,854,855,856],"_Jhsnko5i1NpdPhYO_zkDvv1aPhtY6hVngiZF8hnbR4",{"id":1640,"company":1641,"extension":1652,"meta":1653,"services":1654,"social":1732,"stem":1733,"__hash__":1734},"site\u002Fsite.yml",{"name":1642,"nameEn":1643,"email":1644,"address":1645,"addressEn":1646,"lineUrl":1647,"lineId":1648,"duns":1649,"youtube":1650,"youtubeId":1651},"銡策數位有限公司","Jecision Digital Co., Ltd.","contact@jecision.com","231 新北市新店區北新路二段 262 號 3 樓之 3","3F.-3, No. 262, Sec. 2, Beixin Rd., Xindian Dist., New Taipei City 231, Taiwan","https:\u002F\u002Fline.me\u002FR\u002Fti\u002Fp\u002F@374qnumi","@374qnumi","963905705","https:\u002F\u002Fwww.youtube.com\u002Fshorts\u002F6UE0WTmyjsg","6UE0WTmyjsg","yml",{},[1655,1679,1705],{"key":1656,"zh":1657,"en":1668},"audit",{"title":1658,"tagline":1659,"summary":1660,"points":1661,"deliverable":1665,"detail":1666,"duration":1667},"企業 AI 導入健檢","先看清楚，再花錢","60 分鐘線上訪談，盤點最耗時、最依賴人力的營運環節；我們會告訴你哪些工作現在就能交給 AI、哪些還不成熟。",[1662,1663,1664],"現況盤點：梳理日常營運中最耗時、最依賴人力的環節","痛點診斷：判斷哪些工作現在就能交給 AI，哪些建議先保留人力","可行性評估：依你的業務特性與預算，篩選適合的模型與工具","《企業 AI 導入建議報告書》（PDF）","含 1–2 個「開發成本最低、成效最明顯」的優先項目、技術棧建議、預期節省的人力時間與下一步","訪談 60 分鐘，報告書 3 個工作天內交付",{"title":1669,"tagline":1670,"summary":1671,"points":1672,"deliverable":1676,"detail":1677,"duration":1678},"AI Readiness Audit","Look before you spend","A 60-minute remote audit of the workflows that eat the most time and people-power — and an honest answer on what AI can take over today, and what it cannot.",[1673,1674,1675],"Audit the daily workflows that consume the most time and headcount","Triage which tasks AI can own today, and which should stay human","Shortlist the models and tools that fit your budget and constraints","AI Adoption Recommendation Report (PDF)","One or two highest-ROI entry points, a recommended tech stack, expected hours saved, and the concrete next step","60-minute call, report delivered within 3 business days",{"key":1680,"zh":1681,"en":1692},"prompt",{"title":1682,"tagline":1683,"summary":1684,"points":1685,"deliverable":1689,"detail":1690,"duration":1691},"提示詞工程","讓 AI 穩定產出，而不是碰運氣","針對你的實際任務設計提示詞與多步驟工作流，並做極限測試，確保換了資料、換了人操作也不會走鐘。",[1686,1687,1688],"客製提示詞：ChatGPT、Claude、Gemini、Midjourney 等主流工具的專屬模板","除錯與優化：修掉幻覺、格式跑掉、時好時壞的問題","工作流建置：把複雜任務拆成多步驟提示詞與可重複的 SOP","提示詞文件或設定檔","附使用說明與範例，並提供 1 對 1 教學，確保你與團隊能自己維護","依任務複雜度報價，通常 3–7 個工作天",{"title":1693,"tagline":1694,"summary":1695,"points":1696,"deliverable":1702,"detail":1703,"duration":1704},"Prompt Engineering","Make AI produce reliably, not by luck","Prompt sets and multi-step workflows designed for your actual tasks, stress-tested so they keep working when the data or the operator changes.",[1697,1698,1700],"Custom prompts for ChatGPT, Claude, Gemini, Midjourney and friends",{"Debugging and tuning":1699},"kill hallucinations, broken formats and flaky output",{"Workflow design":1701},"break complex work into repeatable multi-step SOPs","Prompt library or exportable config","Ships with usage notes and examples, plus a 1:1 walkthrough so your team can maintain it","Quoted by complexity, typically 3–7 business days",{"key":1706,"zh":1707,"en":1718},"poc",{"title":1708,"tagline":1709,"summary":1710,"points":1711,"deliverable":1715,"detail":1716,"duration":1717},"極速 PoC","五天，看到能跑的東西","不談架構藍圖，直接做一個能動的雛形。五個工作天內交付線上可操作的智能體，用你真實的資料驗證。",[1712,1713,1714],"Day 1：15 分鐘對焦，鎖定單一痛點與資料盤點","Day 2–4：模型串接、邏輯設計與雛形開發","Day 5：Demo 展示與 AI 擴展建議書","可線上操作的智能體雛形","交付範圍為概念驗證與展示，不含後續維運或大規模伺服器部署；要進階成完整系統會另行報價","5 個工作天",{"title":1719,"tagline":1720,"summary":1721,"points":1722,"deliverable":1729,"detail":1730,"duration":1731},"Rapid PoC","Five days to something that runs","No architecture decks — a working prototype built in five business days, validated against your real data.",[1723,1725,1727],{"Day 1":1724},"15-minute scoping call, one pain point, data inventory",{"Day 2–4":1726},"model integration, logic design, prototype build",{"Day 5":1728},"live demo plus an AI expansion recommendation","A runnable online agent prototype","Proof of concept and demo scope only; ongoing operations and large-scale deployment are quoted separately","5 business days",[],"site","XTwARfVAOcrXNiKehsM6V6cdkd2HXy4d5yZVrSWrI3Q",[1736,2689],{"id":1737,"title":1738,"author":7,"body":1739,"cover":2674,"coverAlt":2675,"date":2676,"description":2677,"draft":842,"extension":843,"featured":842,"lang":1631,"meta":2678,"navigation":846,"ogImage":2679,"path":2680,"seo":2681,"slug":2682,"stem":2683,"tags":2684,"translationKey":2682,"updated":857,"__hash__":2688},"blog\u002Fblog\u002Fen\u002Flfm3-128k-kv-cache.md","128K of Context, 1.6 GB of KV Cache",{"type":9,"value":1740,"toc":2664},[1741,1760,1763,1766,1769,1772,1775,1778,1782,1785,1788,1791,1794,1797,1800,1803,1807,1810,1884,1887,1890,1893,1896,1899,1914,1920,1935,1938,1945,1949,2009,2012,2015,2018,2021,2024,2032,2035,2042,2046,2049,2052,2055,2062,2065,2068,2255,2258,2261,2264,2267,2270,2371,2374,2377,2380,2383,2386,2389,2392,2398,2401,2404,2408,2411,2483,2486,2489,2492,2495,2498,2501,2504,2510,2513,2516,2520,2523,2532,2538,2541,2547,2550,2554,2557,2563,2569,2580,2586,2589,2595,2598,2630,2634,2654,2661],[12,1742,1743,1752],{},[15,1744,1745,1746,1751],{},"Numbers come from Liquid AI's ",[22,1747,1750],{"href":1748,"rel":1749},"https:\u002F\u002Fwww.liquid.ai\u002Fblog\u002Flfm3",[26],"launch post"," (Oct 27, 2026) and the model cards. Percentages, ratios and gaps are our arithmetic on the published numbers. We did not rerun either model, and the comparison set is the one Liquid AI picked. One section is ours: how that average is built. Anyone can check it against the same table.",[15,1753,1754,1755,1759],{},"Weights: ",[1756,1757,1758],"code",{},"LiquidAI\u002FLFM3-*"," on Hugging Face.",[15,1761,1762],{},"An agent holding 128K of context. A whole repository, a whole manual, a full day of tool output.",[15,1764,1765],{},"It runs on a phone, on a Raspberry Pi 5, on a laptop without a discrete GPU. The KV cache bill for that context is 1.6 GB, weights not included.",[15,1767,1768],{},"Three things worth separating: where that 1.6 GB comes from, how the report card becomes an average, and what the model is actually for.",[15,1770,1771],{},"That is LFM3-1.7B. The same model scores 49.37 across the 29 rows Liquid AI published, against 47.24 for Qwen3.5-9B.",[15,1773,1774],{},"A 1.7B model beating a 9B one sounds like an architecture revolution. Split the claim in two and the picture gets much clearer.",[15,1776,1777],{},"Six of its 24 layers are still global attention. And that average is 29 equal-weight rows. Taken apart, the biggest wins sit on one axis and the biggest losses are about knowledge or distance.",[61,1779,1781],{"id":1780},"what-128k-actually-costs","What 128K actually costs",[15,1783,1784],{},"Start with something nobody disputes.",[15,1786,1787],{},"Every time a model emits a token, every attention layer looks back over all the tokens before it. Recomputing that is too expensive, so the intermediate results get stored. That store is the KV cache.",[15,1789,1790],{},"It scales with the number of layers that keep KV, the context length, the number of KV heads, and the head dimension. Every layer, every KV head, every token keeps a K and a V vector.",[15,1792,1793],{},"So \"supports 128K\" is one line on a product page and a few gigabytes in memory.",[15,1795,1796],{},"Liquid AI's own comparison is blunt: at a full 128K, Qwen3.5-4B needs 4.3 GB of KV cache and MiniCPM5-2B needs 5.6 GB.",[15,1798,1799],{},"This hurts agents specifically. One tool output is thousands of tokens, context only grows across turns, and you want the thing sitting in the background all day.",[15,1801,1802],{},"I think the real cost of long context is not the prefill pass. It is that you have to keep holding that memory. A phone does not have the budget, so the agent stays short.",[61,1804,1806],{"id":1805},"its-answer-24-layers-only-6-of-them-full-attention","Its answer: 24 layers, only 6 of them full attention",[15,1808,1809],{},"The 24 layers of LFM3-1.7B are not the same kind of layer.",[101,1811,1812,1831],{},[104,1813,1814],{},[107,1815,1816,1819,1822,1825,1828],{},[110,1817,1818],{},"Operator",[110,1820,1821],{},"Layers",[110,1823,1824],{},"Sees",[110,1826,1827],{},"Stores KV?",[110,1829,1830],{},"Job",[123,1832,1833,1850,1867],{},[107,1834,1835,1838,1841,1844,1847],{},[128,1836,1837],{},"Gated short convolution (kernel 7)",[128,1839,1840],{},"13",[128,1842,1843],{},"7 tokens",[128,1845,1846],{},"No",[128,1848,1849],{},"Local patterns: syntax, word order",[107,1851,1852,1855,1858,1861,1864],{},[128,1853,1854],{},"Sliding-window attention (window 256)",[128,1856,1857],{},"5",[128,1859,1860],{},"The last 256",[128,1862,1863],{},"Only 256 tokens",[128,1865,1866],{},"Paragraph-level links",[107,1868,1869,1872,1875,1878,1881],{},[128,1870,1871],{},"Global attention",[128,1873,1874],{},"6",[128,1876,1877],{},"The whole context",[128,1879,1880],{},"Yes, growing with context",[128,1882,1883],{},"The rare case where a sentence 10,000 tokens back is the key",[15,1885,1886],{},"Table 1: how the 24 layers are built (Liquid AI launch post)",[15,1888,1889],{},"A convolution has no key\u002Fvalue table, only a fixed-size filter. So those 13 layers write no KV cache at all.",[15,1891,1892],{},"Sliding-window attention does keep KV, but only for the last 256 tokens. It does not grow.",[15,1894,1895],{},"Only those 6 global layers inflate.",[15,1897,1898],{},"As Figure 1 shows, spread the 24 layers out and only the red ones get fatter as the conversation grows.",[1900,1901,1904,1905,1904,1910],"figure",{"className":1902},[1903],"article-figure","\n  ",[326,1906],{"src":1907,"alt":1908,"loading":1909},"\u002Fimages\u002Fblog\u002Fen\u002Flfm3-128k-kv-cache\u002Flayer-stack.svg","Twenty-four stacked layers: 13 gated short convolutions, 5 sliding-window attention layers, 6 global attention layers; only the global ones write a KV cache that grows with context","lazy",[1911,1912,1913],"figcaption",{},"Figure 1: only 6 of the 24 layers are global attention. KV cache grows only in the red layers; the yellow ones keep 256 tokens; the blue ones keep nothing. Layer order is not public; the layers are grouped by type.",[15,1915,1916,1917],{},"Now the part that gets lost: ",[41,1918,1919],{},"this is not a Transformer replacement.",[15,1921,1922,1923,1928,1929,1934],{},"Six of 24 layers are still global attention, a quarter of the stack. The other 13 convolutions plus 5 sliding-window layers just encode the fact that most of the time you do not need full attention. ",[22,1924,1927],{"href":1925,"rel":1926},"https:\u002F\u002Farxiv.org\u002Fabs\u002F2403.19887",[26],"Jamba"," and ",[22,1930,1933],{"href":1931,"rel":1932},"https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.19427",[26],"Griffin"," walked the same road. Hybrids are not new.",[15,1936,1937],{},"Some launch coverage called it a non-Transformer architecture that beat Transformers. Count the layers and you find diluted attention rather than removed.",[15,1939,1940,1941,1142],{},"One small detail is worth a look. Every attention head's output passes through a sigmoid gate, so a head with nothing to add can switch off. Liquid AI says this can help suppress activation outliers, which is exactly what ",[22,1942,1944],{"href":1943},"\u002Fblog\u002Fbroken-on-arrival-quantized-models","quantization hates",[61,1946,1948],{"id":1947},"what-you-get-128k-in-16-gb","What you get: 128K in 1.6 GB",[101,1950,1951,1966],{},[104,1952,1953],{},[107,1954,1955,1957,1960,1963],{},[110,1956,1032],{},[110,1958,1959],{},"Params",[110,1961,1962],{},"KV cache at a full 128K",[110,1964,1965],{},"vs LFM3",[123,1967,1968,1981,1995],{},[107,1969,1970,1973,1976,1979],{},[128,1971,1972],{},"LFM3-1.7B",[128,1974,1975],{},"1.7B",[128,1977,1978],{},"1.6 GB",[128,1980,406],{},[107,1982,1983,1986,1989,1992],{},[128,1984,1985],{},"Qwen3.5-4B",[128,1987,1988],{},"4.7B",[128,1990,1991],{},"4.3 GB",[128,1993,1994],{},"2.7×",[107,1996,1997,2000,2003,2006],{},[128,1998,1999],{},"MiniCPM5-2B",[128,2001,2002],{},"2.5B",[128,2004,2005],{},"5.6 GB",[128,2007,2008],{},"3.5×",[15,2010,2011],{},"Table 2: KV cache at 128K context (official numbers, same measurement)",[15,2013,2014],{},"In relative terms, 1.6 GB is 37% of Qwen3.5-4B and 29% of MiniCPM5-2B.",[15,2016,2017],{},"That is not a small saving. KV cache scales with context, so one measured point at 128K tells you every other length — approximately: the five sliding-window layers keep a fixed 256-token block, which matters more when the context is short.\nWhat it saves is not compression. It is that far less needs storing in the first place.",[15,2019,2020],{},"That shows up on devices. Across phones, a Raspberry Pi 5 and laptops, LFM3-1.7B decodes fastest of the comparison set, 1.8 to 2.8 times faster, with the smallest memory footprint.",[15,2022,2023],{},"Conditions matter: that is llama.cpp, Q4_0, 32K context. Do not mix it with the 128K KV numbers.",[15,2025,2026,2027,2031],{},"Scale matters too. This is not only a text model. One LFM3-1.7B-Base backbone branches into six models around 2B: text, vision, audio, omni, and two decision models that only answer questions. It is the same idea as ",[22,2028,2030],{"href":2029},"\u002Fblog\u002Fshared-trunk-four-modalities","one trunk, four modalities",", at 2B scale.",[15,2033,2034],{},"Pretraining used 22T tokens, with a 128K vocabulary carried over from LFM2.5-8B-A1B, which Liquid AI says tokenizes non-Latin scripts more efficiently. The final 3.5T tokens were mid-training that pushed the window to 256K.",[15,2036,2037,2038,2041],{},"Note the two numbers: the model supports 256K, but 1.6 GB is the ",[41,2039,2040],{},"128K"," KV cache.",[61,2043,2045],{"id":2044},"that-average-is-29-equally-weighted-rows","That average is 29 equally weighted rows",[15,2047,2048],{},"The official table has 29 rows. Average: 49.37 against 47.24.",[15,2050,2051],{},"On its face there is nothing to dispute. But I wanted to know how that average was computed, so I averaged the 29 rows myself.",[15,2053,2054],{},"I got 49.37 and 47.24, exactly as printed.",[15,2056,2057,2058,2061],{},"So it is an ",[41,2059,2060],{},"equal-weight average",": IFBench counts 1\u002F29 and so does SWE-bench, whether or not the task matters to you.",[15,2063,2064],{},"The 29 rows are not 29 distinct tests either: Claw-Eval appears twice, Humanity's Last Exam twice, AA-Omniscience three times. Deduplicated it is 25. That number comes back below.",[15,2066,2067],{},"That is where it gets interesting. Sorted by gap, the widest twelve look like this:",[101,2069,2070,2085],{},[104,2071,2072],{},[107,2073,2074,2077,2079,2082],{},[110,2075,2076],{},"Benchmark",[110,2078,1972],{},[110,2080,2081],{},"Qwen3.5-9B",[110,2083,2084],{},"Gap",[123,2086,2087,2101,2115,2129,2143,2157,2171,2185,2199,2213,2227,2241],{},[107,2088,2089,2092,2095,2098],{},[128,2090,2091],{},"AutomationBench",[128,2093,2094],{},"41.29",[128,2096,2097],{},"15.10",[128,2099,2100],{},"+26.19",[107,2102,2103,2106,2109,2112],{},[128,2104,2105],{},"IFBench",[128,2107,2108],{},"73.03",[128,2110,2111],{},"48.84",[128,2113,2114],{},"+24.19",[107,2116,2117,2120,2123,2126],{},[128,2118,2119],{},"LiveClaw",[128,2121,2122],{},"45.60",[128,2124,2125],{},"35.77",[128,2127,2128],{},"+9.83",[107,2130,2131,2134,2137,2140],{},[128,2132,2133],{},"WebArena-Verified",[128,2135,2136],{},"38.42",[128,2138,2139],{},"28.94",[128,2141,2142],{},"+9.48",[107,2144,2145,2148,2151,2154],{},[128,2146,2147],{},"BFCL V4 (tool calling)",[128,2149,2150],{},"71.39",[128,2152,2153],{},"62.83",[128,2155,2156],{},"+8.56",[107,2158,2159,2162,2165,2168],{},[128,2160,2161],{},"IFEval",[128,2163,2164],{},"96.66",[128,2166,2167],{},"92.08",[128,2169,2170],{},"+4.58",[107,2172,2173,2176,2179,2182],{},[128,2174,2175],{},"RULER 128K",[128,2177,2178],{},"65.56",[128,2180,2181],{},"87.11",[128,2183,2184],{},"−21.55",[107,2186,2187,2190,2193,2196],{},[128,2188,2189],{},"GPQA Diamond",[128,2191,2192],{},"63.37",[128,2194,2195],{},"80.40",[128,2197,2198],{},"−17.03",[107,2200,2201,2204,2207,2210],{},[128,2202,2203],{},"SWE-bench Multilingual",[128,2205,2206],{},"23.00",[128,2208,2209],{},"35.00",[128,2211,2212],{},"−12.00",[107,2214,2215,2218,2221,2224],{},[128,2216,2217],{},"MCP-Atlas",[128,2219,2220],{},"32.57",[128,2222,2223],{},"42.67",[128,2225,2226],{},"−10.10",[107,2228,2229,2232,2235,2238],{},[128,2230,2231],{},"Humanity's Last Exam",[128,2233,2234],{},"7.17",[128,2236,2237],{},"16.41",[128,2239,2240],{},"−9.24",[107,2242,2243,2246,2249,2252],{},[128,2244,2245],{},"SWE-bench Verified",[128,2247,2248],{},"43.40",[128,2250,2251],{},"51.20",[128,2253,2254],{},"−7.80",[15,2256,2257],{},"Table 3: twelve wide gaps out of the 29 rows (six wins, six losses). This is my pick, not the top twelve by size — see the note below.",[15,2259,2260],{},"The top six are \"follow the format\", \"call the tool correctly\", \"click through the page\". The bottom six are \"how much do you know\", \"how long do you remember\", \"can you actually change the code\".",[15,2262,2263],{},"This table is my pick, not the whole story. The two widest gaps are not on it: AA-Omniscience non-hallucination at +40.3 (92.93 against 52.59) and its raw score at +28.5. Both sit in the knowledge block.",[15,2265,2266],{},"Neither measures stored knowledge. They measure calibration. \"Say you do not know when you do not know\" is behavior shaped by post-training; answering GPQA is not. That row is a big win, and what it measures is discipline, not erudition.",[15,2268,2269],{},"Slice it a few other ways and it gets clearer still:",[101,2271,2272,2286],{},[104,2273,2274],{},[107,2275,2276,2279,2282,2284],{},[110,2277,2278],{},"Slice",[110,2280,2281],{},"Rows",[110,2283,1972],{},[110,2285,2081],{},[123,2287,2288,2302,2316,2330,2344,2358],{},[107,2289,2290,2293,2296,2299],{},[128,2291,2292],{},"Official average",[128,2294,2295],{},"29",[128,2297,2298],{},"49.37",[128,2300,2301],{},"47.24",[107,2303,2304,2307,2310,2313],{},[128,2305,2306],{},"Behavior (agents 7 + tools 4 + instruction 4)",[128,2308,2309],{},"15",[128,2311,2312],{},"61.03",[128,2314,2315],{},"55.25",[107,2317,2318,2321,2324,2327],{},[128,2319,2320],{},"Everything else, 14 rows (coding 6 + knowledge 6 + long context 2)",[128,2322,2323],{},"14",[128,2325,2326],{},"36.88",[128,2328,2329],{},"38.66",[107,2331,2332,2335,2338,2341],{},[128,2333,2334],{},"of which agentic coding",[128,2336,2337],{},"3",[128,2339,2340],{},"26.44",[128,2342,2343],{},"34.73",[107,2345,2346,2349,2352,2355],{},[128,2347,2348],{},"of which long context",[128,2350,2351],{},"2",[128,2353,2354],{},"59.20",[128,2356,2357],{},"74.56",[107,2359,2360,2363,2366,2368],{},[128,2361,2362],{},"Without the three AA-Omniscience rows",[128,2364,2365],{},"26",[128,2367,2251],{},[128,2369,2370],{},"51.24",[15,2372,2373],{},"Table 4: the same report card, several ways (row one is the printed official average; the rest is my arithmetic on the official numbers)",[15,2375,2376],{},"Behavior is 15 rows, more than half the weight. LFM3 wins 11 of them.",[15,2378,2379],{},"The last row is the one I would look at. AA-Omniscience appears three times in that table: raw score (0.50 against −28.00), accuracy (7.07 against 13.17) and non-hallucination rate (92.93 against 52.59). One exam, three facets, three votes.",[15,2381,2382],{},"Together those three rows contribute +62.7 points of gap; the whole margin is +61.7. Drop all three and the remaining 26 rows come out 51.20 to 51.24, the gap going from +2.13 to −0.04.",[15,2384,2385],{},"Drop only one of them and the story flips back: the lead stays somewhere between +0.8 and +2.4. So \"three rows carry the entire margin\" is only true when all three leave together, and that should be said out loud.",[15,2387,2388],{},"The sharper objection is not triple counting but sign. −28.00 is an index that can go negative, not a percentage. Averaged with percentages, that single row moves Qwen's mean by nearly a full point on its own.",[15,2390,2391],{},"I am not saying the math is wrong. That is what an equal-weight average does: swap one benchmark in or out and the conclusion moves. And whether those three rows were chosen by Liquid AI or reported that way by the benchmark house, I cannot tell from the table.",[15,2393,2394,2395],{},"The point is smaller and more useful: ",[41,2396,2397],{},"an average is a design decision, not a conclusion.",[15,2399,2400],{},"And it is not a clean sweep. Tool calling looks like the strength, yet MCP-Atlas loses by 10.1. Agentic coding loses all three rows, SWE-bench Multilingual by 12.",[15,2402,2403],{},"Liquid AI says it plainly themselves: \"Larger models still win on agentic coding and knowledge, where size matters most.\"",[61,2405,2407],{"id":2406},"behavior-can-be-taught-knowledge-cannot","Behavior can be taught. Knowledge cannot.",[15,2409,2410],{},"Why does the report card look like that? The training explains it.",[101,2412,2413,2426],{},[104,2414,2415],{},[107,2416,2417,2420,2423],{},[110,2418,2419],{},"Stage",[110,2421,2422],{},"Scale",[110,2424,2425],{},"What it does",[123,2427,2428,2439,2450,2461,2472],{},[107,2429,2430,2433,2436],{},[128,2431,2432],{},"Pretraining",[128,2434,2435],{},"22T tokens",[128,2437,2438],{},"General knowledge; the final 3.5T is mid-training that extends context to 256K",[107,2440,2441,2444,2447],{},[128,2442,2443],{},"SFT",[128,2445,2446],{},"1.75T tokens",[128,2448,2449],{},"Chat, reasoning, tool calls, agent traces",[107,2451,2452,2455,2458],{},[128,2453,2454],{},"Mixed RL",[128,2456,2457],{},"Many domains at once",[128,2459,2460],{},"Math, code, SQL, structured output, with a length penalty in the reward",[107,2462,2463,2466,2469],{},[128,2464,2465],{},"MOPD distillation",[128,2467,2468],{},"6 specialist teachers",[128,2470,2471],{},"Code, math, tool use, long context, agentic work, enterprise workflows, distilled back into one model",[107,2473,2474,2477,2480],{},[128,2475,2476],{},"Agentic RL",[128,2478,2479],{},"Real harnesses",[128,2481,2482],{},"Web browsing through office work, run inside real agent environments",[15,2484,2485],{},"Table 5: the post-training stages Liquid AI published (first row is pretraining)",[15,2487,2488],{},"\"Answer in IFBench's format\" is behavior. Behavior can be demonstrated, rewarded, distilled from a teacher. That is what 1.75T tokens of SFT buys.",[15,2490,2491],{},"\"Answer GPQA correctly\" needs knowledge. The way I read it, knowledge comes from pretraining, and knowledge density is tied to parameter count. 22T tokens is a lot; it still cannot fill a 1.7B model.",[15,2493,2494],{},"The report card is coherent. It overtakes on the behavior axis and stops where a 2B model stops on the knowledge axis.",[15,2496,2497],{},"Long context is the same knot in another place. What it saves is memory, not comprehension. RULER 128K is 65.56 against 87.11. Fitting something into the window and using it are two different things.",[15,2499,2500],{},"Liquid AI offers an interesting direction: with search, Humanity's Last Exam goes from 7.17 to 13.90, nearly double. The gap to Qwen3.5-9B narrows from −9.2 to −3.6.",[15,2502,2503],{},"Narrower, not closed. Tools cover part of a knowledge gap; they do not cover all of it.",[15,2505,2506,2507],{},"For anyone choosing a model, this raises a practical question: ",[41,2508,2509],{},"is your task a behavior task or a knowledge task?",[15,2511,2512],{},"Fill a fixed form, order the tool calls correctly, click through five steps: behavior. A 1.7B model is worth trying.",[15,2514,2515],{},"Answer what the third parameter of an API defaults to, read 50 pages of contract and find the contradiction: knowledge. A 2B model will answer smoothly and be wrong, and you will find out one afternoon too late.",[61,2517,2519],{"id":2518},"liquid-is-a-2020-story","\"Liquid\" is a 2020 story",[15,2521,2522],{},"The name comes from Liquid Neural Networks. It has a real origin, and it has come loose from the architecture.",[15,2524,2525,2526,2531],{},"In June 2020, a paper called ",[22,2527,2530],{"href":2528,"rel":2529},"https:\u002F\u002Farxiv.org\u002Fabs\u002F2006.04439",[26],"Liquid Time-constant Networks"," appeared; AAAI published it in 2021. The authors are Ramin Hasani, Mathias Lechner, Alexander Amini, Daniela Rus and Radu Grosu — five of them. In 2023 several of that group spun out of MIT CSAIL to found Liquid AI. The name is lineage, not marketing.",[15,2533,2534,2535,1142],{},"Now look at how Liquid AI describes the architecture. LFM2, they write, showed that a hybrid of short convolutions and attention could run fast on-device, and that design came from ",[41,2536,2537],{},"automated hardware-in-the-loop architecture search",[15,2539,2540],{},"LFM3 just widened the search. LFM2 searched over one phone and one laptop; LFM3 searches over 14 device and backend combinations, from a Galaxy S26 Ultra and a OnePlus 15 through a Raspberry Pi 5, Apple M4 Max, AMD Ryzen AI, Arm and x86 cloud CPUs, GPUs, and the Qualcomm Hexagon NPU.",[15,2542,2543,2544],{},"The accurate sentence is: ",[41,2545,2546],{},"the name comes from history, the architecture comes from search.",[15,2548,2549],{},"This is not bait and switch. Companies keep their research lineage in the name all the time. But if you clicked because of \"liquid neural network\", know that the mechanism is not in there.",[61,2551,2553],{"id":2552},"so-who-is-it-for","So who is it for",[15,2555,2556],{},"Three kinds of people, three answers.",[15,2558,2559,2562],{},[41,2560,2561],{},"If you run an agent on a device",", this is one of the most interesting options at this size. A 128K context in 1.6 GB, BFCL 71.39 for tool calling, 1.8 to 2.8 times faster decoding, and six models sharing one backbone so you load only the modality you need.",[15,2564,2565,2568],{},[41,2566,2567],{},"If you have one narrow task",", this may be the most practical idea in the post. Liquid AI's demo used the vision model — LFM3-VL-2B, not the text model above — finding and classifying defects in drone photos of wind turbine blades:",[76,2570,2571,2574,2577],{},[79,2572,2573],{},"About 3,000 public photos (WTBs2025), SFT plus GRPO, a few hours on one A100",[79,2575,2576],{},"Measured on about 1,400 held-out photos: 67% classification accuracy, detection F1 from 0.003 to 0.11",[79,2578,2579],{},"Against a zero-shot GPT-6 Luna at 0.01",[15,2581,2582,2583],{},"With one number that is easy to skip: ",[41,2584,2585],{},"out of the box, both models identified fewer than 10% of those images.",[15,2587,2588],{},"So 0.003 to 0.11 is \"from nearly unusable to marginally usable\", not \"from good to better\". And it is Liquid AI's own experiment, not an independent replication.",[15,2590,2591,2594],{},[41,2592,2593],{},"If you want a general knowledge assistant",", it is not the tool. HLE 7.17, GPQA 63.37, RULER 65.56. Those are the ceiling.",[15,2596,2597],{},"A few things to keep in mind:",[76,2599,2600,2606,2612,2618,2624],{},[79,2601,2602,2605],{},[41,2603,2604],{},"The comparison set is Liquid AI's own pick."," No third-party replication, no independent rerun",[79,2607,2608,2611],{},[41,2609,2610],{},"The average is equal-weight."," The benchmark you care about may be 1\u002F29 of it",[79,2613,2614,2617],{},[41,2615,2616],{},"It saves memory, not long-context ability."," RULER 65.56 against 87.11",[79,2619,2620,2623],{},[41,2621,2622],{},"Open weights are not a free license."," It is the LFM Open License v1.0; read it before commercial use",[79,2625,2626,2629],{},[41,2627,2628],{},"All six models branch from one base."," Switching modality is switching weights, not architectures",[61,2631,2633],{"id":2632},"three-things-you-can-do-tomorrow","Three things you can do tomorrow",[755,2635,2636,2642,2648],{},[79,2637,2638,2641],{},[41,2639,2640],{},"Next time you see a benchmark average, count the rows."," The official table has 29, and the average is equal-weight. Recomputing it takes five minutes and tells you which rows carry it. That is worth more than reading ten reviews.",[79,2643,2644,2647],{},[41,2645,2646],{},"Compute your own KV bill."," Multiply six things: tokens × layers that keep KV × KV heads × head dimension × 2 (K and V) × bytes per element. All six are in the model config. If you only need 8K of context, 1.6 GB is not your number; scaled down it is about 100 MB.",[79,2649,2650,2653],{},[41,2651,2652],{},"If your task is narrow, fine-tune a 2B model once."," One A100, a few hours, a few thousand photos. That is the scale that is available now. It will not be general, but it might be enough.",[15,2655,2656,2657,2660],{},"If what you actually want is a large model on your own machine, we have written about the other lever: ",[22,2658,2659],{"href":277},"quantizing a 122B model one layer at a time",". There you shrink the model instead of the window.",[15,2662,2663],{},"Scale did not disappear. It moved, from the GPU you can buy to the task you can shape.",{"title":827,"searchDepth":828,"depth":828,"links":2665},[2666,2667,2668,2669,2670,2671,2672,2673],{"id":1780,"depth":828,"text":1781},{"id":1805,"depth":828,"text":1806},{"id":1947,"depth":828,"text":1948},{"id":2044,"depth":828,"text":2045},{"id":2406,"depth":828,"text":2407},{"id":2518,"depth":828,"text":2519},{"id":2552,"depth":828,"text":2553},{"id":2632,"depth":828,"text":2633},"\u002Fimages\u002Fblog\u002Fen\u002Flfm3-128k-kv-cache.svg","Cover for the English essay, 128K of Context, 1.6 GB of KV Cache","2026-11-22","LFM3-1.7B keeps a 128K context in 1.6 GB of KV cache, 37% of Qwen3.5-4B: only 6 of 24 layers are global attention. It averages 49.37 against a 9B model, but wins on behavior, not agentic coding.",{},"\u002Fimages\u002Fblog\u002Fen\u002Flfm3-128k-kv-cache.jpg","\u002Fblog\u002Fen\u002Flfm3-128k-kv-cache",{"title":1738,"description":2677},"lfm3-128k-kv-cache","blog\u002Fen\u002Flfm3-128k-kv-cache",[853,2685,2686,2687],"kv-cache","model-design","evaluation","6CtDPXOGZkUfPMZECZOhUeZYaJwSo9AJwFDQVTLuDkA",{"id":2690,"title":2691,"author":7,"body":2692,"cover":3536,"coverAlt":3537,"date":3538,"description":3539,"draft":842,"extension":843,"featured":842,"lang":1631,"meta":3540,"navigation":846,"ogImage":3541,"path":3542,"seo":3543,"slug":3544,"stem":3545,"tags":3546,"translationKey":3544,"updated":857,"__hash__":3549},"blog\u002Fblog\u002Fen\u002Fmacaq-one-layer-at-a-time.md","Quantize a 122B Model, One Layer at a Time",{"type":9,"value":2693,"toc":3526},[2694,2711,2715,2718,2721,2727,2730,2733,2736,2739,2743,2746,2749,2752,2755,2758,2761,2764,2767,2770,2773,2853,2856,2859,2863,2866,2869,2872,2875,2878,2884,2954,2957,2969,2976,2979,2982,2985,2989,2992,2995,2998,3001,3008,3015,3059,3062,3065,3069,3072,3075,3078,3081,3084,3087,3090,3193,3196,3199,3202,3205,3215,3218,3222,3225,3228,3231,3237,3274,3277,3280,3356,3359,3378,3385,3388,3413,3420,3427,3431,3438,3441,3489,3492,3496,3519,3522],[12,2695,2696],{},[15,2697,2698,2699,2704,2705,2710],{},"Sources. The ",[22,2700,2703],{"href":2701,"rel":2702},"https:\u002F\u002Farxiv.org\u002Fabs\u002F2611.10649",[26],"paper"," (arXiv 2611.10649, v1 Nov 7 2026, v2 Nov 11 2026; Huawei Cloud & AI Lab) supplies the 122B run, the Llama-3-8B ladder in its appendix and the limitations. The ",[22,2706,2709],{"href":2707,"rel":2708},"https:\u002F\u002Fgithub.com\u002Fhuawei-csl\u002FMACaQ",[26],"repository README"," (Apache 2.0) supplies the vLLM numbers, the MACaQ-R comparison and the command. We did not rerun anything; where a claim is ours, it says so.",[61,2712,2714],{"id":2713},"the-model-does-not-fit","The model does not fit",[15,2716,2717],{},"A 122B model, quantized in 64 minutes, peaking at 32.5 GB of GPU memory, on a single-GPU machine. That matters even if you never touch a 122B model: the same layout is what lets MACaQ-R improve a GGUF you already downloaded.",[15,2719,2720],{},"Before this, you first needed a machine that could hold 244 GB.",[15,2722,2723,2726],{},[1756,2724,2725],{},"Qwen3.5-122B-A10B"," weighs 244 GB in FP16. That is 2.5× a 96 GB card. Two cards hold 192 GB, so it does not fit. Three hold 288 GB, with 44 GB to spare.",[15,2728,2729],{},"Quantization sounds like making a model smaller. But quantization is an operation that needs the model first. Rotations, calibration, Hessians: each one costs memory. Hessians here mean \"how far does the output move if this weight nudges.\"",[15,2731,2732],{},"So the wall for large-model quantization is rarely arithmetic throughput. It is the simple fact that you have to hold the thing.",[15,2734,2735],{},"MACaQ reverses the order. Only one layer has to be on the GPU at a time. Everything else waits in host memory.",[15,2737,2738],{},"Four things below: why the old layout hits the memory wall, what the rotation costs once it moves, how the flips buy quality back, and how to improve the GGUF you already have.",[61,2740,2742],{"id":2741},"quantizing-122b-means-holding-122b","Quantizing 122B means holding 122B",[15,2744,2745],{},"Start with why quantization needs a rotation at all.",[15,2747,2748],{},"Every weight matrix and activation has a few large values. Squeezing to 4 bits, one outlier stretches the shared block scale. Everything else collapses onto the same grid point.",[15,2750,2751],{},"(The 4 bits here are MXFP4: a 4-bit float where 32 values share one power-of-two scale.)",[15,2753,2754],{},"The fix is to rotate the data first. A rotation does not change what the matrix product means, but it spreads the outliers out. Every coordinate looks closer to a bell curve, and the grid starts to cover it.",[15,2756,2757],{},"The question is when the rotation happens.",[15,2759,2760],{},"QuaRot, SpinQuant and DuQuant++ are one family. They fuse the rotation into the neighbouring layer's weights. At inference there is almost nothing extra to do, because the rotation is now part of the weight. That is the elegant part.",[15,2762,2763],{},"The bill arrives at quantization time. The rotation travels across layers, so you need to know how the model is wired: where the attention output projection sits, where the residual comes back in. Different architecture, different fusion.",[15,2765,2766],{},"And once layers depend on each other, you cannot quantize one at a time.",[15,2768,2769],{},"Whether you pay at quantization time or at inference is the real fork in this field.",[15,2771,2772],{},"Table 1: where each method keeps the rotation",[101,2774,2775,2794],{},[104,2776,2777],{},[107,2778,2779,2782,2785,2788,2791],{},[110,2780,2781],{},"Method",[110,2783,2784],{},"Rotation lives",[110,2786,2787],{},"Cross-layer at quant time",[110,2789,2790],{},"One layer at a time",[110,2792,2793],{},"Inference cost",[123,2795,2796,2811,2825,2838],{},[107,2797,2798,2801,2804,2806,2808],{},[128,2799,2800],{},"QuaRot",[128,2802,2803],{},"fused into the next layer's weights",[128,2805,1007],{},[128,2807,969],{},[128,2809,2810],{},"almost nothing extra",[107,2812,2813,2816,2819,2821,2823],{},[128,2814,2815],{},"SpinQuant",[128,2817,2818],{},"fused, with learned rotations",[128,2820,1007],{},[128,2822,969],{},[128,2824,2810],{},[107,2826,2827,2830,2832,2834,2836],{},[128,2828,2829],{},"DuQuant++",[128,2831,2803],{},[128,2833,1007],{},[128,2835,969],{},[128,2837,2810],{},[107,2839,2840,2843,2846,2848,2850],{},[128,2841,2842],{},"MACaQ",[128,2844,2845],{},"online, at inference",[128,2847,969],{},[128,2849,1007],{},[128,2851,2852],{},"+2.3%",[15,2854,2855],{},"Table 1 is a conceptual map, not the paper's benchmark list. This essay compares against DuQuant++ and MR-GPTQ only; the paper also benchmarks QuaRot and FlatQuant.",[15,2857,2858],{},"The map says one thing: the rotation itself is not smarter, it just runs at a different time. The quality comes later, from the flips.",[61,2860,2862],{"id":2861},"moving-the-rotation-to-inference-time","Moving the rotation to inference time",[15,2864,2865],{},"MACaQ takes the other branch. The rotation stays out of the weights and runs at inference.",[15,2867,2868],{},"Each layer's incoming activations get a per-channel scale, then a block-Hadamard transform. Hadamard is a fast, invertible linear map whose job is to flatten outliers.",[15,2870,2871],{},"The inverse is absorbed into the weights at quantization time. The arithmetic is equivalent. The same multiply just moves from the quantizer to the runtime.",[15,2873,2874],{},"The interesting consequence is not the saving, it is who depends on whom. With the rotation online, a layer needs only its own weights and its own activation statistics. Nothing points backwards.",[15,2876,2877],{},"So quantization can stream: load a layer onto the GPU, quantize it, write it out, free it, load the next. The paper calls this streaming with lazy loading, and puts it in one sentence; the remaining weights stay in host memory, and only the layer being processed has to sit on the GPU.",[15,2879,2880,2881,2883],{},"Table 2: the ",[1756,2882,2725],{}," run",[101,2885,2886,2896],{},[104,2887,2888],{},[107,2889,2890,2893],{},[110,2891,2892],{},"Item",[110,2894,2895],{},"Value",[123,2897,2898,2906,2914,2922,2930,2938,2946],{},[107,2899,2900,2903],{},[128,2901,2902],{},"Parameters",[128,2904,2905],{},"122B (mixture-of-experts; about 10B active per token)",[107,2907,2908,2911],{},[128,2909,2910],{},"FP16 weights",[128,2912,2913],{},"about 244 GB",[107,2915,2916,2919],{},[128,2917,2918],{},"Machine",[128,2920,2921],{},"one 96 GB GPU (the paper lists 504 TFLOPS FP16 and 1.79 TB\u002Fs, not a model name)",[107,2923,2924,2927],{},[128,2925,2926],{},"Peak GPU memory while quantizing",[128,2928,2929],{},"32.5 GB",[107,2931,2932,2935],{},[128,2933,2934],{},"Quantization time",[128,2936,2937],{},"64 minutes (32 flips, 512K calibration tokens)",[107,2939,2940,2943],{},[128,2941,2942],{},"WikiText-2 perplexity",[128,2944,2945],{},"5.14 (FP16 is 5.06)",[107,2947,2948,2951],{},[128,2949,2950],{},"Footprint of the result",[128,2952,2953],{},"74 GB; runs on the same card",[15,2955,2956],{},"Figure 1, left: the rotation travels with the layers, so quantizing two of them couples them. Right: the rotation stays online, so one layer is on the GPU at a time.",[1900,2958,1904,2960,1904,2966],{"className":2959},[1903],[2961,2962],"video",{"src":2963,"poster":2964,"autoPlay":846,"loop":846,"muted":846,"playsInline":846,"ariaLabel":2965},"\u002Fimages\u002Fblog\u002Fen\u002Fmacaq-one-layer-at-a-time\u002Fstreaming.mp4","\u002Fimages\u002Fblog\u002Fen\u002Fmacaq-one-layer-at-a-time\u002Fstreaming-poster.jpg","Left: the rotation propagates across layers and couples them during quantization. Right: each layer stands alone, one layer on the GPU at a time.",[1911,2967,2968],{},"Figure 1: on the left the transform travels with the layers, so quantization has to look across them; on the right it stays at inference and each layer goes in and out on its own. The 32.5 GB badge is the 122B number from Table 2, not a general bound.",[15,2970,2971,2972,2975],{},"The number people misread is 32.5 GB. That is ",[41,2973,2974],{},"device memory"," at its peak, not the whole footprint. The 244 GB of FP16 weights is still in host memory; it is just never resident on the GPU at once.",[15,2977,2978],{},"So the real requirement is a big enough card plus a big enough host. Not \"32.5 GB is enough.\" Almost every repost drops that half.",[15,2980,2981],{},"No architecture changes, either. The repo lists FLUX.2 Klein 4B for images, Wan2.2 for video and stable-audio for audio. The paper itself demonstrates one image model and describes the method as applying \"without architecture-specific modifications.\"",[15,2983,2984],{},"If you keep a zoo of models, that portability matters more than the 64 minutes.",[61,2986,2988],{"id":2987},"the-bill-23","The bill: 2.3%",[15,2990,2991],{},"The online transform is not free. Against pure MXFP4, MACaQ adds 2.3% end-to-end on Qwen3-32B in vLLM. The paper never measures the 122B run; that is a 32B number.",[15,2993,2994],{},"The paper's Figure 3 breaks it down: the cost is measured on decode, batch 1, context 512. It shrinks as models grow, because bigger matrices take longer and a few extra multiplies weigh less.",[15,2996,2997],{},"I think what that 2.3% buys is \"you do not have to understand the architecture.\" That is the hinge of the design.",[15,2999,3000],{},"The other number that gets mangled is in Table 3: W4A4 (4-bit weights, 4-bit activations) on Qwen3.8-27B in vLLM, a serving engine. MACaQ runs at 2.33× prefill and 2.58× decode.",[15,3002,3003,3004,3007],{},"Those are throughput ratios ",[41,3005,3006],{},"against BF16",", not against pure MXFP4. The two denominators answer different questions; mixing them wrecks the paragraph.",[15,3009,3010,3011,3014],{},"Table 3: ",[1756,3012,3013],{},"Qwen3.8-27B"," in vLLM (README; BF16 = 1.00×)",[101,3016,3017,3031],{},[104,3018,3019],{},[107,3020,3021,3023,3026,3028],{},[110,3022,1038],{},[110,3024,3025],{},"Perplexity ↓ (README; dataset unstated)",[110,3027,555],{},[110,3029,3030],{},"decode",[123,3032,3033,3045],{},[107,3034,3035,3037,3040,3043],{},[128,3036,230],{},[128,3038,3039],{},"2.8463",[128,3041,3042],{},"1.00×",[128,3044,3042],{},[107,3046,3047,3050,3053,3056],{},[128,3048,3049],{},"MACaQ W4A4",[128,3051,3052],{},"2.8994",[128,3054,3055],{},"2.33×",[128,3057,3058],{},"2.58×",[15,3060,3061],{},"Perplexity goes from 2.8463 to 2.8994, a 1.9% increase. That is not lossless; it is lossy and cheap, which is a different claim.",[15,3063,3064],{},"Table 3 comes from the README and is a different experiment from Table 2. Do not compare across tables.",[61,3066,3068],{"id":3067},"the-rounding-is-the-easy-part","The rounding is the easy part",[15,3070,3071],{},"Four bits give you a small grid. Round-to-nearest (RTN) picks the closest point. It looks only at the weight itself.",[15,3073,3074],{},"MACaQ does one more thing: it flips a code.",[15,3076,3077],{},"A flip moves a single FP4 code to an adjacent representable value. Not a re-quantization, just a different point in the same grid.",[15,3079,3080],{},"Whether to flip is decided by the whole layer's loss. A Hessian approximation asks how far the output moves if this code changes. Then it flips greedily, one code at a time.",[15,3082,3083],{},"Why is that cheap? The only candidates are the neighbour on the left and the neighbour on the right. The search space is tiny. No continuous optimization.",[15,3085,3086],{},"Two knobs control it: how many flips, and how many calibration tokens. Fast means few flips, good means many. Table 4 is the appendix ladder on Llama-3-8B.",[15,3088,3089],{},"Table 4: the trade on Llama-3-8B (MXFP4 W4A4, WikiText-2 perplexity)",[101,3091,3092,3105],{},[104,3093,3094],{},[107,3095,3096,3099,3102],{},[110,3097,3098],{},"Setting",[110,3100,3101],{},"Time",[110,3103,3104],{},"Perplexity ↓",[123,3106,3107,3117,3128,3139,3150,3161,3172,3182],{},[107,3108,3109,3112,3114],{},[128,3110,3111],{},"FP16 (reference)",[128,3113,600],{},[128,3115,3116],{},"6.14",[107,3118,3119,3122,3125],{},[128,3120,3121],{},"RTN only",[128,3123,3124],{},"2.2 s",[128,3126,3127],{},"8.29",[107,3129,3130,3133,3136],{},[128,3131,3132],{},"MACaQ, 0 flips (rotation + exponent screen)",[128,3134,3135],{},"5.5 s",[128,3137,3138],{},"7.64",[107,3140,3141,3144,3147],{},[128,3142,3143],{},"MACaQ, 1 calibration block (2048 tokens)",[128,3145,3146],{},"14.8 s",[128,3148,3149],{},"7.11",[107,3151,3152,3155,3158],{},[128,3153,3154],{},"MACaQ, 128 flips, 31 blocks",[128,3156,3157],{},"88.1 s",[128,3159,3160],{},"6.91",[107,3162,3163,3166,3169],{},[128,3164,3165],{},"MACaQ, 512 flips, 977 blocks",[128,3167,3168],{},"636.9 s",[128,3170,3171],{},"6.85",[107,3173,3174,3177,3180],{},[128,3175,3176],{},"MR-GPTQ, 128 blocks",[128,3178,3179],{},"319.1 s",[128,3181,3149],{},[107,3183,3184,3187,3190],{},[128,3185,3186],{},"DuQuant++ (GPTQ), 128 blocks",[128,3188,3189],{},"624.4 s",[128,3191,3192],{},"7.16",[15,3194,3195],{},"The MACaQ rows are points on one curve with different calibration budgets. The MR-GPTQ and DuQuant++ rows use 128 blocks each. Do not read down the time column and call it a race; those are different budgets. The paper's own fair comparison is 128 flips and about 200K tokens, roughly 150 s on Llama-3-8B, landing at 6.90.",[15,3197,3198],{},"This table is more useful than a headline ratio: you can pick your own row.",[15,3200,3201],{},"The abstract claims MACaQ \"already matches their best perplexity on Llama-3-8B in 11× less quantization time.\" We did not collapse that into a single ratio: Table 4 is a set of single points, the abstract is describing a curve. For a decision, read the table.",[15,3203,3204],{},"Figure 2: rounding picks the nearest point. A flip moves one code to the neighbour, and the layer's loss decides whether that happens.",[1900,3206,1904,3208,1904,3212],{"className":3207},[1903],[326,3209],{"src":3210,"alt":3211,"loading":1909},"\u002Fimages\u002Fblog\u002Fen\u002Fmacaq-one-layer-at-a-time\u002Fflip-grid.svg","Two choices on an FP4 grid: round to nearest picks 1.0, a single flip moves to 1.5, and the layer loss decides",[1911,3213,3214],{},"Figure 2: the only candidates are the neighbours, which makes a flip cheap; the expensive part is deciding, because that needs the layer's loss. Schematic, not measured values.",[15,3216,3217],{},"One thing to say plainly: this is not lossless 4-bit. Even the best setting goes from 6.14 to 6.85, about 12% worse perplexity. RTN is 8.29. Both are lossy. The difference is how much, and whether you will pay the time.",[61,3219,3221],{"id":3220},"fixing-the-gguf-you-already-have","Fixing the GGUF you already have",[15,3223,3224],{},"Everything above is \"quantize a model from scratch.\" Most people are not doing that. They have a folder of downloaded GGUFs.",[15,3226,3227],{},"MACaQ-R is for that case. Take an existing GGUF and its original FP16 file as a teacher, run one refine pass.",[15,3229,3230],{},"The weight codes get rewritten. The native format and block scales stay. So the result still runs on a stock llama.cpp build.",[15,3232,3233,3234,3236],{},"Table 5: ",[1756,3235,224],{}," before and after MACaQ-R (README, single run)",[101,3238,3239,3251],{},[104,3240,3241],{},[107,3242,3243,3245,3248],{},[110,3244,1386],{},[110,3246,3247],{},"GGUF size",[110,3249,3250],{},"KL to FP16 ↓",[123,3252,3253,3264],{},[107,3254,3255,3258,3261],{},[128,3256,3257],{},"Unsloth UD-Q4_K_XL",[128,3259,3260],{},"22.36 GB",[128,3262,3263],{},"0.015731",[107,3265,3266,3269,3271],{},[128,3267,3268],{},"MACaQ-R Q4_K_XL",[128,3270,3260],{},[128,3272,3273],{},"0.013367",[15,3275,3276],{},"KL divergence measures how far two distributions are apart; lower is better. Same size, 0.015731 down to 0.013367, a 15.0% drop. Same file size, same runtime, different code in each slot.",[15,3278,3279],{},"The command is straight from the README:",[3281,3282,3286],"pre",{"className":3283,"code":3284,"language":3285,"meta":827,"style":827},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight",".venv-llamacpp\u002Fbin\u002Fpython llamacpp\u002Fmacaq.py refine \\\n  --model models\u002Fmodel-q4.gguf --hf models\u002Foriginal \\\n  --teacher models\u002Foriginal-f16.gguf --calibration data\u002Fcalibration.txt \\\n  --output models\u002Fmodel-macaq-r.gguf --work-dir work\u002Frefinement\n","bash",[1756,3287,3288,3308,3324,3341],{"__ignoreMap":827},[3289,3290,3293,3297,3301,3304],"span",{"class":3291,"line":3292},"line",1,[3289,3294,3296],{"class":3295},"sBMFI",".venv-llamacpp\u002Fbin\u002Fpython",[3289,3298,3300],{"class":3299},"sfazB"," llamacpp\u002Fmacaq.py",[3289,3302,3303],{"class":3299}," refine",[3289,3305,3307],{"class":3306},"sTEyZ"," \\\n",[3289,3309,3310,3313,3316,3319,3322],{"class":3291,"line":828},[3289,3311,3312],{"class":3299},"  --model",[3289,3314,3315],{"class":3299}," models\u002Fmodel-q4.gguf",[3289,3317,3318],{"class":3299}," --hf",[3289,3320,3321],{"class":3299}," models\u002Foriginal",[3289,3323,3307],{"class":3306},[3289,3325,3327,3330,3333,3336,3339],{"class":3291,"line":3326},3,[3289,3328,3329],{"class":3299},"  --teacher",[3289,3331,3332],{"class":3299}," models\u002Foriginal-f16.gguf",[3289,3334,3335],{"class":3299}," --calibration",[3289,3337,3338],{"class":3299}," data\u002Fcalibration.txt",[3289,3340,3307],{"class":3306},[3289,3342,3344,3347,3350,3353],{"class":3291,"line":3343},4,[3289,3345,3346],{"class":3299},"  --output",[3289,3348,3349],{"class":3299}," models\u002Fmodel-macaq-r.gguf",[3289,3351,3352],{"class":3299}," --work-dir",[3289,3354,3355],{"class":3299}," work\u002Frefinement\n",[15,3357,3358],{},"Then it runs, with nothing to swap in the backend:",[3281,3360,3362],{"className":3283,"code":3361,"language":3285,"meta":827,"style":827},"llama cli -m models\u002Fmodel-macaq-r.gguf\n",[1756,3363,3364],{"__ignoreMap":827},[3289,3365,3366,3369,3372,3375],{"class":3291,"line":3292},[3289,3367,3368],{"class":3295},"llama",[3289,3370,3371],{"class":3299}," cli",[3289,3373,3374],{"class":3299}," -m",[3289,3376,3377],{"class":3299}," models\u002Fmodel-macaq-r.gguf\n",[15,3379,3380,3381,3384],{},"llama.cpp binaries changed names across versions. Older builds use ",[1756,3382,3383],{},"llama-cli","; use whichever you installed.",[15,3386,3387],{},"Simple command, not-simple prerequisites. Three of them, from the README:",[76,3389,3390,3399,3406],{},[79,3391,3392,3395,3396],{},[41,3393,3394],{},"Python 3.12",", and a separate environment per backend. Not just ",[1756,3397,3398],{},"pip install",[79,3400,3401,3402,3405],{},"The ",[41,3403,3404],{},"original FP16 file"," as teacher. If all you have is the GGUF, you stop here",[79,3407,3408,3409,3412],{},"A ",[41,3410,3411],{},"calibration text file"," and the original weights directory",[15,3414,3415,3416,3419],{},"One more limit. Table 5 is a single comparison: one model, one baseline. ",[41,3417,3418],{},"Do not generalize it to \"any GGUF improves by 15%.\""," Yours may improve more, or not at all. Measure KL yourself.",[15,3421,3422,3423,1142],{},"How fast it runs afterwards is a separate topic, decided by bit width and kernel. We covered that in ",[22,3424,3426],{"href":3425},"\u002Fblog\u002Fquantization-kernel-dispatch","Quantization Speed Is Often a Kernel Problem",[61,3428,3430],{"id":3429},"what-this-does-not-prove","What this does not prove",[15,3432,3433,3434,3437],{},"The paper puts the cost in the first line of Limitations. A layer-local design means ",[41,3435,3436],{},"cross-layer error compensation is impossible."," A second pass over cross-layer statistics would likely bring back the slow quantization of the other methods. That is a design trade, not an oversight.",[15,3439,3440],{},"Also worth knowing:",[76,3442,3443,3449,3455,3461,3467,3473,3483],{},[79,3444,3445,3448],{},[41,3446,3447],{},"No third-party replication yet."," First posted Nov 7; the DuQuant++ and MR-GPTQ comparisons were run by the authors",[79,3450,3451,3454],{},[41,3452,3453],{},"W4A4 numbers are concentrated on a few models."," Do not read the +1.9% on Qwen3.8-27B as a general result",[79,3456,3457,3460],{},[41,3458,3459],{},"MoE: expert layers only."," Embeddings and lm-head are skipped in every model, not just MoE",[79,3462,3463,3466],{},[41,3464,3465],{},"The 122B budget differs from the rest."," 32 flips and 512K calibration tokens; the fair comparison used 128 flips and about 200K tokens",[79,3468,3469,3472],{},[41,3470,3471],{},"Qwen3.5 \u002F 3.6 \u002F 3.8 are different generations."," Do not cross-compare",[79,3474,3475,3478,3479,3482],{},[41,3476,3477],{},"Ascend is not plug and play."," Needs CANN and ",[1756,3480,3481],{},"torch_npu","; upstream has kernel PRs only, and full-model execution still needs a serving runtime",[79,3484,3485,3488],{},[41,3486,3487],{},"32.5 GB is device memory, not the whole footprint."," Your host still has to hold 244 GB",[15,3490,3491],{},"And the +2.3% again: it is measured against pure MXFP4. Against BF16 the same method is over 2× faster (Table 3). Same method, different denominator, opposite headline.",[61,3493,3495],{"id":3494},"three-things-to-do-tomorrow","Three things to do tomorrow",[755,3497,3498,3507,3513],{},[79,3499,3500,3503,3504,1142],{},[41,3501,3502],{},"Measure a baseline first."," If you own a GGUF, compute KL against its FP16 original. The README does not give you a KL script; you will have to find one. Without a baseline, \"15% lower\" is somebody else's number. Check the file is not broken first, too: ",[22,3505,3506],{"href":1943},"Your quantized model might be broken",[79,3508,3509,3512],{},[41,3510,3511],{},"Run one refine pass."," If you have the original, run it, then run the same prompt on your usual llama.cpp build and compare outputs. Worst case you lose one refine.",[79,3514,3515,3518],{},[41,3516,3517],{},"Quantizing something 100B-class is a single-GPU job now."," Provided the host can hold the FP16 weights.",[15,3520,3521],{},"The gate moved. It used to be a card. Now it is a machine.",[3523,3524,3525],"style",{},"html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":827,"searchDepth":828,"depth":828,"links":3527},[3528,3529,3530,3531,3532,3533,3534,3535],{"id":2713,"depth":828,"text":2714},{"id":2741,"depth":828,"text":2742},{"id":2861,"depth":828,"text":2862},{"id":2987,"depth":828,"text":2988},{"id":3067,"depth":828,"text":3068},{"id":3220,"depth":828,"text":3221},{"id":3429,"depth":828,"text":3430},{"id":3494,"depth":828,"text":3495},"\u002Fimages\u002Fblog\u002Fen\u002Fmacaq-one-layer-at-a-time.svg","Cover for the English essay, Quantize a 122B Model One Layer at a Time","2026-11-19","MACaQ quantizes a 122B model in 64 minutes on 32.5 GB GPU memory, one layer at a time, rest in host RAM. At 32B the inference cost is 2.3%. MACaQ-R cut KL 15% on a 35B GGUF, given the FP16 original.",{},"\u002Fimages\u002Fblog\u002Fen\u002Fmacaq-one-layer-at-a-time.jpg","\u002Fblog\u002Fen\u002Fmacaq-one-layer-at-a-time",{"title":2691,"description":3539},"macaq-one-layer-at-a-time","blog\u002Fen\u002Fmacaq-one-layer-at-a-time",[3547,853,3548],"quantization","gguf","h1P4p-K3DukBf765f6-nLM5UhLte72EnDfcR2_c1VJ0",1795500241101]