search
HomeTechnology peripheralsAIA single card A100 can achieve millions of token inferences, which is 10 times faster. This is Microsoft's official large model inference acceleration.

This Microsoft research allows developers to process over 1M input text 10x faster on a single card machine.


Large Language Model (LLM) has entered the era of long context processing, and the context window it supports has soared from the previous 128K to the 10M token level.

However, due to the quadratic complexity of the attention mechanism, it may take several minutes for the model to process the input prompt (i.e., the pre-population stage) and start generating the first token. As a result, it takes too long to generate the first token, which seriously affects the user experience, which also greatly limits the widespread application of long-context LLM.

For example (as shown in Figure 2a), when serving LLaMA-3-8B on a single machine equipped with A100, if it prompts that there are 300,000 tokens, the model will take 6 minutes to complete the preset. During the pre-filling phase, if the prompt increases to 1 million tokens, this number will increase to 30 minutes.
A single card A100 can achieve millions of token inferences, which is 10 times faster. This is Microsofts official large model inference acceleration.
The overhead of self-attention computation accounts for more than 90% of the total prefill delay, making it the main bottleneck when LLM handles long contexts. Existing accelerated pre-population methods often fail to maintain acceptable accuracy or efficiency when applied to long-context LLMs.

In order to solve the above problems, researchers from Microsoft and the University of Surrey proposed a sparse calculation method designed to accelerate pre-filling in long sequence processing: MInference (Milliontokens Inference).
A single card A100 can achieve millions of token inferences, which is 10 times faster. This is Microsofts official large model inference acceleration.
  • Paper address: https://arxiv.org/pdf/2407.02490
  • Paper homepage: https://hqjiang.com/minference.html
  • Paper title: MInference 1.0: Accelerating Pre-filling for Long-Context LLMs via Dynamic Sparse Attention

MInference can be directly applied to existing LLMs without modifications to pre-training settings or additional fine-tuning.

By testing various downstream tasks (including InfiniteBench, RULER, PG-19 and Needle In A Haystack) and models (including LLaMA-3-1M, Yi-200K, GLM-4-1M, Phi-3- 128K and Qwen2-128K), experiments demonstrate that MInference can effectively reduce pre-populated inference latency on the A100 by up to 10x while maintaining accuracy.
A single card A100 can achieve millions of token inferences, which is 10 times faster. This is Microsofts official large model inference acceleration.

A single card A100 can achieve millions of token inferences, which is 10 times faster. This is Microsofts official large model inference acceleration.

                                                                                                                                                                                   Using MInference 1.0, long context LLM (such as LLaMA-3-8B-1M, GLM-4-1M) achieves a 10x improvement in inference speed on a single A100, and is more accurate.

Method introduction

The authors proposed MInference, a name that reflects their ambition to achieve million token inference on an A100 machine.

MInference is a training-free and efficient method for the pre-population stage of long-context LLM based on dynamic sparse attention.

Researchers believe that attention, especially in long contexts, is sparse and dynamic, that is, in different inputs, the sparse pattern is very different. This dynamic sparsity exhibits three unique spatial aggregation patterns that apply to all inputs: A-shape, Vertical-Slash, and Block-Sparse.
A single card A100 can achieve millions of token inferences, which is 10 times faster. This is Microsofts official large model inference acceleration.
MInference first determines the best dynamic sparse pattern offline for each head using a kernel-aware sparse pattern search algorithm, as shown in Algorithm 1. During inference, it dynamically approximates the dynamic sparsity index based on the pattern of the head, as shown in Algorithms 2, 3. Finally, the authors use optimized GPU kernels to perform efficient dynamic sparse attention computation, significantly reducing the pre-population stage latency of long-context LLM.
A single card A100 can achieve millions of token inferences, which is 10 times faster. This is Microsofts official large model inference acceleration.
For example, for the "vertical - diagonal line" mode, the author first uses the attention calculation between the last Q and K to estimate the best index of the vertical line and diagonal line. They then leveraged the dynamic sparse compilers PIT and Triton to build a vertical-slash FlashAttention kernel that accelerates attention computation. For the A-shaped, vertical-slope, and block-sparse patterns, the authors first use mean pooling of Q and K in the attention computation. Using mean pooling and the exchange property of MatMul, the blocky-sparse index can be estimated. They then used the Triton building block sparse FlashAttention kernel to accelerate attention computation. See Appendix C.4 and code for detailed implementation of the kernel.

Evaluation results on long context benchmarks

The authors tested MInference in a range of scenarios, including QA, encoding, retrieval-based tasks, multi-hop QA, summarization and math tasks . The RULER benchmark includes several complex multi-hop or multi-needle tasks, effectively reflecting the actual context window size of LLM. As shown in Table 1, MInference effectively preserves the actual context window handling capabilities of LLM and even slightly extends the actual context window size to 32K.
A single card A100 can achieve millions of token inferences, which is 10 times faster. This is Microsofts official large model inference acceleration.
The authors also tested MInference on a wider range of tasks using InfiniteBench with an average token length of 214K, as shown in Table 2. Compared to the SoTA baseline, MInference consistently maintains good performance across all tasks. Notably, in more challenging retrieval tasks such as the KV retrieval task, all baselines failed to make accurate predictions, with an accuracy below 1.2%. However, MInference successfully retains the ability to handle dynamic KV pair retrieval.
A single card A100 can achieve millions of token inferences, which is 10 times faster. This is Microsofts official large model inference acceleration.
To further evaluate the performance of different context lengths and different positions of key information in the prompt, the authors tested various models and methods using the "needle in the haystack" task. As shown in Figure 1, MInference performs well under different models, context windows, and cue information locations, and its performance remains the same or even slightly improved compared to the original model. In the case of LLaMA-3-8B and GLM-4-9B-1M, MInference achieves fully green performance in context windows up to 1M. In contrast, StreamingLLM and InfLLM performance drops below 20% in the middle of the prompt, even in a 70K context window.
A single card A100 can achieve millions of token inferences, which is 10 times faster. This is Microsofts official large model inference acceleration.
The authors also tested MInference on a language model task using PG-19, which included up to 100k tokens.如图 2 所示,MInference 有效地保持了 LLaMA-3-8B 和 Yi-9B-200K 的困惑度,而所有基线都出现了不同程度的困惑度下降。此外,与标准的 StreamingLLM 相比,使用膨胀和步长配置的 StreamingLLM 更好地保持了困惑度性能。
A single card A100 can achieve millions of token inferences, which is 10 times faster. This is Microsofts official large model inference acceleration.
延迟和内核中的稀疏模式 

图 3 展示了本文提出的三种注意力模式以及 FlashAttention 的微基准测试结果。可以看出,Vertical-Slash 是三种模式中最慢的,但在 1M 上下文窗口下,相比 FlashAttention 仍然实现了 13 倍的加速。
A single card A100 can achieve millions of token inferences, which is 10 times faster. This is Microsofts official large model inference acceleration.
图 4 展示了 Vertical-Slash 头部内核中的稀疏索引。垂直线通过 PIT FlashAttention 使用 1x64 块计算,而斜线通过块级 FlashAttention 使用 64x64 块计算。
A single card A100 can achieve millions of token inferences, which is 10 times faster. This is Microsofts official large model inference acceleration.
参考链接:https://hqjiang.com/minference.html

The above is the detailed content of A single card A100 can achieve millions of token inferences, which is 10 times faster. This is Microsoft's official large model inference acceleration.. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
4090生成器:与A100平台相比,token生成速度仅低于18%,上交推理引擎赢得热议4090生成器:与A100平台相比,token生成速度仅低于18%,上交推理引擎赢得热议Dec 21, 2023 pm 03:25 PM

PowerInfer提高了在消费级硬件上运行AI的效率上海交大团队最新推出了超强CPU/GPULLM高速推理引擎PowerInfer。PowerInfer和llama.cpp都在相同的硬件上运行,并充分利用了RTX4090上的VRAM。这个推理引擎速度有多快?在单个NVIDIARTX4090GPU上运行LLM,PowerInfer的平均token生成速率为13.20tokens/s,峰值为29.08tokens/s,仅比顶级服务器A100GPU低18%,可适用于各种LLM。PowerInfer与

思维链CoT进化成思维图GoT,比思维树更优秀的提示工程技术诞生了思维链CoT进化成思维图GoT,比思维树更优秀的提示工程技术诞生了Sep 05, 2023 pm 05:53 PM

要让大型语言模型(LLM)充分发挥其能力,有效的prompt设计方案是必不可少的,为此甚至出现了promptengineering(提示工程)这一新兴领域。在各种prompt设计方案中,思维链(CoT)凭借其强大的推理能力吸引了许多研究者和用户的眼球,基于其改进的CoT-SC以及更进一步的思维树(ToT)也收获了大量关注。近日,苏黎世联邦理工学院、Cledar和华沙理工大学的一个研究团队提出了更进一步的想法:思维图(GoT)。让思维从链到树到图,为LLM构建推理过程的能力不断得到提升,研究者也通

复旦NLP团队发布80页大模型Agent综述,一文纵览AI智能体的现状与未来复旦NLP团队发布80页大模型Agent综述,一文纵览AI智能体的现状与未来Sep 23, 2023 am 09:01 AM

近期,复旦大学自然语言处理团队(FudanNLP)推出LLM-basedAgents综述论文,全文长达86页,共有600余篇参考文献!作者们从AIAgent的历史出发,全面梳理了基于大型语言模型的智能代理现状,包括:LLM-basedAgent的背景、构成、应用场景、以及备受关注的代理社会。同时,作者们探讨了Agent相关的前瞻开放问题,对于相关领域的未来发展趋势具有重要价值。论文链接:https://arxiv.org/pdf/2309.07864.pdfLLM-basedAgent论文列表:

吞吐量提升5倍,联合设计后端系统和前端语言的LLM接口来了吞吐量提升5倍,联合设计后端系统和前端语言的LLM接口来了Mar 01, 2024 pm 10:55 PM

大型语言模型(LLM)被广泛应用于需要多个链式生成调用、高级提示技术、控制流以及与外部环境交互的复杂任务。尽管如此,目前用于编程和执行这些应用程序的高效系统却存在明显的不足之处。研究人员最近提出了一种新的结构化生成语言(StructuredGenerationLanguage),称为SGLang,旨在改进与LLM的交互性。通过整合后端运行时系统和前端语言的设计,SGLang使得LLM的性能更高、更易控制。这项研究也获得了机器学习领域的知名学者、CMU助理教授陈天奇的转发。总的来说,SGLang的

大模型也有小偷?为保护你的参数,上交大给大模型制作「人类可读指纹」大模型也有小偷?为保护你的参数,上交大给大模型制作「人类可读指纹」Feb 02, 2024 pm 09:33 PM

将不同的基模型象征为不同品种的狗,其中相同的「狗形指纹」表明它们源自同一个基模型。大模型的预训练需要耗费大量的计算资源和数据,因此预训练模型的参数成为各大机构重点保护的核心竞争力和资产。然而,与传统软件知识产权保护不同,对预训练模型参数盗用的判断存在以下两个新问题:1)预训练模型的参数,尤其是千亿级别模型的参数,通常不会开源。预训练模型的输出和参数会受到后续处理步骤(如SFT、RLHF、continuepretraining等)的影响,这使得判断一个模型是否基于另一个现有模型微调得来变得困难。无

FATE 2.0发布:实现异构联邦学习系统互联FATE 2.0发布:实现异构联邦学习系统互联Jan 16, 2024 am 11:48 AM

FATE2.0全面升级,推动隐私计算联邦学习规模化应用FATE开源平台宣布发布FATE2.0版本,作为全球领先的联邦学习工业级开源框架。此次更新实现了联邦异构系统之间的互联互通,持续增强了隐私计算平台的互联互通能力。这一进展进一步推动了联邦学习与隐私计算规模化应用的发展。FATE2.0以全面互通为设计理念,采用开源方式对应用层、调度、通信、异构计算(算法)四个层面进行改造,实现了系统与系统、系统与算法、算法与算法之间异构互通的能力。FATE2.0的设计兼容了北京金融科技产业联盟的《金融业隐私计算

220亿晶体管,IBM机器学习专用处理器NorthPole,能效25倍提升220亿晶体管,IBM机器学习专用处理器NorthPole,能效25倍提升Oct 23, 2023 pm 03:13 PM

IBM再度发力。随着AI系统的飞速发展,其能源需求也在不断增加。训练新系统需要大量的数据集和处理器时间,因此能耗极高。在某些情况下,执行一些训练好的系统,智能手机就能轻松胜任。但是,执行的次数太多,能耗也会增加。幸运的是,有很多方法可以降低后者的能耗。IBM和英特尔已经试验过模仿实际神经元行为设计的处理器。IBM还测试了在相变存储器中执行神经网络计算,以避免重复访问RAM。现在,IBM又推出了另一种方法。该公司的新型NorthPole处理器综合了上述方法的一些理念,并将其与一种非常精简的计算运行

制作莫比乌斯环,最少需要多长纸带?50年来的谜题被解开了制作莫比乌斯环,最少需要多长纸带?50年来的谜题被解开了Oct 07, 2023 pm 06:17 PM

自己动手做过莫比乌斯带吗?莫比乌斯带是一种奇特的数学结构。要构造一个这样美丽的单面曲面其实非常简单,即使是小孩子也可以轻松完成。你只需要取一张纸带,扭曲一次,然后将两端粘在一起。然而,这样容易制作的莫比乌斯带却有着复杂的性质,长期吸引着数学家们的兴趣。最近,研究人员一直被一个看似简单的问题困扰着,那就是关于制作莫比乌斯带所需纸带的最短长度?布朗大学RichardEvanSchwartz谈到,对于莫比乌斯带来说,这个问题没有解决,因为它们是「嵌入的」而不是「浸入的」,这意味着它们不会相互渗透或自我

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools