[{"data":1,"prerenderedAt":3454},["ShallowReactive",2],{"post-lfm3-128k-kv-cache":3,"site-info":1840,"related-en-lfm3-128k-kv-cache":1936},{"zh":4,"en":988},{"id":5,"title":6,"author":7,"body":8,"cover":967,"coverAlt":968,"date":969,"description":970,"draft":971,"extension":972,"featured":971,"lang":973,"meta":974,"navigation":975,"ogImage":976,"path":977,"seo":978,"slug":979,"stem":980,"tags":981,"translationKey":979,"updated":986,"__hash__":987},"blog\u002Fblog\u002Fzh-TW\u002Flfm3-128k-kv-cache.md","128K 上下文，1.6 GB 的 KV cache","Jecision",{"type":9,"value":10,"toc":955},"minimark",[11,33,36,39,42,45,48,51,56,59,62,65,68,71,74,77,81,84,164,167,170,173,176,179,195,203,218,221,228,232,294,297,300,303,306,309,312,320,323,330,334,337,340,343,350,353,356,543,546,549,552,555,558,659,662,665,668,671,674,677,680,686,689,692,696,699,771,774,777,780,783,786,789,792,798,801,804,808,811,820,826,829,835,838,842,845,851,857,870,876,879,885,888,920,923,944,952],[12,13,14,18],"blockquote",{},[15,16,17],"p",{},"數字來自 Liquid AI 2026-10-27 的官方部落格與 model card。我們沒有獨立重跑這兩個模型，官方選的對照組也是他們自己挑的。文裡的平均分、百分比、倍數與差值，都是我們拿官方數字自己算的；任何人都能拿同一張表驗算。",[15,19,20,21,28,29],{},"官方原文：",[22,23,27],"a",{"href":24,"rel":25},"https:\u002F\u002Fwww.liquid.ai\u002Fblog\u002Flfm3",[26],"nofollow","Introducing LFM3","｜權重：Hugging Face 的 ",[30,31,32],"code",{},"LiquidAI\u002FLFM3-*",[15,34,35],{},"一個 agent，前面掛著 128K 的 context。整份 repo、一整本操作手冊、一整天的工具輸出。",[15,37,38],{},"它跑在手機上、跑在 Raspberry Pi 5 上、跑在一台沒有獨顯的筆電上。那份 context 的 KV cache 帳單是 1.6 GB，權重另計。",[15,40,41],{},"這篇講三件事：這 1.6 GB 是怎麼換來的、那張成績單怎麼組成一個平均、還有它該被用在哪裡。",[15,43,44],{},"這是 LFM3-1.7B 的數字。同一個模型，官方那張表 29 列的平均是 49.37，贏過 Qwen3.5-9B 的 47.24。",[15,46,47],{},"1.7B 贏 9B，聽起來像架構革命。但把兩件事拆開，畫面會清楚很多。",[15,49,50],{},"它那 24 層裡，還有 6 層是普通的全域注意力。而那個平均分，是 29 列等權加起來的。拆開之後，它贏最多的幾項都在「聽話」這一軸，輸最多的幾項都跟知識與長距離有關。",[52,53,55],"h2",{"id":54},"_128k-的帳單是一份-kv-cache","128K 的帳單，是一份 KV cache",[15,57,58],{},"先講一件大家都同意的事。",[15,60,61],{},"模型每生成一個 token，每個注意力層都要回頭看前面所有 token。重算太貴，所以把算過的中間結果存起來。那份東西叫 KV cache。",[15,63,64],{},"它跟四件事成正比：會寫 KV 的層數、context 長度、KV head 的數量、每個 head 的維度。每一層、每一個 KV head 的每一個 token，都要存 K 和 V 兩個向量。",[15,66,67],{},"所以「支援 128K」在產品頁是一行字，在記憶體裡是 GB 級。",[15,69,70],{},"官方給的對照很直接：同樣跑滿 128K，Qwen3.5-4B 的 KV cache 是 4.3 GB，MiniCPM5-2B 是 5.6 GB。",[15,72,73],{},"這對 agent 特別痛。工具輸出一段就是幾千 token，多輪之後 context 只增不減。而且你希望它一直在背景待著。",[15,75,76],{},"我認為長 context 的真正成本不是 prefill 那一次，是「你必須一直佔著那份記憶體」。手機上沒有這份預算，agent 就只能做短對話。",[52,78,80],{"id":79},"它的做法24-層裡只有-6-層在算全域注意力","它的做法：24 層裡只有 6 層在算全域注意力",[15,82,83],{},"LFM3-1.7B 的 24 層不是同一種層。",[85,86,87,109],"table",{},[88,89,90],"thead",{},[91,92,93,97,100,103,106],"tr",{},[94,95,96],"th",{},"算子",[94,98,99],{},"層數",[94,101,102],{},"看得到多遠",[94,104,105],{},"要存 KV 嗎",[94,107,108],{},"負責什麼",[110,111,112,130,147],"tbody",{},[91,113,114,118,121,124,127],{},[115,116,117],"td",{},"門控短卷積（kernel 7）",[115,119,120],{},"13",[115,122,123],{},"7 個 token",[115,125,126],{},"不用",[115,128,129],{},"局部模式：語法、詞序",[91,131,132,135,138,141,144],{},[115,133,134],{},"滑動視窗注意力（視窗 256）",[115,136,137],{},"5",[115,139,140],{},"最近 256 個",[115,142,143],{},"只存 256 個",[115,145,146],{},"段落內的關聯",[91,148,149,152,155,158,161],{},[115,150,151],{},"全域注意力",[115,153,154],{},"6",[115,156,157],{},"整個 context",[115,159,160],{},"要，而且隨 context 成長",[115,162,163],{},"「一萬個 token 之前那句話才是關鍵」的少數情況",[15,165,166],{},"表 1：LFM3-1.7B 的 24 層是怎麼組成的（官方部落格）",[15,168,169],{},"卷積沒有 key／value 表，它只有固定大小的 filter。所以那 13 層不寫 KV cache。",[15,171,172],{},"滑動視窗注意力有 KV，但只留最近 256 個 token，不隨 context 成長。",[15,174,175],{},"真正會膨脹的只有那 6 層全域注意力。",[15,177,178],{},"如圖 1，把 24 層排開，只有紅色的那幾層會跟著對話變長而變胖。",[180,181,184,185,184,191],"figure",{"className":182},[183],"article-figure","\n  ",[186,187],"img",{"src":188,"alt":189,"loading":190},"\u002Fimages\u002Fblog\u002Flfm3-128k-kv-cache\u002Flayer-stack.svg","24 層堆疊：13 層門控短卷積、5 層滑動視窗注意力、6 層全域注意力，只有紅色的層會寫入隨 context 成長的 KV cache","lazy",[192,193,194],"figcaption",{},"圖 1：24 層裡只有 6 層是全域注意力。KV cache 的成長只發生在紅色的層；黃色的只留 256 個 token，藍色的不存。層序官方沒公布，這張圖是按種類排的。",[15,196,197,198,202],{},"這裡要停下來講清楚一件事：",[199,200,201],"strong",{},"這不是「取代 Transformer」","。",[15,204,205,206,211,212,217],{},"24 層裡有 6 層還是全域注意力，佔四分之一。我的讀法是，另外那 13 層卷積加 5 層 SWA，是把「大部分時候用不到全注意力」這件事寫進架構裡。",[22,207,210],{"href":208,"rel":209},"https:\u002F\u002Farxiv.org\u002Fabs\u002F2403.19887",[26],"Jamba","、",[22,213,216],{"href":214,"rel":215},"https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.19427",[26],"Griffin"," 這些模型也走過同一條路，混合不是新發明。",[15,219,220],{},"不少轉貼把它寫成「非 Transformer 架構超越 Transformer」。把層數數一遍，會發現它只稀釋了注意力，沒有拿掉。",[15,222,223,224,202],{},"還有一個小地方值得看。每一顆注意力頭的輸出都過一個 sigmoid 閘門，讓沒東西可加的頭關掉。官方說這「有助於」壓住激活值的離群點——那個東西正是",[22,225,227],{"href":226},"\u002Fblog\u002Fbroken-on-arrival-quantized-models","量化最怕的",[52,229,231],{"id":230},"換到的是128k-只要-16-gb","換到的是：128K 只要 1.6 GB",[85,233,234,250],{},[88,235,236],{},[91,237,238,241,244,247],{},[94,239,240],{},"模型",[94,242,243],{},"參數",[94,245,246],{},"跑滿 128K 的 KV cache",[94,248,249],{},"相對 LFM3",[110,251,252,266,280],{},[91,253,254,257,260,263],{},[115,255,256],{},"LFM3-1.7B",[115,258,259],{},"1.7B",[115,261,262],{},"1.6 GB",[115,264,265],{},"1×",[91,267,268,271,274,277],{},[115,269,270],{},"Qwen3.5-4B",[115,272,273],{},"4.7B",[115,275,276],{},"4.3 GB",[115,278,279],{},"2.7×",[91,281,282,285,288,291],{},[115,283,284],{},"MiniCPM5-2B",[115,286,287],{},"2.5B",[115,289,290],{},"5.6 GB",[115,292,293],{},"3.5×",[15,295,296],{},"表 2：128K context 的 KV cache（官方數字，同一個測法）",[15,298,299],{},"換算一下：1.6 GB 是 Qwen3.5-4B 的 37%、MiniCPM5-2B 的 29%。",[15,301,302],{},"同樣跑滿 128K，它不是少一點，是差了一個檔次。KV cache 跟 context 大致成正比（近似：那 5 層滑動視窗有固定的 256 個 token，短 context 時佔比會變大），所以你只要知道 128K 這一格，其他長度可以按比例推。",[15,304,305],{},"省下來的不是壓縮率，是「需要存的東西本來就比較少」。",[15,307,308],{},"這個差別在裝置端很明顯。官方在手機、Raspberry Pi 5 與筆電上量，LFM3-1.7B 的解碼速度是對手裡面最快的，快 1.8 到 2.8 倍，而且記憶體用得最少。",[15,310,311],{},"條件要標清楚：那是 llama.cpp、Q4_0 量化、32K context 的數字。不要跟 128K 的 KV 數字混在一起講。",[15,313,314,315,319],{},"還有規模：它不只是一個文字模型。同一個 LFM3-1.7B-Base 骨幹，長出六個約 2B 的模型——文字、視覺、音訊、omni，再加兩個只負責做判斷的決策模型。這跟",[22,316,318],{"href":317},"\u002Fblog\u002Fshared-trunk-four-modalities","一個骨幹四個模態","是同一個思路，只是做在 2B 的尺寸上。",[15,321,322],{},"預訓練用了 22T tokens，詞表 128K、沿用 LFM2.5-8B-A1B，官方說對非拉丁文字的分詞效率比較好。中訓練那 3.5T tokens 把 context window 拉到了 256K。",[15,324,325,326,329],{},"注意這裡有兩個數字：模型支援 256K，但 1.6 GB 是 ",[199,327,328],{},"128K"," 的 KV cache。不要混。",[52,331,333],{"id":332},"但那個平均分是-29-列等權加起來的","但那個平均分，是 29 列等權加起來的",[15,335,336],{},"官方那張表有 29 列，平均 49.37 對 47.24。",[15,338,339],{},"乍看之下沒什麼好爭的。但我想知道那個平均是怎麼算的，所以把 29 列自己平均了一次。",[15,341,342],{},"結果是 49.37 與 47.24，跟官方印的一模一樣。",[15,344,345,346,349],{},"也就是說它是",[199,347,348],{},"等權平均","：IFBench 跟 SWE-bench 各佔 1\u002F29，不管那個任務重不重要。",[15,351,352],{},"29 列也不是 29 個測驗。Claw-Eval 佔兩列、Humanity's Last Exam 佔兩列、AA-Omniscience 佔三列，扣掉重複是 25 個。這個數字後面還會用到。",[15,354,355],{},"那就有意思了。把 29 列按差距排開，最明顯的十二項長這樣：",[85,357,358,373],{},[88,359,360],{},[91,361,362,365,367,370],{},[94,363,364],{},"項目",[94,366,256],{},[94,368,369],{},"Qwen3.5-9B",[94,371,372],{},"差",[110,374,375,389,403,417,431,445,459,473,487,501,515,529],{},[91,376,377,380,383,386],{},[115,378,379],{},"AutomationBench",[115,381,382],{},"41.29",[115,384,385],{},"15.10",[115,387,388],{},"+26.19",[91,390,391,394,397,400],{},[115,392,393],{},"IFBench",[115,395,396],{},"73.03",[115,398,399],{},"48.84",[115,401,402],{},"+24.19",[91,404,405,408,411,414],{},[115,406,407],{},"LiveClaw",[115,409,410],{},"45.60",[115,412,413],{},"35.77",[115,415,416],{},"+9.83",[91,418,419,422,425,428],{},[115,420,421],{},"WebArena-Verified",[115,423,424],{},"38.42",[115,426,427],{},"28.94",[115,429,430],{},"+9.48",[91,432,433,436,439,442],{},[115,434,435],{},"BFCL V4（工具呼叫）",[115,437,438],{},"71.39",[115,440,441],{},"62.83",[115,443,444],{},"+8.56",[91,446,447,450,453,456],{},[115,448,449],{},"IFEval",[115,451,452],{},"96.66",[115,454,455],{},"92.08",[115,457,458],{},"+4.58",[91,460,461,464,467,470],{},[115,462,463],{},"RULER 128K",[115,465,466],{},"65.56",[115,468,469],{},"87.11",[115,471,472],{},"−21.55",[91,474,475,478,481,484],{},[115,476,477],{},"GPQA Diamond",[115,479,480],{},"63.37",[115,482,483],{},"80.40",[115,485,486],{},"−17.03",[91,488,489,492,495,498],{},[115,490,491],{},"SWE-bench Multilingual",[115,493,494],{},"23.00",[115,496,497],{},"35.00",[115,499,500],{},"−12.00",[91,502,503,506,509,512],{},[115,504,505],{},"MCP-Atlas",[115,507,508],{},"32.57",[115,510,511],{},"42.67",[115,513,514],{},"−10.10",[91,516,517,520,523,526],{},[115,518,519],{},"Humanity's Last Exam",[115,521,522],{},"7.17",[115,524,525],{},"16.41",[115,527,528],{},"−9.24",[91,530,531,534,537,540],{},[115,532,533],{},"SWE-bench Verified",[115,535,536],{},"43.40",[115,538,539],{},"51.20",[115,541,542],{},"−7.80",[15,544,545],{},"表 3：29 列裡差距最明顯的十二項（我挑的；前六項是它贏的，後六項是它輸的）",[15,547,548],{},"上面六項是「照格式做」、「把工具呼叫對」、「在網頁上把流程點完」。下面六項是「懂多少」、「記得多久」、「會不會真的改程式」。",[15,550,551],{},"不過這張表是我挑的，不是全部。全表最大的兩個差距反而不在上面：AA-Omniscience 的「不亂講」是 +40.3（92.93 對 52.59），原始分數是 +28.5。它們就落在「知識」那一區。",[15,553,554],{},"但那兩格測的不是知識存量，是校準。「不會的題目就說不會」是後訓練塑形出來的行為，跟 GPQA 上能不能答對是兩件事。這一格它大贏，講的是紀律，不是學問。",[15,556,557],{},"再換幾種切法，看得更清楚：",[85,559,560,574],{},[88,561,562],{},[91,563,564,567,570,572],{},[94,565,566],{},"切法",[94,568,569],{},"列數",[94,571,256],{},[94,573,369],{},[110,575,576,590,604,618,632,646],{},[91,577,578,581,584,587],{},[115,579,580],{},"官方 Average",[115,582,583],{},"29",[115,585,586],{},"49.37",[115,588,589],{},"47.24",[91,591,592,595,598,601],{},[115,593,594],{},"行為類（agent 7 + 工具 4 + 指令遵循 4）",[115,596,597],{},"15",[115,599,600],{},"61.03",[115,602,603],{},"55.25",[91,605,606,609,612,615],{},[115,607,608],{},"其餘 14 列（coding 6 + 知識 6 + 長 context 2）",[115,610,611],{},"14",[115,613,614],{},"36.88",[115,616,617],{},"38.66",[91,619,620,623,626,629],{},[115,621,622],{},"　其中 agentic coding",[115,624,625],{},"3",[115,627,628],{},"26.44",[115,630,631],{},"34.73",[91,633,634,637,640,643],{},[115,635,636],{},"　其中長 context",[115,638,639],{},"2",[115,641,642],{},"59.20",[115,644,645],{},"74.56",[91,647,648,651,654,656],{},[115,649,650],{},"拿掉 AA-Omniscience 的三列",[115,652,653],{},"26",[115,655,539],{},[115,657,658],{},"51.24",[15,660,661],{},"表 4：同一張成績單，幾種切法（除了官方那一列，都是我拿官方數字算的）",[15,663,664],{},"行為類佔了 15 列，超過一半的權重。那 15 列裡它贏 11 列。",[15,666,667],{},"最後一列是我覺得最值得看的一格。AA-Omniscience 那一份考卷在表裡佔了三列：原始分數（0.50 對 −28.00）、準確率（7.07 對 13.17）、不亂講的比例（92.93 對 52.59）。同一份考卷的三個切面，各拿一票。",[15,669,670],{},"三列合起來，替 LFM3 貢獻了 +62.7 的百分點差——整張表的總差距只有 +61.7。全部拿掉，剩下 26 列是 51.20 對 51.24，差距從 +2.13 變成 −0.04。",[15,672,673],{},"不過只拿掉一列，結論就反過來：領先還在 +0.8 到 +2.4 分之間。所以「三列扛起全部差距」只在三列一起拿掉時成立，這點要說清楚。",[15,675,676],{},"真正該挑的也不是重複計列，是符號。−28.00 是一個可以負分的指數，不是百分比；它跟一票百分比放進同一個平均，光這一列就把 Qwen 的平均往下拖了將近一分。",[15,678,679],{},"我沒有要說官方算錯。等權平均就是這樣，隨便換一個 benchmark 進來，結論就會動。而且那三列是官方挑的，還是那家評測自己的報表就長這樣，我從表上分不出來。",[15,681,682,683],{},"我想說的是另一件事：",[199,684,685],{},"平均是一個設計選擇，不是一個結論。",[15,687,688],{},"而且它不是全面贏。工具呼叫看起來是它的強項，但 MCP-Atlas 輸 10.1 分；agentic coding 三項全輸，SWE-bench Multilingual 輸 12 分。",[15,690,691],{},"官方自己寫得很清楚（原文是 \"Larger models still win on agentic coding and knowledge, where size matters most\"）：更大的模型在 agentic coding 與知識上仍然勝出，那是規模最吃重的地方。",[52,693,695],{"id":694},"行為可以教知識不能","行為可以教，知識不能",[15,697,698],{},"為什麼成分會長成這樣？看它怎麼訓練的就懂了。",[85,700,701,714],{},[88,702,703],{},[91,704,705,708,711],{},[94,706,707],{},"階段",[94,709,710],{},"規模",[94,712,713],{},"在做什麼",[110,715,716,727,738,749,760],{},[91,717,718,721,724],{},[115,719,720],{},"預訓練",[115,722,723],{},"22T tokens",[115,725,726],{},"通用知識；最後 3.5T 是中訓練，把 context 拉到 256K",[91,728,729,732,735],{},[115,730,731],{},"SFT",[115,733,734],{},"1.75T tokens",[115,736,737],{},"對話、推理、工具呼叫、agent 軌跡",[91,739,740,743,746],{},[115,741,742],{},"混合 RL",[115,744,745],{},"多領域同時",[115,747,748],{},"數學、程式、SQL、結構化輸出，獎勵裡帶長度懲罰",[91,750,751,754,757],{},[115,752,753],{},"MOPD 蒸餾",[115,755,756],{},"6 個專科老師",[115,758,759],{},"把 code、math、tool、long-context、agentic、enterprise 蒸餾回一個模型",[91,761,762,765,768],{},[115,763,764],{},"Agentic RL",[115,766,767],{},"真的 harness",[115,769,770],{},"從網頁瀏覽到辦公流程，在真的 agent 環境裡跑",[15,772,773],{},"表 5：官方公布的四個後訓練階段（表列五列，第一列是預訓練）",[15,775,776],{},"「照 IFBench 的格式回答」是一種行為。行為可以示範、可以給獎勵、可以從老師那裡蒸餾。1.75T tokens 的 SFT 專門在做這件事。",[15,778,779],{},"「GPQA 上答對」需要的是知識。我的讀法是，知識只能從預訓練來，而知識密度跟參數量綁在一起。22T tokens 已經非常多了，還是填不滿 1.7B 的容量。",[15,781,782],{},"所以那張成績單其實很一致。它在「行為」這一軸超車，在「知識」這一軸停在 2B 該有的位置。",[15,784,785],{},"長 context 也是同一件事的兩面。它省的是記憶體，不是理解力。RULER 128K 只有 65.56，Qwen3.5-9B 是 87.11。塞得進去跟用得起來是兩件事。",[15,787,788],{},"官方還提了一個有趣的方向：加搜尋之後，Humanity's Last Exam 從 7.17 變 13.90，幾乎翻倍。對 Qwen3.5-9B 的差距從 −9.2 縮到 −3.6。",[15,790,791],{},"差距縮小了，但沒有追過。知識的缺口可以用工具補一部分，補不完。",[15,793,794,795],{},"對選型的人來說，這推出一條很實用的問句：",[199,796,797],{},"你那個任務是行為題，還是知識題？",[15,799,800],{},"要它照固定格式填表、把工具呼叫排對、在網頁上點完五步——這是行為題，1.7B 值得試。",[15,802,803],{},"要它回答「這個 API 的第三個參數預設值是什麼」、要它讀完 50 頁合約再挑出矛盾。這是知識題：2B 會讓你在某個下午發現，它講得很順，但錯了。",[52,805,807],{"id":806},"液態是-2020-年的事","「液態」是 2020 年的事",[15,809,810],{},"它的名字來自 Liquid Neural Network。這個名字有來歷，但跟現在的架構已經脫鉤。",[15,812,813,814,819],{},"2020 年 6 月，",[22,815,818],{"href":816,"rel":817},"https:\u002F\u002Farxiv.org\u002Fabs\u002F2006.04439",[26],"Liquid Time-constant Networks"," 的論文上線，2021 年刊在 AAAI。作者是 Ramin Hasani、Mathias Lechner、Alexander Amini、Daniela Rus、Radu Grosu 五個人。2023 年，其中幾位從 MIT CSAIL 出來成立 Liquid AI。所以「液態」是公司血統，不是行銷話術。",[15,821,822,823,202],{},"但看 LFM3 官方怎麼描述架構。他們說 LFM2 證明了「短卷積加注意力的混合」可以在裝置端跑得快，而那個設計",[199,824,825],{},"來自自動化的硬體迴路架構搜尋",[15,827,828],{},"LFM3 只是把搜尋的範圍擴大：LFM2 時是「一支手機加一台筆電」當硬體在環，LFM3 擴到 14 種裝置與後端組合——三星 Galaxy S26 Ultra、OnePlus 15、Raspberry Pi 5、Apple M4 Max、AMD Ryzen AI、Arm 與 x86 雲端 CPU，還有 GPU 與 Qualcomm Hexagon NPU。",[15,830,831,832],{},"所以正確的說法是：",[199,833,834],{},"名字來自歷史，架構來自搜尋。",[15,836,837],{},"不是「掛羊頭賣狗肉」。一家公司保留自己的研究血統當名字，這種事很常見。但如果你是因為「液態神經網路」這五個字點進來，要知道裡面沒有那個機制。",[52,839,841],{"id":840},"所以它適合誰什麼時候不適合","所以它適合誰，什麼時候不適合",[15,843,844],{},"三種人，三種結論。",[15,846,847,850],{},[199,848,849],{},"如果你在裝置端跑 agent","，它是目前這個尺寸裡最值得試的之一。1.6 GB 的 128K context、BFCL 71.39 的工具呼叫、解碼快 1.8 到 2.8 倍，而且六個模型共用同一個骨幹——文字、視覺、音訊可以只載入你要的那一個。",[15,852,853,856],{},[199,854,855],{},"如果你有一個很窄的任務","，它可能是整篇裡最實際的用法。官方的示範是在視覺版的 LFM3-VL-2B 上做的（不是上面那個文字模型），題目是風機葉片瑕疵偵測：",[858,859,860,864,867],"ul",{},[861,862,863],"li",{},"約 3,000 張公開照片（WTBs2025），SFT 加 GRPO，一張 A100 跑幾小時",[861,865,866],{},"在約 1,400 張沒看過的照片上測：分類準確率 67%，偵測 F1 從 0.003 到 0.11",[861,868,869],{},"對照的 GPT-6 Luna 是零樣本（沒有微調），F1 0.01",[15,871,872,873,202],{},"但這裡有一個很容易被略過的數字：",[199,874,875],{},"開箱狀態下，兩個模型只在不到一成的照片上答對",[15,877,878],{},"所以 0.003 到 0.11 是「從幾乎不能用，到勉強可用」，不是「從好到更好」。這是官方自己做的實驗，不是第三方複現。",[15,880,881,884],{},[199,882,883],{},"如果你要的是通用知識助手","，它不適合。HLE 7.17、GPQA 63.37、RULER 65.56，這三項就是天花板。",[15,886,887],{},"還有幾件該知道的事：",[858,889,890,896,902,908,914],{},[861,891,892,895],{},[199,893,894],{},"對照組是 Liquid AI 自己選的。"," 沒有第三方複現，也沒有獨立重跑",[861,897,898,901],{},[199,899,900],{},"那個平均是等權的。"," 你關心的那一項可能只佔 1\u002F29",[861,903,904,907],{},[199,905,906],{},"省的是記憶體，不是長 context 的能力。"," RULER 65.56 對 87.11",[861,909,910,913],{},[199,911,912],{},"開放權重不等於隨便用。"," 授權是 LFM Open License v1.0，商用前自己讀一遍",[861,915,916,919],{},[199,917,918],{},"六個模型都是從同一個 base 分支出去的。"," 想換模態不是換一套架構，是換一組權重",[52,921,922],{"id":922},"明天可以做的三件事",[924,925,926,932,938],"ol",{},[861,927,928,931],{},[199,929,930],{},"下次看到 benchmark 平均，先數列數。"," 官方那張表 29 列，平均是等權的；你能重算一次，就知道那 2.13 分是由哪幾列構成的。這個動作花五分鐘，比讀十篇評測有用。",[861,933,934,937],{},[199,935,936],{},"算一次你自己的 KV 帳單。"," 式子長這樣：token 數 × 會寫 KV 的層數 × KV head 數 × 每個 head 的維度 × 2（K 跟 V 各一份）× 每個元素的 byte 數。這幾個數都在模型的 config 裡。如果你的情境只需要 8K context，那 1.6 GB 對你就沒有意義——按比例大約是 100 MB。",[861,939,940,943],{},[199,941,942],{},"如果你的任務很窄，拿 2B 級模型微調一次。"," 一張 A100、幾小時、幾千張照片，這是現在做得到的規模。效果不會是全能的，但可能剛好夠用。",[15,945,946,947,951],{},"如果你只是想在自己機器上跑大模型，先看",[22,948,950],{"href":949},"\u002Fblog\u002Fstrata-125b-on-12gb","125B 怎麼跑在 12GB 顯卡上","。那是另一條路：不改模型，改誰在什麼時候被載入。",[15,953,954],{},"規模沒有消失，它換了位置。從「你買得到的 GPU」，搬到「你調得動的任務」。",{"title":956,"searchDepth":957,"depth":957,"links":958},"",2,[959,960,961,962,963,964,965,966],{"id":54,"depth":957,"text":55},{"id":79,"depth":957,"text":80},{"id":230,"depth":957,"text":231},{"id":332,"depth":957,"text":333},{"id":694,"depth":957,"text":695},{"id":806,"depth":957,"text":807},{"id":840,"depth":957,"text":841},{"id":922,"depth":957,"text":922},"\u002Fimages\u002Fblog\u002Flfm3-128k-kv-cache.svg","標題「128K 上下文，1.6 GB 的 KV cache」的技術筆記封面","2026-11-22","LFM3-1.7B 支援 256K 上下文，跑滿 128K 只要 1.6 GB 的 KV cache——是 Qwen3.5-4B 的 37%。做法是 24 層裡只留 6 層全域注意力。但官方那張成績單 29 列的平均，我重算過是等權的；拆開來它贏在指令遵循與工具呼叫，輸在知識、長上下文與 agentic coding。",false,"md","zh-TW",{},true,"\u002Fimages\u002Fblog\u002Flfm3-128k-kv-cache.jpg","\u002Fblog\u002Fzh-tw\u002Flfm3-128k-kv-cache",{"title":6,"description":970},"lfm3-128k-kv-cache","blog\u002Fzh-TW\u002Flfm3-128k-kv-cache",[982,983,984,985],"local-llm","kv-cache","model-design","evaluation",null,"hfBq0Y8fXZV3FWUPNsI7QmsNGCCT1p1SKyNmccTxxcs",{"id":989,"title":990,"author":7,"body":991,"cover":1829,"coverAlt":1830,"date":969,"description":1831,"draft":971,"extension":972,"featured":971,"lang":1832,"meta":1833,"navigation":975,"ogImage":1834,"path":1835,"seo":1836,"slug":979,"stem":1837,"tags":1838,"translationKey":979,"updated":986,"__hash__":1839},"blog\u002Fblog\u002Fen\u002Flfm3-128k-kv-cache.md","128K of Context, 1.6 GB of KV Cache",{"type":9,"value":992,"toc":1819},[993,1009,1012,1015,1018,1021,1024,1027,1031,1034,1037,1040,1043,1046,1049,1052,1056,1059,1130,1133,1136,1139,1142,1145,1155,1161,1172,1175,1182,1186,1236,1239,1242,1245,1248,1251,1258,1261,1267,1271,1274,1277,1280,1287,1290,1293,1432,1435,1438,1441,1444,1447,1531,1534,1537,1540,1543,1546,1549,1552,1558,1561,1564,1568,1571,1639,1642,1645,1648,1651,1654,1657,1660,1666,1669,1672,1676,1679,1686,1692,1695,1701,1704,1708,1711,1717,1723,1734,1740,1743,1749,1752,1784,1788,1808,1816],[12,994,995,1003],{},[15,996,997,998,1002],{},"Numbers come from Liquid AI's ",[22,999,1001],{"href":24,"rel":1000},[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,1004,1005,1006,1008],{},"Weights: ",[30,1007,32],{}," on Hugging Face.",[15,1010,1011],{},"An agent holding 128K of context. A whole repository, a whole manual, a full day of tool output.",[15,1013,1014],{},"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,1016,1017],{},"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,1019,1020],{},"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,1022,1023],{},"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,1025,1026],{},"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.",[52,1028,1030],{"id":1029},"what-128k-actually-costs","What 128K actually costs",[15,1032,1033],{},"Start with something nobody disputes.",[15,1035,1036],{},"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,1038,1039],{},"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,1041,1042],{},"So \"supports 128K\" is one line on a product page and a few gigabytes in memory.",[15,1044,1045],{},"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,1047,1048],{},"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,1050,1051],{},"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.",[52,1053,1055],{"id":1054},"its-answer-24-layers-only-6-of-them-full-attention","Its answer: 24 layers, only 6 of them full attention",[15,1057,1058],{},"The 24 layers of LFM3-1.7B are not the same kind of layer.",[85,1060,1061,1080],{},[88,1062,1063],{},[91,1064,1065,1068,1071,1074,1077],{},[94,1066,1067],{},"Operator",[94,1069,1070],{},"Layers",[94,1072,1073],{},"Sees",[94,1075,1076],{},"Stores KV?",[94,1078,1079],{},"Job",[110,1081,1082,1098,1114],{},[91,1083,1084,1087,1089,1092,1095],{},[115,1085,1086],{},"Gated short convolution (kernel 7)",[115,1088,120],{},[115,1090,1091],{},"7 tokens",[115,1093,1094],{},"No",[115,1096,1097],{},"Local patterns: syntax, word order",[91,1099,1100,1103,1105,1108,1111],{},[115,1101,1102],{},"Sliding-window attention (window 256)",[115,1104,137],{},[115,1106,1107],{},"The last 256",[115,1109,1110],{},"Only 256 tokens",[115,1112,1113],{},"Paragraph-level links",[91,1115,1116,1119,1121,1124,1127],{},[115,1117,1118],{},"Global attention",[115,1120,154],{},[115,1122,1123],{},"The whole context",[115,1125,1126],{},"Yes, growing with context",[115,1128,1129],{},"The rare case where a sentence 10,000 tokens back is the key",[15,1131,1132],{},"Table 1: how the 24 layers are built (Liquid AI launch post)",[15,1134,1135],{},"A convolution has no key\u002Fvalue table, only a fixed-size filter. So those 13 layers write no KV cache at all.",[15,1137,1138],{},"Sliding-window attention does keep KV, but only for the last 256 tokens. It does not grow.",[15,1140,1141],{},"Only those 6 global layers inflate.",[15,1143,1144],{},"As Figure 1 shows, spread the 24 layers out and only the red ones get fatter as the conversation grows.",[180,1146,184,1148,184,1152],{"className":1147},[183],[186,1149],{"src":1150,"alt":1151,"loading":190},"\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",[192,1153,1154],{},"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,1156,1157,1158],{},"Now the part that gets lost: ",[199,1159,1160],{},"this is not a Transformer replacement.",[15,1162,1163,1164,1167,1168,1171],{},"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,1165,210],{"href":208,"rel":1166},[26]," and ",[22,1169,216],{"href":214,"rel":1170},[26]," walked the same road. Hybrids are not new.",[15,1173,1174],{},"Some launch coverage called it a non-Transformer architecture that beat Transformers. Count the layers and you find diluted attention rather than removed.",[15,1176,1177,1178,1181],{},"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,1179,1180],{"href":226},"quantization hates",".",[52,1183,1185],{"id":1184},"what-you-get-128k-in-16-gb","What you get: 128K in 1.6 GB",[85,1187,1188,1204],{},[88,1189,1190],{},[91,1191,1192,1195,1198,1201],{},[94,1193,1194],{},"Model",[94,1196,1197],{},"Params",[94,1199,1200],{},"KV cache at a full 128K",[94,1202,1203],{},"vs LFM3",[110,1205,1206,1216,1226],{},[91,1207,1208,1210,1212,1214],{},[115,1209,256],{},[115,1211,259],{},[115,1213,262],{},[115,1215,265],{},[91,1217,1218,1220,1222,1224],{},[115,1219,270],{},[115,1221,273],{},[115,1223,276],{},[115,1225,279],{},[91,1227,1228,1230,1232,1234],{},[115,1229,284],{},[115,1231,287],{},[115,1233,290],{},[115,1235,293],{},[15,1237,1238],{},"Table 2: KV cache at 128K context (official numbers, same measurement)",[15,1240,1241],{},"In relative terms, 1.6 GB is 37% of Qwen3.5-4B and 29% of MiniCPM5-2B.",[15,1243,1244],{},"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,1246,1247],{},"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,1249,1250],{},"Conditions matter: that is llama.cpp, Q4_0, 32K context. Do not mix it with the 128K KV numbers.",[15,1252,1253,1254,1257],{},"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,1255,1256],{"href":317},"one trunk, four modalities",", at 2B scale.",[15,1259,1260],{},"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,1262,1263,1264,1266],{},"Note the two numbers: the model supports 256K, but 1.6 GB is the ",[199,1265,328],{}," KV cache.",[52,1268,1270],{"id":1269},"that-average-is-29-equally-weighted-rows","That average is 29 equally weighted rows",[15,1272,1273],{},"The official table has 29 rows. Average: 49.37 against 47.24.",[15,1275,1276],{},"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,1278,1279],{},"I got 49.37 and 47.24, exactly as printed.",[15,1281,1282,1283,1286],{},"So it is an ",[199,1284,1285],{},"equal-weight average",": IFBench counts 1\u002F29 and so does SWE-bench, whether or not the task matters to you.",[15,1288,1289],{},"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,1291,1292],{},"That is where it gets interesting. Sorted by gap, the widest twelve look like this:",[85,1294,1295,1309],{},[88,1296,1297],{},[91,1298,1299,1302,1304,1306],{},[94,1300,1301],{},"Benchmark",[94,1303,256],{},[94,1305,369],{},[94,1307,1308],{},"Gap",[110,1310,1311,1321,1331,1341,1351,1362,1372,1382,1392,1402,1412,1422],{},[91,1312,1313,1315,1317,1319],{},[115,1314,379],{},[115,1316,382],{},[115,1318,385],{},[115,1320,388],{},[91,1322,1323,1325,1327,1329],{},[115,1324,393],{},[115,1326,396],{},[115,1328,399],{},[115,1330,402],{},[91,1332,1333,1335,1337,1339],{},[115,1334,407],{},[115,1336,410],{},[115,1338,413],{},[115,1340,416],{},[91,1342,1343,1345,1347,1349],{},[115,1344,421],{},[115,1346,424],{},[115,1348,427],{},[115,1350,430],{},[91,1352,1353,1356,1358,1360],{},[115,1354,1355],{},"BFCL V4 (tool calling)",[115,1357,438],{},[115,1359,441],{},[115,1361,444],{},[91,1363,1364,1366,1368,1370],{},[115,1365,449],{},[115,1367,452],{},[115,1369,455],{},[115,1371,458],{},[91,1373,1374,1376,1378,1380],{},[115,1375,463],{},[115,1377,466],{},[115,1379,469],{},[115,1381,472],{},[91,1383,1384,1386,1388,1390],{},[115,1385,477],{},[115,1387,480],{},[115,1389,483],{},[115,1391,486],{},[91,1393,1394,1396,1398,1400],{},[115,1395,491],{},[115,1397,494],{},[115,1399,497],{},[115,1401,500],{},[91,1403,1404,1406,1408,1410],{},[115,1405,505],{},[115,1407,508],{},[115,1409,511],{},[115,1411,514],{},[91,1413,1414,1416,1418,1420],{},[115,1415,519],{},[115,1417,522],{},[115,1419,525],{},[115,1421,528],{},[91,1423,1424,1426,1428,1430],{},[115,1425,533],{},[115,1427,536],{},[115,1429,539],{},[115,1431,542],{},[15,1433,1434],{},"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,1436,1437],{},"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,1439,1440],{},"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,1442,1443],{},"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,1445,1446],{},"Slice it a few other ways and it gets clearer still:",[85,1448,1449,1463],{},[88,1450,1451],{},[91,1452,1453,1456,1459,1461],{},[94,1454,1455],{},"Slice",[94,1457,1458],{},"Rows",[94,1460,256],{},[94,1462,369],{},[110,1464,1465,1476,1487,1498,1509,1520],{},[91,1466,1467,1470,1472,1474],{},[115,1468,1469],{},"Official average",[115,1471,583],{},[115,1473,586],{},[115,1475,589],{},[91,1477,1478,1481,1483,1485],{},[115,1479,1480],{},"Behavior (agents 7 + tools 4 + instruction 4)",[115,1482,597],{},[115,1484,600],{},[115,1486,603],{},[91,1488,1489,1492,1494,1496],{},[115,1490,1491],{},"Everything else, 14 rows (coding 6 + knowledge 6 + long context 2)",[115,1493,611],{},[115,1495,614],{},[115,1497,617],{},[91,1499,1500,1503,1505,1507],{},[115,1501,1502],{},"of which agentic coding",[115,1504,625],{},[115,1506,628],{},[115,1508,631],{},[91,1510,1511,1514,1516,1518],{},[115,1512,1513],{},"of which long context",[115,1515,639],{},[115,1517,642],{},[115,1519,645],{},[91,1521,1522,1525,1527,1529],{},[115,1523,1524],{},"Without the three AA-Omniscience rows",[115,1526,653],{},[115,1528,539],{},[115,1530,658],{},[15,1532,1533],{},"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,1535,1536],{},"Behavior is 15 rows, more than half the weight. LFM3 wins 11 of them.",[15,1538,1539],{},"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,1541,1542],{},"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,1544,1545],{},"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,1547,1548],{},"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,1550,1551],{},"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,1553,1554,1555],{},"The point is smaller and more useful: ",[199,1556,1557],{},"an average is a design decision, not a conclusion.",[15,1559,1560],{},"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,1562,1563],{},"Liquid AI says it plainly themselves: \"Larger models still win on agentic coding and knowledge, where size matters most.\"",[52,1565,1567],{"id":1566},"behavior-can-be-taught-knowledge-cannot","Behavior can be taught. Knowledge cannot.",[15,1569,1570],{},"Why does the report card look like that? The training explains it.",[85,1572,1573,1586],{},[88,1574,1575],{},[91,1576,1577,1580,1583],{},[94,1578,1579],{},"Stage",[94,1581,1582],{},"Scale",[94,1584,1585],{},"What it does",[110,1587,1588,1598,1607,1618,1629],{},[91,1589,1590,1593,1595],{},[115,1591,1592],{},"Pretraining",[115,1594,723],{},[115,1596,1597],{},"General knowledge; the final 3.5T is mid-training that extends context to 256K",[91,1599,1600,1602,1604],{},[115,1601,731],{},[115,1603,734],{},[115,1605,1606],{},"Chat, reasoning, tool calls, agent traces",[91,1608,1609,1612,1615],{},[115,1610,1611],{},"Mixed RL",[115,1613,1614],{},"Many domains at once",[115,1616,1617],{},"Math, code, SQL, structured output, with a length penalty in the reward",[91,1619,1620,1623,1626],{},[115,1621,1622],{},"MOPD distillation",[115,1624,1625],{},"6 specialist teachers",[115,1627,1628],{},"Code, math, tool use, long context, agentic work, enterprise workflows, distilled back into one model",[91,1630,1631,1633,1636],{},[115,1632,764],{},[115,1634,1635],{},"Real harnesses",[115,1637,1638],{},"Web browsing through office work, run inside real agent environments",[15,1640,1641],{},"Table 5: the post-training stages Liquid AI published (first row is pretraining)",[15,1643,1644],{},"\"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,1646,1647],{},"\"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,1649,1650],{},"The report card is coherent. It overtakes on the behavior axis and stops where a 2B model stops on the knowledge axis.",[15,1652,1653],{},"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,1655,1656],{},"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,1658,1659],{},"Narrower, not closed. Tools cover part of a knowledge gap; they do not cover all of it.",[15,1661,1662,1663],{},"For anyone choosing a model, this raises a practical question: ",[199,1664,1665],{},"is your task a behavior task or a knowledge task?",[15,1667,1668],{},"Fill a fixed form, order the tool calls correctly, click through five steps: behavior. A 1.7B model is worth trying.",[15,1670,1671],{},"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.",[52,1673,1675],{"id":1674},"liquid-is-a-2020-story","\"Liquid\" is a 2020 story",[15,1677,1678],{},"The name comes from Liquid Neural Networks. It has a real origin, and it has come loose from the architecture.",[15,1680,1681,1682,1685],{},"In June 2020, a paper called ",[22,1683,818],{"href":816,"rel":1684},[26]," 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,1687,1688,1689,1181],{},"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 ",[199,1690,1691],{},"automated hardware-in-the-loop architecture search",[15,1693,1694],{},"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,1696,1697,1698],{},"The accurate sentence is: ",[199,1699,1700],{},"the name comes from history, the architecture comes from search.",[15,1702,1703],{},"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.",[52,1705,1707],{"id":1706},"so-who-is-it-for","So who is it for",[15,1709,1710],{},"Three kinds of people, three answers.",[15,1712,1713,1716],{},[199,1714,1715],{},"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,1718,1719,1722],{},[199,1720,1721],{},"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:",[858,1724,1725,1728,1731],{},[861,1726,1727],{},"About 3,000 public photos (WTBs2025), SFT plus GRPO, a few hours on one A100",[861,1729,1730],{},"Measured on about 1,400 held-out photos: 67% classification accuracy, detection F1 from 0.003 to 0.11",[861,1732,1733],{},"Against a zero-shot GPT-6 Luna at 0.01",[15,1735,1736,1737],{},"With one number that is easy to skip: ",[199,1738,1739],{},"out of the box, both models identified fewer than 10% of those images.",[15,1741,1742],{},"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,1744,1745,1748],{},[199,1746,1747],{},"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,1750,1751],{},"A few things to keep in mind:",[858,1753,1754,1760,1766,1772,1778],{},[861,1755,1756,1759],{},[199,1757,1758],{},"The comparison set is Liquid AI's own pick."," No third-party replication, no independent rerun",[861,1761,1762,1765],{},[199,1763,1764],{},"The average is equal-weight."," The benchmark you care about may be 1\u002F29 of it",[861,1767,1768,1771],{},[199,1769,1770],{},"It saves memory, not long-context ability."," RULER 65.56 against 87.11",[861,1773,1774,1777],{},[199,1775,1776],{},"Open weights are not a free license."," It is the LFM Open License v1.0; read it before commercial use",[861,1779,1780,1783],{},[199,1781,1782],{},"All six models branch from one base."," Switching modality is switching weights, not architectures",[52,1785,1787],{"id":1786},"three-things-you-can-do-tomorrow","Three things you can do tomorrow",[924,1789,1790,1796,1802],{},[861,1791,1792,1795],{},[199,1793,1794],{},"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.",[861,1797,1798,1801],{},[199,1799,1800],{},"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.",[861,1803,1804,1807],{},[199,1805,1806],{},"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,1809,1810,1811,1815],{},"If what you actually want is a large model on your own machine, we have written about the other lever: ",[22,1812,1814],{"href":1813},"\u002Fblog\u002Fmacaq-one-layer-at-a-time","quantizing a 122B model one layer at a time",". There you shrink the model instead of the window.",[15,1817,1818],{},"Scale did not disappear. It moved, from the GPU you can buy to the task you can shape.",{"title":956,"searchDepth":957,"depth":957,"links":1820},[1821,1822,1823,1824,1825,1826,1827,1828],{"id":1029,"depth":957,"text":1030},{"id":1054,"depth":957,"text":1055},{"id":1184,"depth":957,"text":1185},{"id":1269,"depth":957,"text":1270},{"id":1566,"depth":957,"text":1567},{"id":1674,"depth":957,"text":1675},{"id":1706,"depth":957,"text":1707},{"id":1786,"depth":957,"text":1787},"\u002Fimages\u002Fblog\u002Fen\u002Flfm3-128k-kv-cache.svg","Cover for the English essay, 128K of Context, 1.6 GB of KV Cache","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.","en",{},"\u002Fimages\u002Fblog\u002Fen\u002Flfm3-128k-kv-cache.jpg","\u002Fblog\u002Fen\u002Flfm3-128k-kv-cache",{"title":990,"description":1831},"blog\u002Fen\u002Flfm3-128k-kv-cache",[982,983,984,985],"6CtDPXOGZkUfPMZECZOhUeZYaJwSo9AJwFDQVTLuDkA",{"id":1841,"company":1842,"extension":1853,"meta":1854,"services":1855,"social":1933,"stem":1934,"__hash__":1935},"site\u002Fsite.yml",{"name":1843,"nameEn":1844,"email":1845,"address":1846,"addressEn":1847,"lineUrl":1848,"lineId":1849,"duns":1850,"youtube":1851,"youtubeId":1852},"銡策數位有限公司","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",{},[1856,1880,1906],{"key":1857,"zh":1858,"en":1869},"audit",{"title":1859,"tagline":1860,"summary":1861,"points":1862,"deliverable":1866,"detail":1867,"duration":1868},"企業 AI 導入健檢","先看清楚，再花錢","60 分鐘線上訪談，盤點最耗時、最依賴人力的營運環節；我們會告訴你哪些工作現在就能交給 AI、哪些還不成熟。",[1863,1864,1865],"現況盤點：梳理日常營運中最耗時、最依賴人力的環節","痛點診斷：判斷哪些工作現在就能交給 AI，哪些建議先保留人力","可行性評估：依你的業務特性與預算，篩選適合的模型與工具","《企業 AI 導入建議報告書》（PDF）","含 1–2 個「開發成本最低、成效最明顯」的優先項目、技術棧建議、預期節省的人力時間與下一步","訪談 60 分鐘，報告書 3 個工作天內交付",{"title":1870,"tagline":1871,"summary":1872,"points":1873,"deliverable":1877,"detail":1878,"duration":1879},"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.",[1874,1875,1876],"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":1881,"zh":1882,"en":1893},"prompt",{"title":1883,"tagline":1884,"summary":1885,"points":1886,"deliverable":1890,"detail":1891,"duration":1892},"提示詞工程","讓 AI 穩定產出，而不是碰運氣","針對你的實際任務設計提示詞與多步驟工作流，並做極限測試，確保換了資料、換了人操作也不會走鐘。",[1887,1888,1889],"客製提示詞：ChatGPT、Claude、Gemini、Midjourney 等主流工具的專屬模板","除錯與優化：修掉幻覺、格式跑掉、時好時壞的問題","工作流建置：把複雜任務拆成多步驟提示詞與可重複的 SOP","提示詞文件或設定檔","附使用說明與範例，並提供 1 對 1 教學，確保你與團隊能自己維護","依任務複雜度報價，通常 3–7 個工作天",{"title":1894,"tagline":1895,"summary":1896,"points":1897,"deliverable":1903,"detail":1904,"duration":1905},"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.",[1898,1899,1901],"Custom prompts for ChatGPT, Claude, Gemini, Midjourney and friends",{"Debugging and tuning":1900},"kill hallucinations, broken formats and flaky output",{"Workflow design":1902},"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":1907,"zh":1908,"en":1919},"poc",{"title":1909,"tagline":1910,"summary":1911,"points":1912,"deliverable":1916,"detail":1917,"duration":1918},"極速 PoC","五天，看到能跑的東西","不談架構藍圖，直接做一個能動的雛形。五個工作天內交付線上可操作的智能體，用你真實的資料驗證。",[1913,1914,1915],"Day 1：15 分鐘對焦，鎖定單一痛點與資料盤點","Day 2–4：模型串接、邏輯設計與雛形開發","Day 5：Demo 展示與 AI 擴展建議書","可線上操作的智能體雛形","交付範圍為概念驗證與展示，不含後續維運或大規模伺服器部署；要進階成完整系統會另行報價","5 個工作天",{"title":1920,"tagline":1921,"summary":1922,"points":1923,"deliverable":1930,"detail":1931,"duration":1932},"Rapid PoC","Five days to something that runs","No architecture decks — a working prototype built in five business days, validated against your real data.",[1924,1926,1928],{"Day 1":1925},"15-minute scoping call, one pain point, data inventory",{"Day 2–4":1927},"model integration, logic design, prototype build",{"Day 5":1929},"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",[1937,2806],{"id":1938,"title":1939,"author":7,"body":1940,"cover":2792,"coverAlt":2793,"date":2794,"description":2795,"draft":971,"extension":972,"featured":971,"lang":1832,"meta":2796,"navigation":975,"ogImage":2797,"path":2798,"seo":2799,"slug":2800,"stem":2801,"tags":2802,"translationKey":2800,"updated":986,"__hash__":2805},"blog\u002Fblog\u002Fen\u002Fmacaq-one-layer-at-a-time.md","Quantize a 122B Model, One Layer at a Time",{"type":9,"value":1941,"toc":2782},[1942,1959,1963,1966,1969,1975,1978,1981,1984,1987,1991,1994,1997,2000,2003,2006,2009,2012,2015,2018,2021,2103,2106,2109,2113,2116,2119,2122,2125,2128,2134,2204,2207,2219,2226,2229,2232,2235,2239,2242,2245,2248,2251,2258,2265,2312,2315,2318,2322,2325,2328,2331,2334,2337,2340,2343,2447,2450,2453,2456,2459,2469,2472,2476,2479,2482,2485,2492,2530,2533,2536,2612,2615,2634,2641,2644,2669,2676,2683,2687,2694,2697,2745,2748,2752,2775,2778],[12,1943,1944],{},[15,1945,1946,1947,1952,1953,1958],{},"Sources. The ",[22,1948,1951],{"href":1949,"rel":1950},"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,1954,1957],{"href":1955,"rel":1956},"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.",[52,1960,1962],{"id":1961},"the-model-does-not-fit","The model does not fit",[15,1964,1965],{},"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,1967,1968],{},"Before this, you first needed a machine that could hold 244 GB.",[15,1970,1971,1974],{},[30,1972,1973],{},"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,1976,1977],{},"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,1979,1980],{},"So the wall for large-model quantization is rarely arithmetic throughput. It is the simple fact that you have to hold the thing.",[15,1982,1983],{},"MACaQ reverses the order. Only one layer has to be on the GPU at a time. Everything else waits in host memory.",[15,1985,1986],{},"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.",[52,1988,1990],{"id":1989},"quantizing-122b-means-holding-122b","Quantizing 122B means holding 122B",[15,1992,1993],{},"Start with why quantization needs a rotation at all.",[15,1995,1996],{},"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,1998,1999],{},"(The 4 bits here are MXFP4: a 4-bit float where 32 values share one power-of-two scale.)",[15,2001,2002],{},"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,2004,2005],{},"The question is when the rotation happens.",[15,2007,2008],{},"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,2010,2011],{},"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,2013,2014],{},"And once layers depend on each other, you cannot quantize one at a time.",[15,2016,2017],{},"Whether you pay at quantization time or at inference is the real fork in this field.",[15,2019,2020],{},"Table 1: where each method keeps the rotation",[85,2022,2023,2042],{},[88,2024,2025],{},[91,2026,2027,2030,2033,2036,2039],{},[94,2028,2029],{},"Method",[94,2031,2032],{},"Rotation lives",[94,2034,2035],{},"Cross-layer at quant time",[94,2037,2038],{},"One layer at a time",[94,2040,2041],{},"Inference cost",[110,2043,2044,2061,2075,2088],{},[91,2045,2046,2049,2052,2055,2058],{},[115,2047,2048],{},"QuaRot",[115,2050,2051],{},"fused into the next layer's weights",[115,2053,2054],{},"yes",[115,2056,2057],{},"no",[115,2059,2060],{},"almost nothing extra",[91,2062,2063,2066,2069,2071,2073],{},[115,2064,2065],{},"SpinQuant",[115,2067,2068],{},"fused, with learned rotations",[115,2070,2054],{},[115,2072,2057],{},[115,2074,2060],{},[91,2076,2077,2080,2082,2084,2086],{},[115,2078,2079],{},"DuQuant++",[115,2081,2051],{},[115,2083,2054],{},[115,2085,2057],{},[115,2087,2060],{},[91,2089,2090,2093,2096,2098,2100],{},[115,2091,2092],{},"MACaQ",[115,2094,2095],{},"online, at inference",[115,2097,2057],{},[115,2099,2054],{},[115,2101,2102],{},"+2.3%",[15,2104,2105],{},"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,2107,2108],{},"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.",[52,2110,2112],{"id":2111},"moving-the-rotation-to-inference-time","Moving the rotation to inference time",[15,2114,2115],{},"MACaQ takes the other branch. The rotation stays out of the weights and runs at inference.",[15,2117,2118],{},"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,2120,2121],{},"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,2123,2124],{},"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,2126,2127],{},"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,2129,2130,2131,2133],{},"Table 2: the ",[30,2132,1973],{}," run",[85,2135,2136,2146],{},[88,2137,2138],{},[91,2139,2140,2143],{},[94,2141,2142],{},"Item",[94,2144,2145],{},"Value",[110,2147,2148,2156,2164,2172,2180,2188,2196],{},[91,2149,2150,2153],{},[115,2151,2152],{},"Parameters",[115,2154,2155],{},"122B (mixture-of-experts; about 10B active per token)",[91,2157,2158,2161],{},[115,2159,2160],{},"FP16 weights",[115,2162,2163],{},"about 244 GB",[91,2165,2166,2169],{},[115,2167,2168],{},"Machine",[115,2170,2171],{},"one 96 GB GPU (the paper lists 504 TFLOPS FP16 and 1.79 TB\u002Fs, not a model name)",[91,2173,2174,2177],{},[115,2175,2176],{},"Peak GPU memory while quantizing",[115,2178,2179],{},"32.5 GB",[91,2181,2182,2185],{},[115,2183,2184],{},"Quantization time",[115,2186,2187],{},"64 minutes (32 flips, 512K calibration tokens)",[91,2189,2190,2193],{},[115,2191,2192],{},"WikiText-2 perplexity",[115,2194,2195],{},"5.14 (FP16 is 5.06)",[91,2197,2198,2201],{},[115,2199,2200],{},"Footprint of the result",[115,2202,2203],{},"74 GB; runs on the same card",[15,2205,2206],{},"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.",[180,2208,184,2210,184,2216],{"className":2209},[183],[2211,2212],"video",{"src":2213,"poster":2214,"autoPlay":975,"loop":975,"muted":975,"playsInline":975,"ariaLabel":2215},"\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.",[192,2217,2218],{},"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,2220,2221,2222,2225],{},"The number people misread is 32.5 GB. That is ",[199,2223,2224],{},"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,2227,2228],{},"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,2230,2231],{},"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,2233,2234],{},"If you keep a zoo of models, that portability matters more than the 64 minutes.",[52,2236,2238],{"id":2237},"the-bill-23","The bill: 2.3%",[15,2240,2241],{},"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,2243,2244],{},"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,2246,2247],{},"I think what that 2.3% buys is \"you do not have to understand the architecture.\" That is the hinge of the design.",[15,2249,2250],{},"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,2252,2253,2254,2257],{},"Those are throughput ratios ",[199,2255,2256],{},"against BF16",", not against pure MXFP4. The two denominators answer different questions; mixing them wrecks the paragraph.",[15,2259,2260,2261,2264],{},"Table 3: ",[30,2262,2263],{},"Qwen3.8-27B"," in vLLM (README; BF16 = 1.00×)",[85,2266,2267,2283],{},[88,2268,2269],{},[91,2270,2271,2274,2277,2280],{},[94,2272,2273],{},"Precision",[94,2275,2276],{},"Perplexity ↓ (README; dataset unstated)",[94,2278,2279],{},"prefill",[94,2281,2282],{},"decode",[110,2284,2285,2298],{},[91,2286,2287,2290,2293,2296],{},[115,2288,2289],{},"BF16",[115,2291,2292],{},"2.8463",[115,2294,2295],{},"1.00×",[115,2297,2295],{},[91,2299,2300,2303,2306,2309],{},[115,2301,2302],{},"MACaQ W4A4",[115,2304,2305],{},"2.8994",[115,2307,2308],{},"2.33×",[115,2310,2311],{},"2.58×",[15,2313,2314],{},"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,2316,2317],{},"Table 3 comes from the README and is a different experiment from Table 2. Do not compare across tables.",[52,2319,2321],{"id":2320},"the-rounding-is-the-easy-part","The rounding is the easy part",[15,2323,2324],{},"Four bits give you a small grid. Round-to-nearest (RTN) picks the closest point. It looks only at the weight itself.",[15,2326,2327],{},"MACaQ does one more thing: it flips a code.",[15,2329,2330],{},"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,2332,2333],{},"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,2335,2336],{},"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,2338,2339],{},"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,2341,2342],{},"Table 4: the trade on Llama-3-8B (MXFP4 W4A4, WikiText-2 perplexity)",[85,2344,2345,2358],{},[88,2346,2347],{},[91,2348,2349,2352,2355],{},[94,2350,2351],{},"Setting",[94,2353,2354],{},"Time",[94,2356,2357],{},"Perplexity ↓",[110,2359,2360,2371,2382,2393,2404,2415,2426,2436],{},[91,2361,2362,2365,2368],{},[115,2363,2364],{},"FP16 (reference)",[115,2366,2367],{},"—",[115,2369,2370],{},"6.14",[91,2372,2373,2376,2379],{},[115,2374,2375],{},"RTN only",[115,2377,2378],{},"2.2 s",[115,2380,2381],{},"8.29",[91,2383,2384,2387,2390],{},[115,2385,2386],{},"MACaQ, 0 flips (rotation + exponent screen)",[115,2388,2389],{},"5.5 s",[115,2391,2392],{},"7.64",[91,2394,2395,2398,2401],{},[115,2396,2397],{},"MACaQ, 1 calibration block (2048 tokens)",[115,2399,2400],{},"14.8 s",[115,2402,2403],{},"7.11",[91,2405,2406,2409,2412],{},[115,2407,2408],{},"MACaQ, 128 flips, 31 blocks",[115,2410,2411],{},"88.1 s",[115,2413,2414],{},"6.91",[91,2416,2417,2420,2423],{},[115,2418,2419],{},"MACaQ, 512 flips, 977 blocks",[115,2421,2422],{},"636.9 s",[115,2424,2425],{},"6.85",[91,2427,2428,2431,2434],{},[115,2429,2430],{},"MR-GPTQ, 128 blocks",[115,2432,2433],{},"319.1 s",[115,2435,2403],{},[91,2437,2438,2441,2444],{},[115,2439,2440],{},"DuQuant++ (GPTQ), 128 blocks",[115,2442,2443],{},"624.4 s",[115,2445,2446],{},"7.16",[15,2448,2449],{},"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,2451,2452],{},"This table is more useful than a headline ratio: you can pick your own row.",[15,2454,2455],{},"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,2457,2458],{},"Figure 2: rounding picks the nearest point. A flip moves one code to the neighbour, and the layer's loss decides whether that happens.",[180,2460,184,2462,184,2466],{"className":2461},[183],[186,2463],{"src":2464,"alt":2465,"loading":190},"\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",[192,2467,2468],{},"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,2470,2471],{},"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.",[52,2473,2475],{"id":2474},"fixing-the-gguf-you-already-have","Fixing the GGUF you already have",[15,2477,2478],{},"Everything above is \"quantize a model from scratch.\" Most people are not doing that. They have a folder of downloaded GGUFs.",[15,2480,2481],{},"MACaQ-R is for that case. Take an existing GGUF and its original FP16 file as a teacher, run one refine pass.",[15,2483,2484],{},"The weight codes get rewritten. The native format and block scales stay. So the result still runs on a stock llama.cpp build.",[15,2486,2487,2488,2491],{},"Table 5: ",[30,2489,2490],{},"Qwen3.6-35B-A3B"," before and after MACaQ-R (README, single run)",[85,2493,2494,2507],{},[88,2495,2496],{},[91,2497,2498,2501,2504],{},[94,2499,2500],{},"Version",[94,2502,2503],{},"GGUF size",[94,2505,2506],{},"KL to FP16 ↓",[110,2508,2509,2520],{},[91,2510,2511,2514,2517],{},[115,2512,2513],{},"Unsloth UD-Q4_K_XL",[115,2515,2516],{},"22.36 GB",[115,2518,2519],{},"0.015731",[91,2521,2522,2525,2527],{},[115,2523,2524],{},"MACaQ-R Q4_K_XL",[115,2526,2516],{},[115,2528,2529],{},"0.013367",[15,2531,2532],{},"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,2534,2535],{},"The command is straight from the README:",[2537,2538,2542],"pre",{"className":2539,"code":2540,"language":2541,"meta":956,"style":956},"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",[30,2543,2544,2564,2580,2597],{"__ignoreMap":956},[2545,2546,2549,2553,2557,2560],"span",{"class":2547,"line":2548},"line",1,[2545,2550,2552],{"class":2551},"sBMFI",".venv-llamacpp\u002Fbin\u002Fpython",[2545,2554,2556],{"class":2555},"sfazB"," llamacpp\u002Fmacaq.py",[2545,2558,2559],{"class":2555}," refine",[2545,2561,2563],{"class":2562},"sTEyZ"," \\\n",[2545,2565,2566,2569,2572,2575,2578],{"class":2547,"line":957},[2545,2567,2568],{"class":2555},"  --model",[2545,2570,2571],{"class":2555}," models\u002Fmodel-q4.gguf",[2545,2573,2574],{"class":2555}," --hf",[2545,2576,2577],{"class":2555}," models\u002Foriginal",[2545,2579,2563],{"class":2562},[2545,2581,2583,2586,2589,2592,2595],{"class":2547,"line":2582},3,[2545,2584,2585],{"class":2555},"  --teacher",[2545,2587,2588],{"class":2555}," models\u002Foriginal-f16.gguf",[2545,2590,2591],{"class":2555}," --calibration",[2545,2593,2594],{"class":2555}," data\u002Fcalibration.txt",[2545,2596,2563],{"class":2562},[2545,2598,2600,2603,2606,2609],{"class":2547,"line":2599},4,[2545,2601,2602],{"class":2555},"  --output",[2545,2604,2605],{"class":2555}," models\u002Fmodel-macaq-r.gguf",[2545,2607,2608],{"class":2555}," --work-dir",[2545,2610,2611],{"class":2555}," work\u002Frefinement\n",[15,2613,2614],{},"Then it runs, with nothing to swap in the backend:",[2537,2616,2618],{"className":2539,"code":2617,"language":2541,"meta":956,"style":956},"llama cli -m models\u002Fmodel-macaq-r.gguf\n",[30,2619,2620],{"__ignoreMap":956},[2545,2621,2622,2625,2628,2631],{"class":2547,"line":2548},[2545,2623,2624],{"class":2551},"llama",[2545,2626,2627],{"class":2555}," cli",[2545,2629,2630],{"class":2555}," -m",[2545,2632,2633],{"class":2555}," models\u002Fmodel-macaq-r.gguf\n",[15,2635,2636,2637,2640],{},"llama.cpp binaries changed names across versions. Older builds use ",[30,2638,2639],{},"llama-cli","; use whichever you installed.",[15,2642,2643],{},"Simple command, not-simple prerequisites. Three of them, from the README:",[858,2645,2646,2655,2662],{},[861,2647,2648,2651,2652],{},[199,2649,2650],{},"Python 3.12",", and a separate environment per backend. Not just ",[30,2653,2654],{},"pip install",[861,2656,2657,2658,2661],{},"The ",[199,2659,2660],{},"original FP16 file"," as teacher. If all you have is the GGUF, you stop here",[861,2663,2664,2665,2668],{},"A ",[199,2666,2667],{},"calibration text file"," and the original weights directory",[15,2670,2671,2672,2675],{},"One more limit. Table 5 is a single comparison: one model, one baseline. ",[199,2673,2674],{},"Do not generalize it to \"any GGUF improves by 15%.\""," Yours may improve more, or not at all. Measure KL yourself.",[15,2677,2678,2679,1181],{},"How fast it runs afterwards is a separate topic, decided by bit width and kernel. We covered that in ",[22,2680,2682],{"href":2681},"\u002Fblog\u002Fquantization-kernel-dispatch","Quantization Speed Is Often a Kernel Problem",[52,2684,2686],{"id":2685},"what-this-does-not-prove","What this does not prove",[15,2688,2689,2690,2693],{},"The paper puts the cost in the first line of Limitations. A layer-local design means ",[199,2691,2692],{},"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,2695,2696],{},"Also worth knowing:",[858,2698,2699,2705,2711,2717,2723,2729,2739],{},[861,2700,2701,2704],{},[199,2702,2703],{},"No third-party replication yet."," First posted Nov 7; the DuQuant++ and MR-GPTQ comparisons were run by the authors",[861,2706,2707,2710],{},[199,2708,2709],{},"W4A4 numbers are concentrated on a few models."," Do not read the +1.9% on Qwen3.8-27B as a general result",[861,2712,2713,2716],{},[199,2714,2715],{},"MoE: expert layers only."," Embeddings and lm-head are skipped in every model, not just MoE",[861,2718,2719,2722],{},[199,2720,2721],{},"The 122B budget differs from the rest."," 32 flips and 512K calibration tokens; the fair comparison used 128 flips and about 200K tokens",[861,2724,2725,2728],{},[199,2726,2727],{},"Qwen3.5 \u002F 3.6 \u002F 3.8 are different generations."," Do not cross-compare",[861,2730,2731,2734,2735,2738],{},[199,2732,2733],{},"Ascend is not plug and play."," Needs CANN and ",[30,2736,2737],{},"torch_npu","; upstream has kernel PRs only, and full-model execution still needs a serving runtime",[861,2740,2741,2744],{},[199,2742,2743],{},"32.5 GB is device memory, not the whole footprint."," Your host still has to hold 244 GB",[15,2746,2747],{},"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.",[52,2749,2751],{"id":2750},"three-things-to-do-tomorrow","Three things to do tomorrow",[924,2753,2754,2763,2769],{},[861,2755,2756,2759,2760,1181],{},[199,2757,2758],{},"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,2761,2762],{"href":226},"Your quantized model might be broken",[861,2764,2765,2768],{},[199,2766,2767],{},"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.",[861,2770,2771,2774],{},[199,2772,2773],{},"Quantizing something 100B-class is a single-GPU job now."," Provided the host can hold the FP16 weights.",[15,2776,2777],{},"The gate moved. It used to be a card. Now it is a machine.",[2779,2780,2781],"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":956,"searchDepth":957,"depth":957,"links":2783},[2784,2785,2786,2787,2788,2789,2790,2791],{"id":1961,"depth":957,"text":1962},{"id":1989,"depth":957,"text":1990},{"id":2111,"depth":957,"text":2112},{"id":2237,"depth":957,"text":2238},{"id":2320,"depth":957,"text":2321},{"id":2474,"depth":957,"text":2475},{"id":2685,"depth":957,"text":2686},{"id":2750,"depth":957,"text":2751},"\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":1939,"description":2795},"macaq-one-layer-at-a-time","blog\u002Fen\u002Fmacaq-one-layer-at-a-time",[2803,982,2804],"quantization","gguf","h1P4p-K3DukBf765f6-nLM5UhLte72EnDfcR2_c1VJ0",{"id":2807,"title":2682,"author":7,"body":2808,"cover":3440,"coverAlt":3441,"date":3442,"description":3443,"draft":971,"extension":972,"featured":971,"lang":1832,"meta":3444,"navigation":975,"ogImage":3445,"path":3446,"seo":3447,"slug":3448,"stem":3449,"tags":3450,"translationKey":3448,"updated":986,"__hash__":3453},"blog\u002Fblog\u002Fen\u002Fquantization-kernel-dispatch.md",{"type":9,"value":2809,"toc":3430},[2810,2815,2819,2822,2825,2828,2831,2835,2838,2841,2844,2847,2850,2853,2856,2861,2864,2875,2879,2882,2885,2946,2949,2952,2955,2958,2964,2970,2976,2979,3075,3078,3081,3084,3088,3091,3094,3097,3167,3170,3173,3176,3179,3182,3185,3189,3192,3195,3243,3246,3249,3252,3255,3259,3262,3268,3274,3280,3286,3347,3349,3369,3373,3376,3379,3393,3396,3404,3412,3415],[12,2811,2812],{},[15,2813,2814],{},"Every number here comes from arXiv 2605.05699v1 (May 7, 2026). The author is Mohamed Amine Bergach at Illumina; this is a single-author preprint, not peer-reviewed. We did not rerun it on an Apple M1. Where I add a judgement, I say so.",[52,2816,2818],{"id":2817},"a-scene","A scene",[15,2820,2821],{},"You are running a 1B model on a laptop; push the context from 256 to 4K and decoding slows as the KV cache (the K\u002FV state kept during decoding) grows with every token. This essay is about two ledgers hidden in the usual advice — \"quantize, but it slows you down\" — and when to keep an fp16 fallback.",[15,2823,2824],{},"The implementation tax: the same algorithm written as four eager dispatches or two fused kernels. The deployment bill: an int4 cache against fp16, end to end, including where it breaks. By the end you should know which number is being compared to what, and four questions to ask of any benchmark that claims quantization is faster.",[15,2826,2827],{},"The paper runs the same int4 KV-cache method both ways. The eager version is 17% slower on a 360M model, measured against SRHT (a sign-randomized Hadamard rotation used as the control). Fuse the four steps into two kernels and SmolLM comes out 1% faster; on a 1.7B model it is 5% faster. Qwen is still 1% slower. End to end against fp16, Gemma-3 1B at a 256-token prefix has 8.2% lower latency.",[15,2829,2830],{},"Then the warning. On Qwen2.5-1.5B at a 2K prefix, the int4 cache emits two tokens and stops. fp16 emits 64.",[52,2832,2834],{"id":2833},"first-the-17","First, the 17%",[15,2836,2837],{},"The method is rotate-then-quantize. Each K and V vector in the KV cache is rotated, compressed to int4 (a 4-bit integer), then dequantized and rotated back when attention reads it.",[15,2839,2840],{},"The rotation here is SRFT (sign-randomized FFT): multiply by a fixed random ±1 pattern, then take an FFT. The point is to spread out outliers. In a K\u002FV vector, a few large values stretch the quantization scale and squash the rest toward zero. Rotate first and the coordinates look close to Gaussian; uniform quantization no longer has to survive a handful of spikes.",[15,2842,2843],{},"The problem is how the four steps are written. The eager version calls rotate, quantize, dequantize and inverse-rotate as four separate PyTorch\u002FMPS operations. Every layer, every decoding step, pays four kernel dispatches.",[15,2845,2846],{},"Dispatch is the queueing and data movement around a GPU kernel launch. The arithmetic may take microseconds; four launches and four round trips through memory can cost more than the arithmetic itself.",[15,2848,2849],{},"The paper's measured tax: 17% higher latency on SmolLM2-360M, 16% on 1.7B, 12% on Qwen2.5-1.5B. The baseline is SRHT (sign-randomized Hadamard transform), another rotation, not fp16.",[15,2851,2852],{},"Why SRHT? Because SRFT and SRHT produce quantization quality within noise of each other; the difference is whether the rotation is an FFT or a Hadamard transform. Using SRHT as the control isolates the cost of the implementation from the cost of the rotation.",[15,2854,2855],{},"The paper puts the mechanism in one line, which I paraphrase:",[12,2857,2858],{},[15,2859,2860],{},"The cost is dispatch, not compute. The underlying rfft and irfft calls take single-digit microseconds, but the four-step pipeline multiplies that overhead.",[15,2862,2863],{},"That is why the same algorithm turns from +17% into −1% — not because quantization improved, but because four launches became two (Figure 1).",[180,2865,184,2867,184,2872],{"className":2866},[183],[2211,2868],{"src":2869,"poster":2870,"autoPlay":975,"loop":975,"muted":975,"playsInline":975,"ariaLabel":2871},"\u002Fimages\u002Fblog\u002Fen\u002Fquantization-kernel-dispatch\u002Fkernel-fusion.mp4","\u002Fimages\u002Fblog\u002Fen\u002Fquantization-kernel-dispatch\u002Fkernel-fusion-poster.jpg","Left: four eager kernel dispatches. Right: two fused kernels, forward and inverse.",[192,2873,2874],{},"Figure 1: The same quantization, eager with four dispatches per layer per step; fused into a forward and an inverse kernel.",[52,2876,2878],{"id":2877},"fusing-four-steps-into-two-kernels-is-not-enough","Fusing four steps into two kernels is not enough",[15,2880,2881],{},"The fusion puts the first two steps and the last two into one Metal kernel each: forward does rotate plus quantize; inverse does dequantize plus inverse-rotate. Data stays in fast on-chip memory instead of round-tripping to device memory.",[15,2883,2884],{},"The same comparison flips for SmolLM, but Qwen stays 1% slower:",[85,2886,2887,2902],{},[88,2888,2889],{},[91,2890,2891,2893,2896,2899],{},[94,2892,1194],{},[94,2894,2895],{},"SRHT baseline",[94,2897,2898],{},"Eager Δ",[94,2900,2901],{},"Fused SRFT (Δ)",[110,2903,2904,2918,2932],{},[91,2905,2906,2909,2912,2915],{},[115,2907,2908],{},"SmolLM2-360M",[115,2910,2911],{},"37.4 ms\u002Ftok",[115,2913,2914],{},"+17%",[115,2916,2917],{},"37.0 ms\u002Ftok (−1%)",[91,2919,2920,2923,2926,2929],{},[115,2921,2922],{},"SmolLM2-1.7B",[115,2924,2925],{},"222.2 ms\u002Ftok",[115,2927,2928],{},"+16%",[115,2930,2931],{},"211.9 ms\u002Ftok (−5%)",[91,2933,2934,2937,2940,2943],{},[115,2935,2936],{},"Qwen2.5-1.5B",[115,2938,2939],{},"84.9 ms\u002Ftok",[115,2941,2942],{},"+12%",[115,2944,2945],{},"85.7 ms\u002Ftok (+1%)",[15,2947,2948],{},"(Δ against SRHT; percentages rounded; 256-token prompt plus 128 generated tokens; Apple M1. Not against fp16.)",[15,2950,2951],{},"Why is the gap larger on 1.7B? The eager penalty is roughly the same (+17% vs +16%). The difference appears after fusion: 1.7B has a 2048-dim KV per layer, 360M only 320, so the fused kernel's fixed launch cost is spread across more work. That is why it moves from −1% to −5%.",[15,2953,2954],{},"At this point the story looks clean: four steps become two kernels, and 17% slower becomes 1% faster (on 360M). But if you stop here and conclude \"quantization is always faster\", you will miss the next section.",[15,2956,2957],{},"The end-to-end −8.2% against fp16 is not fusion alone. It needs three conditions.",[15,2959,2960,2963],{},[199,2961,2962],{},"First, the quantizer."," With a single per-token scale (one scale per token), Qwen's 4-bit ΔPPL explodes to +7975. The author switches to per-channel λ plus per-group abs-max (one scale per channel, one abs-max per 32 values) and pulls the same number down to +638.6. That recipe runs inside the fused kernel.",[15,2965,2966,2969],{},[199,2967,2968],{},"Second, a dequant-prefix cache."," The dequantized prefix is cached between steps instead of recomputed; the last 16 tokens stay in fp16 and the cache is invalidated when that window fills. Without it, Qwen at a 1024-token prefix is 2.4% slower than fp16; with it, it is 1.6% faster. The paper's text says −0.7%; its own ms\u002Ftok, 137.1 → 134.9, implies −1.6%. We use the table's numbers and note the discrepancy.",[15,2971,2972,2975],{},[199,2973,2974],{},"Third, the model architecture."," Gemma-3 1B has sliding-window layers: most layers see a fixed window and stay in fp16; only a few full-attention layers (which see the whole prefix) pay the dequant cost. That is why its advantage survives to 4096 tokens. Qwen has 28 full-attention layers, so the cost grows linearly with prefix length.",[15,2977,2978],{},"Put those three back into the end-to-end table:",[85,2980,2981,2996],{},[88,2982,2983],{},[91,2984,2985,2987,2990,2993],{},[94,2986,1194],{},[94,2988,2989],{},"Prefix",[94,2991,2992],{},"fp16 → int4 (ms\u002Ftok)",[94,2994,2995],{},"Latency Δ",[110,2997,2998,3012,3025,3038,3051,3063],{},[91,2999,3000,3003,3006,3009],{},[115,3001,3002],{},"Gemma-3 1B",[115,3004,3005],{},"256",[115,3007,3008],{},"71.2 → 65.4",[115,3010,3011],{},"−8.2%",[91,3013,3014,3016,3019,3022],{},[115,3015,3002],{},[115,3017,3018],{},"1024",[115,3020,3021],{},"83.3 → 82.5",[115,3023,3024],{},"−0.9%",[91,3026,3027,3029,3032,3035],{},[115,3028,3002],{},[115,3030,3031],{},"2048",[115,3033,3034],{},"129.5 → 121.3",[115,3036,3037],{},"−6.3%",[91,3039,3040,3042,3045,3048],{},[115,3041,3002],{},[115,3043,3044],{},"4096",[115,3046,3047],{},"188.5 → 182.4",[115,3049,3050],{},"−3.2%",[91,3052,3053,3055,3057,3060],{},[115,3054,2936],{},[115,3056,3005],{},[115,3058,3059],{},"90.7 → 88.3",[115,3061,3062],{},"−2.6%",[91,3064,3065,3067,3069,3072],{},[115,3066,2936],{},[115,3068,3018],{},[115,3070,3071],{},"137.1 → 134.9",[115,3073,3074],{},"−1.6%",[15,3076,3077],{},"(Δ against fp16; Apple M1; 256-token prompt plus 128 generated tokens. Qwen at 2048 is not in the table; see the next section. Qwen 1024's −1.6% is the arithmetic from 137.1 → 134.9; the paper's text says −0.7%. We use the table's numbers.)",[15,3079,3080],{},"On memory: Qwen is 3.0–3.1×; Gemma's 19.5× is not a like-for-like comparison (an apples-to-apples comparison inside the full-attention layers is about 3.2×), so do not compare it directly with Qwen.",[15,3082,3083],{},"The −8.2% is the best case, at a 256-token prefix. The same model at 4096 is −3.2%; Qwen at 1024 is −1.6%. \"Quantization is 8% faster\" is not a constant; it is a curve that moves with prefix length.",[52,3085,3087],{"id":3086},"before-you-celebrate-check-the-quality-bill","Before you celebrate, check the quality bill",[15,3089,3090],{},"Speed is one ledger. Quality is the other.",[15,3092,3093],{},"Quantization quality is usually measured as perplexity (PPL). ΔPPL is the change from the fp16 baseline; lower is better.",[15,3095,3096],{},"The 4-bit per-token ΔPPL on Cosmopedia (8192 held-out tokens):",[85,3098,3099,3117],{},[88,3100,3101],{},[91,3102,3103,3105,3108,3111,3114],{},[94,3104,1194],{},[94,3106,3107],{},"FP16 PPL",[94,3109,3110],{},"No rotation (identity)",[94,3112,3113],{},"SRHT",[94,3115,3116],{},"SRFT",[110,3118,3119,3136,3152],{},[91,3120,3121,3124,3127,3130,3133],{},[115,3122,3123],{},"SmolLM2-135M",[115,3125,3126],{},"6.61",[115,3128,3129],{},"+1.96 ± 0.15",[115,3131,3132],{},"+0.34 ± 0.01",[115,3134,3135],{},"+0.38 ± 0.06",[91,3137,3138,3140,3143,3146,3149],{},[115,3139,2908],{},[115,3141,3142],{},"4.87",[115,3144,3145],{},"+0.97 ± 0.08",[115,3147,3148],{},"+0.20 ± 0.03",[115,3150,3151],{},"+0.21 ± 0.02",[91,3153,3154,3156,3159,3162,3165],{},[115,3155,2922],{},[115,3157,3158],{},"3.77",[115,3160,3161],{},"+1.04",[115,3163,3164],{},"+0.16",[115,3166,3164],{},[15,3168,3169],{},"(The first two rows are the mean ± 1σ over three seeds; 1.7B ran one seed because of compute cost. 6-bit and 8-bit are lossless in this test.)",[15,3171,3172],{},"Rotation is not optional. At 135M, no rotation is +1.96; with rotation it is +0.38, roughly a 5× reduction. That is also why \"quantization breaks\" and \"quantization is just slower\" are often two sides of the same problem: if the rotation is wrong, the 4-bit error lands directly in PPL.",[15,3174,3175],{},"6-bit and 8-bit are lossless; 4-bit is the trade-off. 3-bit is worse in absolute terms; the paper does not sell 3-bit, and I would not start there.",[15,3177,3178],{},"Qwen's 4-bit is a different story. The Python reference's per-token ΔPPL is +7975.3; the Metal per-token version is +7727.9. With per-channel λ plus per-group g32, the fused version lands at +638.6 — a 12.5× improvement, in the same range as the Python reference's +654.6.",[15,3180,3181],{},"But +638.6 is still +638.6. A 12.5× improvement is not the same as deployable. The paper calls this \"closing the catastrophe\"; I think it is closer to moving a fire from the whole house into one room. If you enable 4-bit on Qwen, validate with task metrics, not just the relative PPL gain.",[15,3183,3184],{},"Gemma looks better: per-token +18.7, fused +3.6. The Python reference is −5.2; the +8.8 gap comes from the kernel's fp32 reduction and rounding order, not the algorithm. The author rules that out with two ablations.",[52,3186,3188],{"id":3187},"it-really-breaks-qwen-at-2k-emits-two-tokens","It really breaks: Qwen at 2K emits two tokens",[15,3190,3191],{},"Back to the warning.",[15,3193,3194],{},"Qwen2.5-1.5B at a 2048-token prefix, int4, emits two tokens and hits EOS (end-of-sequence); fp16 emits 64.",[85,3196,3197,3209],{},[88,3198,3199],{},[91,3200,3201,3203,3206],{},[94,3202,2142],{},[94,3204,3205],{},"fp16",[94,3207,3208],{},"int4",[110,3210,3211,3222,3233],{},[91,3212,3213,3216,3219],{},[115,3214,3215],{},"Generated tokens (2048 prefix)",[115,3217,3218],{},"64",[115,3220,3221],{},"2 (EOS)",[91,3223,3224,3227,3230],{},[115,3225,3226],{},"Peak memory",[115,3228,3229],{},"4447 MB",[115,3231,3232],{},"5527 MB",[91,3234,3235,3238,3240],{},[115,3236,3237],{},"Author's fallback",[115,3239,2367],{},[115,3241,3242],{},"fp16 above about 1.5K",[15,3244,3245],{},"There is more than one cause. The dequant-prefix cache plus int4 storage pushes peak memory from 4447 to 5527 MB (+24%); combined with quantization noise across 28 full-attention layers, the logits tip into an early EOS.",[15,3247,3248],{},"I think the design that makes 1024 faster is also part of what makes 2048 break. The prefix cache turns dequantization from \"slower as the prefix grows\" into a fixed cost, but it also occupies memory; on a full-attention stack like Qwen, both happen at once.",[15,3250,3251],{},"Why is Gemma fine? Its sliding-window layers stay in fp16; only a few full-attention layers pay the dequant cost. Longer prefixes grow the cost more slowly. Same cache, different architecture, different curve.",[15,3253,3254],{},"If you want to enable this cache on your own model, test 2K first. Not \"does it generate\", but \"is the output still correct, and does it stop early\". The author's fallback is explicit: above about 1.5K, go back to fp16.",[52,3256,3258],{"id":3257},"four-questions-for-any-quantization-benchmark","Four questions for any quantization benchmark",[15,3260,3261],{},"The most useful part of the paper is not \"Apple Silicon is fast\". It is a way to split a benchmark into questions.",[15,3263,3264,3267],{},[199,3265,3266],{},"First, the platform."," Unified memory or separate HBM? The paper says the conventional trade-off returns on GPUs with separate HBM and high dispatch overhead. The same kernel does not necessarily stay faster when you move it. Ask where the number was measured.",[15,3269,3270,3273],{},[199,3271,3272],{},"Second, the kernel."," Fused, or four separate steps? If the benchmark does not say, the number may be dominated by dispatch tax. Ask: how many dispatches per layer per step?",[15,3275,3276,3279],{},[199,3277,3278],{},"Third, the prefix and the architecture."," The −8% at 256 tokens is not the −3.2% at 4K; full-attention and sliding-window stacks curve differently. Ask for 256, 1K and 2K, not just the best chart.",[15,3281,3282,3285],{},[199,3283,3284],{},"Fourth, the quality."," What is the ΔPPL baseline, and which quantizer? +638.6 is better than +7975, but it is still +638.6. Per-token and per-channel+group are different things; do not compare them as if they were the same.",[85,3287,3288,3301],{},[88,3289,3290],{},[91,3291,3292,3295,3298],{},[94,3293,3294],{},"Question",[94,3296,3297],{},"Why it matters",[94,3299,3300],{},"How to check",[110,3302,3303,3314,3325,3336],{},[91,3304,3305,3308,3311],{},[115,3306,3307],{},"Unified memory or separate HBM?",[115,3309,3310],{},"Where the trade-off flips",[115,3312,3313],{},"Hardware spec; ask for per-platform numbers",[91,3315,3316,3319,3322],{},[115,3317,3318],{},"Fused kernel or four dispatches?",[115,3320,3321],{},"Dispatch tax can be 12–17% vs SRHT",[115,3323,3324],{},"Does the benchmark say \"4 dispatches\" or \"fused\"?",[91,3326,3327,3330,3333],{},[115,3328,3329],{},"Prefix length and attention pattern?",[115,3331,3332],{},"Long context may break",[115,3334,3335],{},"Ask for 256 \u002F 1K \u002F 2K; check full-attention vs sliding-window",[91,3337,3338,3341,3344],{},[115,3339,3340],{},"ΔPPL baseline and quantizer?",[115,3342,3343],{},"+638.6 is better than +7975 but still +638.6",[115,3345,3346],{},"Check the baseline; per-token or per-channel+group",[52,3348,2686],{"id":2685},[858,3350,3351,3354,3357,3360,3363,3366],{},[861,3352,3353],{},"One platform: Apple M1 only; no discrete-HBM GPU.",[861,3355,3356],{},"Small models: 135M–1.7B; nothing above 7B.",[861,3358,3359],{},"A single-author preprint, not peer-reviewed; we did not reproduce it.",[861,3361,3362],{},"Gemma's 19.5× is not like-for-like; an apples-to-apples comparison inside the full-attention layers is about 3.2×.",[861,3364,3365],{},"Qwen at 2K breaks; the author's own fallback is 1.5K.",[861,3367,3368],{},"This is not the only path. It only addresses the cost of writing the four steps separately.",[52,3370,3372],{"id":3371},"conclusion-the-question-is-not-is-quantization-fast","Conclusion: the question is not \"is quantization fast?\"",[15,3374,3375],{},"Quantization is not a switch. It is a stack: platform, kernel, quantizer, prefix length, architecture. Change one and the answer changes.",[15,3377,3378],{},"The two ledgers:",[858,3380,3381,3387],{},[861,3382,3383,3386],{},[199,3384,3385],{},"Implementation tax."," The same method, eager four steps vs two fused kernels: 11–21 percentage points.",[861,3388,3389,3392],{},[199,3390,3391],{},"Deployment bill."," int4 cache vs fp16: up to −8.2% at a short prefix, single digits at long prefixes (Qwen 1024 is −1.6%, Gemma 4096 is −3.2%), and it can stop early.",[15,3394,3395],{},"One thing to do tomorrow: run your model at 256, 1K and 2K, record ms\u002Ftok and output quality. If it is a full-attention stack, keep an fp16 fallback above 1.5K; 2K is the test point.",[15,3397,3398,3399,3403],{},"If you want help running those three prefixes on your own model, our ",[22,3400,3402],{"href":3401},"\u002Fen\u002Fservices","AI readiness audit"," is exactly that: what can be handed to AI now, and what should wait.",[15,3405,3406,3407,3411],{},"The series so far: ",[22,3408,3410],{"href":3409},"\u002Fen\u002Fblog\u002Fbroken-on-arrival-quantized-models","broken-on-arrival"," on the recipe, and this essay on the implementation. The earlier memory-trade-off essay is available in Chinese. The question moves from \"should we quantize?\" to \"how is that kernel written?\"",[3413,3414],"hr",{},[15,3416,3417],{},[3418,3419,3420,3421,3426,3427,1181],"em",{},"Paper: ",[22,3422,3425],{"href":3423,"rel":3424},"https:\u002F\u002Farxiv.org\u002Fabs\u002F2605.05699",[26],"arXiv 2605.05699v1"," (Mohamed Amine Bergach, Illumina). Previous essay: ",[22,3428,3429],{"href":3409},"the quantized model may be broken",{"title":956,"searchDepth":957,"depth":957,"links":3431},[3432,3433,3434,3435,3436,3437,3438,3439],{"id":2817,"depth":957,"text":2818},{"id":2833,"depth":957,"text":2834},{"id":2877,"depth":957,"text":2878},{"id":3086,"depth":957,"text":3087},{"id":3187,"depth":957,"text":3188},{"id":3257,"depth":957,"text":3258},{"id":2685,"depth":957,"text":2686},{"id":3371,"depth":957,"text":3372},"\u002Fimages\u002Fblog\u002Fen\u002Fquantization-kernel-dispatch.svg","Cover for the English essay, Quantization Speed Is Often a Kernel Problem","2026-11-05","Against SRHT, eager int4 KV-cache quantization ran 12–17% slower; fusing the four steps into Metal kernels cut most of the tax. The 8.2% win at 256 tokens has conditions—and Qwen breaks at 2K.",{},"\u002Fimages\u002Fblog\u002Fen\u002Fquantization-kernel-dispatch.jpg","\u002Fblog\u002Fen\u002Fquantization-kernel-dispatch",{"title":2682,"description":3443},"quantization-kernel-dispatch","blog\u002Fen\u002Fquantization-kernel-dispatch",[2803,983,3451,3452],"apple-silicon","inference","VrMGy2tQ__ko07oo7IbI-0WNfg5nBCIyvoC2Snzani0",1795333224968]