我的征尘是星辰大海。。。
The dirt and dust from my pilgrimage forms oceans of stars...
-------当记忆的篇章变得零碎,当追忆的图片变得模糊,我们只能求助于数字存储的永恒的回忆
作者:黄教授
手机视频列表
Engram给Transfomer的是查询提示词而不是查询内容本身3
视频
音频
原始脚本
三、工程实现细节,内存与显存的无缝协作。 Ngram 的效率提升不仅源于羽翼洁净的设计,更依赖于底层硬件与软件的协同优化。 其中统一内存虚拟化技术是实现 CPU 内存存记忆,GPU 显存做推理的关键。 这一技术细节的缺失,也是很多人误解 Ngram 玻璃知识的重要原因。 一,不是 OS 的魔法,是库达驱动与 GPU 硬件的协同。 很多人会误以为 Anagram 的内存与显存分离是操作系统 OS 层面的内存池化技术实现的。 但事实是,OS 只负责 CPU 内存的基础分配,真正的跨设备协同由库达驱动和 GPU 硬件完成。 一、GPU 的独立 MMU,GPU 自带内存管理单元 MMU,支持与 CPU 共享统一虚拟地址空间 UVA。 这意味着 CPU 和 GPU 使用同一套虚拟地址编码,一个地址既可以指向 CPU 内存,也可以指向 GPU 显存。 二、缺页中断与 DMA 迁移。 当模型访问 Conditional Memory 中的提示向量时,如果数据在 CPU 内存中,GPU MMU 会触发缺页中断,通知 CUDA 驱动。 驱动会调用 DMA 引擎,通过 PCIe NVLink 总线,将 CPU 内存中的数据异步迁移到 GPU 显存,整个过程对应用程序完全全透明。 三,内存 属性标记,Ngram 通过库的 API 将 conditional memory 的提示向量标记为优先 CPU 存储,而 F F N 的参数则标记为优先 GPU 存储。 驱动会根据标记自动分配内存资源,无需手动干预。 二、为什么要内存存记忆,显存做推理?这是对硬件资源的极致利用。 GPU 显存的带宽高、延迟低,但价格昂贵、容量有限。 CPU 内存容量大、价格低廉,但带宽和延迟不如显存。 Conditional memory 中的提示向量是静态的,无需参与复杂的并行计算,因此可以卸载到 CPU 内存中,节省宝贵的 GPU 显存 Transformer 的 FFN 和注意力层需要高带宽、低延迟的计算资源,因此留在 GPU 显存中,专注于推理。 这种设计的核心是按需迁移,只有当模型需要某个提示向量时,它才会从 CPU 内存迁移到 GPU 显存,用完后可以释放。 这与将知识从 F F N 中剥离完全是两个概念。 前者是硬件资源的优化,后者是模型架构的重构。 四、认知升华, Ingram 的价值与大模型的未来。 一、不是革命性颠覆,是渐进式优化的典范。 Ingram 没有颠覆 Transformer 架构。 也没有改变计算机存储的核心逻辑。 它的价值在于,在现有架构的基础上,找到了一条提升效率的精准路径。 传统大模型的计算模拟查询,就像在一个巨大的迷宫里盲目寻找出口,需要绕很多弯路。 N-Gram 的提示向量就像迷宫里的路标,能引导模型快速找到出口。 路标本身不是出口,但它能让找出口的过程变得更高效。 从工程视角看,N-Gram 甚至是一个增量插件,它不修改原有模型的任何参数,只是在层间插入检索模块。 这种非侵入式优化的思路在工业界具有极高的落地价值,无需重构模型即可实现效率提升。 二、大模型的记忆困局,计算与存储的永恒博弈,Ngram 的出现让我们更清晰的看到大模型的核心矛盾。 它的知识存储在参数中,存取知识必须通过计算,但计算本身需要消耗大量算力,这是一个经乎无解的矛盾。 因为大模型的训练过程,本质上就是通过海量数据调整参数,将知识编码为可计算的权重。 而推理过程就是通过参数的矩阵运算,将编码的知识解码为人类可理解的文本。 Ngram 没有解决这个矛盾,但它通过语义提示的方式减少了解码过程中的冗余计算,让计算模拟查询变得更高效。 未来的大模型架构或许会朝着更智能的提示机制和更高效的计算逻辑方向发展。 比如让提示向量能根据上下文动态调整,让门控网络能更精准的筛选知识维度。 但只要 Transformer 的核心逻辑不变,计算机存储的本质就不会改变。 五,写给技术同号,拨开迷雾,回归本质。 作为一名老派程序员。 我在解读 Ingram 的过程中,经历了从误读到纠偏再到升华的认知历程。 这个过程让我深刻体会到,技术的真相往往藏在那些被媒体忽略的底层细节里。 很多时候我们会被查算分离颠覆架构这样的热词吸引。 却忽略了对底层逻辑的追问。 一个固定维度的向量能存多少信息?模型的知识到底储存在哪里?硬件层面是如何实现内存与显存写作的?这些问题没有华丽的词藻,却能让我们真正理解一项技术的价值。 Ngram 的论文不是一份颠覆宣言,而是一份优化指南。 他告诉我们,在大模型技术的发展道路上,并非只有堆参数、堆算力这一条路。 有时候一个精准的语义捷径就能带来意想不到的效率提升,而这或许就是技术创新最迷人的地方,于细微处见真章,于优化中见未来。
修正脚本
三、工程实现细节,内存与显存的无缝协作。 Ngram 的效率提升不仅源于简洁精巧的设计,更依赖于底层硬件与软件的协同优化。 其中统一内存虚拟化技术是实现 CPU 内存存记忆,GPU 显存做推理的关键。 这一技术细节的缺失,也是很多人误解 Ngram 剥离知识的重要原因。 一、不是 OS 的魔法,是库达驱动与 GPU 硬件的协同。 很多人会误以为 Anagram 的内存与显存分离是操作系统 OS 层面的内存池化技术实现的。 但事实是,OS 只负责 CPU 内存的基础分配,真正的跨设备协同由库达驱动和 GPU 硬件完成。 一、GPU 的独立 MMU,GPU 自带内存管理单元 MMU,支持与 CPU 共享统一虚拟地址空间 UVA。 这意味着 CPU 和 GPU 使用同一套虚拟地址编码,一个地址既可以指向 CPU 内存,也可以指向 GPU 显存。 二、缺页中断与 DMA 迁移。 当模型访问 Conditional Memory 中的提示向量时,如果数据在 CPU 内存中,GPU MMU 会触发缺页中断,通知 CUDA 驱动。 驱动会调用 DMA 引擎,通过 PCIe NVLink 总线,将 CPU 内存中的数据异步迁移到 GPU 显存,整个过程对应用程序完全透明。 三、内存属性标记,Ngram 通过库的 API 将 conditional memory 的提示向量标记为优先 CPU 存储,而 F F N 的参数则标记为优先 GPU 存储。 驱动会根据标记自动分配内存资源,无需手动干预。 二、为什么要内存存记忆,显存做推理?这是对硬件资源的极致利用。 GPU 显存的带宽高、延迟低,但价格昂贵、容量有限。 CPU 内存容量大、价格低廉,但带宽和延迟不如显存。 Conditional memory 中的提示向量是静态的,无需参与复杂的并行计算,因此可以卸载到 CPU 内存中,节省宝贵的 GPU 显存 Transformer 的 FFN 和注意力层需要高带宽、低延迟的计算资源,因此留在 GPU 显存中,专注于推理。 这种设计的核心是按需迁移,只有当模型需要某个提示向量时,它才会从 CPU 内存迁移到 GPU 显存,用完后可以释放。 这与将知识从 F F N 中剥离完全是两个概念。 前者是硬件资源的优化,后者是模型架构的重构。 四、认知升华, Ingram 的价值与大模型的未来。 一、不是革命性颠覆,是渐进式优化的典范。 Ingram 没有颠覆 Transformer 架构。 也没有改变计算机存储的核心逻辑。 它的价值在于,在现有架构的基础上,找到了一条提升效率的精准路径。 传统大模型的计算与查询,就像在一个巨大的迷宫里盲目寻找出口,需要绕很多弯路。 N-Gram 的提示向量就像迷宫里的路标,能引导模型快速找到出口。 路标本身不是出口,但它能让找出口的过程变得更高效。 从工程视角看,N-Gram 甚至是一个增量插件,它不修改原有模型的任何参数,只是在层间插入检索模块。 这种非侵入式优化的思路在工业界具有极高的落地价值,无需重构模型即可实现效率提升。 二、大模型的记忆困局,计算与存储的永恒博弈,Ngram 的出现让我们更清晰的看到大模型的核心矛盾。 它的知识存储在参数中,存取知识必须通过计算,但计算本身需要消耗大量算力,这是一个近乎无解的矛盾。 因为大模型的训练过程,本质上就是通过海量数据调整参数,将知识编码为可计算的权重。 而推理过程就是通过参数的矩阵运算,将编码的知识解码为人类可理解的文本。 Ngram 没有解决这个矛盾,但它通过语义提示的方式减少了解码过程中的冗余计算,让计算检索查询变得更高效。 未来的大模型架构或许会朝着更智能的提示机制和更高效的计算逻辑方向发展。 比如让提示向量能根据上下文动态调整,让门控网络能更精准的筛选知识维度。 但只要 Transformer 的核心逻辑不变,计算机存储的本质就不会改变。 五、写给技术同好,拨开迷雾,回归本质。 作为一名老派程序员。 我在解读 Ingram 的过程中,经历了从误读到纠偏再到升华的认知历程。 这个过程让我深刻体会到,技术的真相往往藏在那些被媒体忽略的底层细节里。 很多时候我们会被存算分离颠覆架构这样的热词吸引。 却忽略了对底层逻辑的追问。 一个固定维度的向量能存多少信息?模型的知识到底储存在哪里?硬件层面是如何实现内存与显存协作的?这些问题没有华丽的词藻,却能让我们真正理解一项技术的价值。 Ngram 的论文不是一份颠覆宣言,而是一份优化指南。 它告诉我们,在大模型技术的发展道路上,并非只有堆参数、堆算力这一条路。 有时候一个精准的语义捷径就能带来意想不到的效率提升,而这或许就是技术创新最迷人的地方,于细微处见真章,于优化中见未来。
英文翻译
III. Engineering Implementation Details: Seamless Collaboration Between Memory and Video Memory The efficiency improvement of Ngram stems not only from its concise and elegant design but also from the synergistic optimization of underlying hardware and software. Among these, unified memory virtualization technology is key to enabling CPU memory for storage and GPU video memory for inference. The lack of this technical detail is also a major reason why many misunderstand Ngram's separation of knowledge. 1. Not OS Magic, but CUDA Driver and GPU Hardware Synergy Many people mistakenly believe that Anagram's separation of memory and video memory is achieved through OS-level memory pooling technology. In reality, the OS is only responsible for basic allocation of CPU memory, while true cross-device collaboration is accomplished by the CUDA driver and GPU hardware. 1. GPU's Independent MMU The GPU has its own Memory Management Unit (MMU), supporting a unified virtual address space (UVA) shared with the CPU. This means the CPU and GPU use the same set of virtual address encodings, where one address can point to either CPU memory or GPU video memory. 2. Page Fault Interrupts and DMA Migration When the model accesses prompt vectors in Conditional Memory, if the data resides in CPU memory, the GPU MMU triggers a page fault interrupt, notifying the CUDA driver. The driver invokes the DMA engine to asynchronously migrate data from CPU memory to GPU video memory via the PCIe/NVLink bus, with the entire process completely transparent to the application. 3. Memory Attribute Marking Ngram uses the library's API to mark prompt vectors in Conditional Memory as CPU-priority storage, while FFN parameters are marked as GPU-priority storage. The driver automatically allocates memory resources based on these markings, requiring no manual intervention. 2. Why Use Memory for Storage and Video Memory for Inference? This Is Extreme Utilization of Hardware Resources GPU video memory offers high bandwidth and low latency but is expensive and limited in capacity. CPU memory has large capacity and low cost but lacks the bandwidth and latency of video memory. Prompt vectors in Conditional Memory are static and do not participate in complex parallel computations, so they can be offloaded to CPU memory, saving precious GPU video memory. Transformer FFN and attention layers require high-bandwidth, low-latency computing resources, so they stay in GPU video memory, focusing on inference. The core of this design is on-demand migration: only when the model needs a specific prompt vector does it migrate from CPU memory to GPU video memory, and it can be released after use. This is entirely different from stripping knowledge from FFN. The former is hardware resource optimization; the latter is model architecture restructuring. IV. Cognitive Sublimation: The Value of Ingram and the Future of Large Models 1. Not a Revolutionary Disruption, but a Model of Incremental Optimization Ingram does not overturn the Transformer architecture. Nor does it change the core logic of computer storage. Its value lies in finding a precise path to improve efficiency based on existing architectures. Traditional large model computation and querying are like blindly searching for an exit in a vast maze, requiring many detours. N-gram's prompt vectors act like signposts in the maze, guiding the model to quickly find the exit. The signpost itself is not the exit, but it makes the process of finding the exit more efficient. From an engineering perspective, N-gram is even an incremental plugin: it does not modify any original model parameters but only inserts a retrieval module between layers. This non-intrusive optimization approach has extremely high practical value in industry, enabling efficiency improvements without model reconstruction. 2. The Memory Dilemma of Large Models: The Eternal Game Between Computation and Storage The emergence of Ngram allows us to see the core contradiction of large models more clearly. Their knowledge is stored in parameters, and accessing knowledge requires computation, which itself consumes significant computing power—a nearly unsolvable contradiction. The training process of large models is essentially adjusting parameters through massive data, encoding knowledge into computable weights. The inference process is decoding the encoded knowledge into human-readable text through matrix operations on parameters. Ngram does not resolve this contradiction, but it reduces redundant computation during decoding through semantic prompting, making computation and retrieval more efficient. Future large model architectures may evolve toward smarter prompting mechanisms and more efficient computational logic. For example, prompt vectors could dynamically adjust based on context, and gated networks could more precisely filter knowledge dimensions. As long as the core logic of Transformer remains unchanged, the essence of computer storage will not change. V. To Fellow Technologists: Clearing the Fog, Returning to the Basics As an old-school programmer, I experienced a cognitive journey of misreading, correction, and sublimation while interpreting Ingram. This process has deeply impressed upon me that the truth of technology often lies in the underlying details overlooked by the media. Often, we are attracted by buzzwords like "storage-computation separation" or "architecture disruption," Yet we neglect to question the underlying logic. How much information can a fixed-dimension vector store? Where is the model's knowledge actually stored? How is memory-video memory collaboration achieved at the hardware level? These questions lack glamorous phrasing but allow us to truly understand the value of a technology. The Ngram paper is not a manifesto of disruption but a guide to optimization. It tells us that on the path of large model development, piling up parameters and computing power is not the only way. Sometimes a precise semantic shortcut can bring unexpected efficiency gains. And perhaps this is the most fascinating part of technological innovation: finding insight in the details and seeing the future in optimization.
back to top