跳转至

突破算力天花板:Galahad 字节级精准内存机制让大模型文档读取变成一次性开销

Working Around the Compute Ceiling: Byte-Exact Memory in Galahad Makes LLM Reading a One-Time Cost

文章背景与核心概要

长期以来,大语言模型 (Large Language Model, LLM) 的在线推理服务普遍采用“无状态”架构,即针对同一份长文档的每一次用户提问,模型都必须从头重新计算完整的注意力状态,导致算力与能耗被极其严重地重复浪费。为攻克这一算力天花板瓶颈,研究者提出了名为 Galahad 的新型内存层,专为 vLLM、SGLang 和 llama.cpp 等主流推理框架量身设计。Galahad 由两大核心组件构成:Taliesin 能够对完全相同的字节级文本块实现键值缓存 (KV Cache) 状态的持久化存储与瞬时重载,真正将文档读取转变为“一次性开销”;而 Blaise 则负责直接维护文档并按需向模型精准投喂问题相关的特定片段。在包含 9.7 万 Token 的高难度语料测试中,配合 Gemma 4 31B 模型,Galahad 将问答准确率从基线的 10% 提升至 100% 满分,推理延迟降至 0.59–0.64 秒,且保存的注意力状态实现了 100% 比特级无损匹配。这项研究成果成功推动了大模型服务从低效的“无状态”计算迈向真正高效的“状态化推理” (Stateful Inference) 新范式。


执行摘要

Executive Summary

传统上,大语言模型 (Large Language Model, LLM) 的推理服务在各个请求之间是完全“无状态”的。这意味着每当收到针对同一份文档的新提问时,模型都必须从第一个 Token 开始重新计算整篇文档的注意力状态——这无疑在底层硬件上白白浪费了极其庞大的算力与电力。为了突破这一算力天花板的严苛限制,本文隆重推出了 Galahad——一套专为 vLLM、SGLang 以及 llama.cpp 等主流开源推理框架量身打造的高效内存层。

Large Language Model (LLM) serving is traditionally stateless, meaning that a model recomputes a document's attention state from the first token upon every new request—wasting massive amounts of compute and energy. To address this compute ceiling constraint, this paper introduces Galahad, a memory layer designed for frameworks like vLLM, SGLang, and llama.cpp.

Galahad 巧妙借助两大核心组件,成功将大模型的文档读取转变为“一次性开销”:

Galahad transforms LLM reading into a one-time cost by leveraging two main components:

  • Taliesin: 能够针对字节完全一致的文本块,自动持久化保存并极速重新加载模型的键值 (Key-Value, KV) 状态,彻底告别重复计算。
  • Blaise: 直接在底层接管长文档管理,每次仅向模型精准传递回答当前问题所必需的特定章节片段。
  • Taliesin: Saves and reloads a model's key-value (KV) state for blocks of text matching identical bytes.
  • Blaise: Manages documents directly, passing only the specific sections required by a question.

核心成果

Key Results

  • 效率与召回率 (Efficiency & Recall) : 在一项极具挑战性的事实召回测试中 (在包含 97,000 个 Token 的庞大语料库中隐藏了 100 个关键事实,评测模型为 Gemma 4 31B) ,仅启用 Taliesin 便能让模型对整份语料库施加全局注意力,成功准确回答了 98/100 道问题 (单次查询仅耗时 3.0 秒,能耗 572 焦耳) ;相比之下,未搭载 Galahad 的同款基线模型受限于显存上下文只能容纳最后的 12,000 个 Token ,测试得分仅有可怜的 10/100 (且单次查询耗时高达 9.3 秒,能耗达 2,754 焦耳) 。
  • 引入 Blaise 后的卓越表现 (Enhanced Performance with Blaise) : 在进一步加入 Blaise 模块后,模型每道问题实际仅需读取约 668 个 Token ,在所有推理运行时中均取得了 100/100 的满分成绩;与此同时,单题延迟骤降至 0.59–0.64 秒,能耗更是压缩至 200–213 焦耳 (全面超越了得分仅为 77 分且经过精心调优的 RAGFlow 管线) 。
  • 极具性价比的一次性投入 (One-Time Costs) : 初始持久化存储整份语料库仅需付出约 100 秒和 28 千焦 (kJ) 的一次性开销;更令人瞩目的是,这份能量投入仅需在处理完 13 个问题后,便能通过后续节省的计算算力完全收回成本。
  • 比特级精准保真度 (Bit-Exact Fidelity) : 重载恢复后的缓存状态在比特层面上达到了完全一致 (模型输出的所有 262,144 个对数几率 logits 完美匹配,没有任何精度漂移或信息丢失) 。
  • 坚如磐石的系统健壮性 (Robustness) : Galahad 在 vLLM 环境下成功兼容了参与评测的全部 30 款大语言模型,并内建了“故障闭锁” (fail-closed) 安全机制——一旦任何一致性校验未通过,系统将默认自动回退至从头重新计算,确保推理质量万无一失。
  • Efficiency & Recall: On a challenging test containing 100 facts hidden in a 97,000-token corpus (using Gemma 4 31B), Taliesin allowed the model to attend to the entire corpus and successfully answer 98/100 questions (at 3.0 s and 572 J per query), whereas the baseline model without Galahad could only retain the last 12,000 tokens and scored 10/100 (at 9.3 s and 2,754 J).
  • Enhanced Performance with Blaise: Adding Blaise reduced the read volume to ~668 tokens per question, achieving a perfect 100/100 score across all runtimes with latency dropping to 0.59–0.64 s and energy usage to 200–213 J (outperforming a tuned RAGFlow pipeline which scored 77).
  • One-Time Costs: Storing the corpus requires a one-time investment of ~100 seconds and 28 kJ, an energy cost that is fully recovered after just 13 questions.
  • Bit-Exact Fidelity: Restored states are entirely bit-identical (all 262,144 output logits matched).
  • Robustness: Galahad successfully integrated with all 30 tested models under vLLM and operates with a "fail-closed" safety mechanism that defaults to recomputation if any check fails.

论文摘要

Abstract

Transformer 架构的语言模型在处理每个 Token 时所能执行的计算量是存在理论上限的。Infosys 前首席执行官 Vishal Sikka 在近期的研究成果 (arXiv:2507.07505) 中深入论证指出,这一物理与理论上限严格制约了模型所能执行或验证的任务边界。顺着这一思路,我们不禁要深入探究:在这一天花板之下的宝贵算力预算中,究竟有多少被无谓地消耗在模型“此前早就做过的工作”上?目前主流的大模型在线服务在不同请求之间均保持着严格的无状态特性:当模型需要回答关于同一篇文档的第二个问题时,它不得不重新从第一个 Token 开始,把整篇文档的注意力状态完完整整地重算一遍。我们在七个真实世界数据集上的统计显示,输入提示词中高达 98.7% 的 Token 实际上都是模型此前早已逐字阅读过的文本。

A transformer language model performs a bounded amount of computation per token, and recent work by Vishal Sikka, former CEO of Infosys, argues that this bound limits which tasks a model can carry out or verify (arXiv:2507.07505). We ask how much of the budget beneath that ceiling is spent on work the model has already done. Serving is stateless across requests: a model that answers a second question about a document recomputes the document's attention state from the first token. On seven real-world datasets, 98.7% of prompt tokens were text the model had already read.

针对这一痛点,我们推出了 Galahad——一套面向 vLLM、SGLang 以及 llama.cpp 的创新内存层,成功使文档读取开销转变为“一次性投入”。其中,Taliesin 模块能够持久化保存指定文本块的模型键值 (KV) 状态;当后续请求包含完全相同的字节内容时,系统便会直接秒级重载该状态,而无需执行耗时的重新计算。与此同时,Blaise 模块则在底层直接维护并管理文档库本身,仅向模型按需精准传递回答当前提问所必需的特定片段。

We present Galahad, a memory layer for vLLM, SGLang and this http URL that makes this reading a one-time cost. Taliesin saves the model's key-value (KV) state for a block of text and loads it on the next request that contains the same bytes, instead of recomputing it. Blaise keeps the documents themselves and passes the model only the section a question needs.

在一项将 100 个关键事实隐藏于 97,000 个 Token 庞大语料库的高难度召回测试中 (评测模型为 Gemma 4 31B) ,仅凭 Taliesin 模块,模型便能轻松对整份语料库施加全局注意力,在 llama.cpp 上成功准确答对了 100 道题目中的 98 道,每道问题仅耗时 3.0 秒、消耗 572 焦耳能耗;相比之下,未搭载 Galahad 的同款基线模型由于上下文容量限制只能容纳最后的 12,000 个 Token ,测试仅仅答对了 10 道题,且每道题耗时高达 9.3 秒、能耗高达 2,754 焦耳。在进一步引入 Blaise 后,模型针对每个问题平均仅需读取约 668 个 Token ,在全部三大推理运行时中均斩获了 100 道全对的满分战绩,单题延迟骤降至 0.59–0.64 秒,能耗仅为 200–213 焦耳;而经过精细调优的 RAGFlow 管线在此测试中仅答对了 77 道。在存储开销方面,将整个语料库持久化是一次性操作,耗时约 100 秒、消耗 28 千焦 (kJ) 能耗,而这一能量投入在处理短短 13 个问题后即可通过节省的算力完全打平收回。此外,恢复后的状态达到了完美的比特级一致:在经历重启、重新水化 (Rehydration) 与热加载后,全部 262,144 个输出对数几率 (logits) 均实现了分毫不差的精准匹配。Galahad 在 vLLM 下对我们测试的全部 30 款模型均实现了即插即用的稳定兼容,并具备严密的“故障闭锁”机制:任何未能通过一致性校验的加载都会自动回退至从头重新计算。这一系列扎实的成果标志着大模型推理服务正正式从传统的“无状态计算”大步迈向高效的“状态化推理” (Stateful Inference) 新纪元。

On a recall test with 100 facts hidden in a 97,000-token corpus (Gemma 4 31B), Taliesin alone let the model attend to the whole corpus and answered 98 of 100 on this http URL at 3.0 s and 572 J per question, against 10 of 100, 9.3 s and 2,754 J for the same model without Galahad, which could hold only the last 12,000 tokens. With Blaise added, the model read about 668 tokens per question and answered 100 of 100 on all three runtimes at 0.59-0.64 s and 200-213 J; a tuned RAGFlow pipeline answered 77. Storing the corpus is a one-time cost of about 100 s and 28 kJ, whose energy is recovered after 13 questions. Restored state is bit-identical: all 262,144 output logits matched after restart, rehydration and hot-load. Galahad worked with all 30 models we tested under vLLM, and it fails closed: any load that does not pass its checks is recomputed. Together these results move LLM serving from stateless to stateful inference.


补充元数据

Additional Metadata

  • 主要研究领域 (Primary Subject) : 计算与语言 (cs.CL)
  • 交叉研究领域 (Secondary Subjects) : 人工智能 (cs.AI);信息检索 (cs.IR);机器学习 (cs.LG);性能工程 (cs.PF)
  • 引用方式 (Cite as) : arXiv:2609.39358 [cs.CL]
  • 数字对象唯一标识符 (DOI) : 10.48550/arXiv.2609.39358
  • Primary Subject: Computation and Language (cs.CL)
  • Secondary Subjects: Artificial Intelligence (cs.AI); Information Retrieval (cs.IR); Machine Learning (cs.LG); Performance (cs.PF)
  • Cite as: arXiv:2609.39358 [cs.CL]
  • DOI: 10.48550/arXiv.2609.39358