Home Technology peripherals AI A single card A100 can achieve millions of token inferences, which is 10 times faster. This is Microsoft's official large model inference acceleration.

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

Jul 12, 2024 pm 05:14 PM
project Sparse computing

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 of this Website
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

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)
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Will R.E.P.O. Have Crossplay?
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

The author of ControlNet has another hit! The whole process of generating a painting from a picture, earning 1.4k stars in two days The author of ControlNet has another hit! The whole process of generating a painting from a picture, earning 1.4k stars in two days Jul 17, 2024 am 01:56 AM

It is also a Tusheng video, but PaintsUndo has taken a different route. ControlNet author LvminZhang started to live again! This time I aim at the field of painting. The new project PaintsUndo has received 1.4kstar (still rising crazily) not long after it was launched. Project address: https://github.com/lllyasviel/Paints-UNDO Through this project, the user inputs a static image, and PaintsUndo can automatically help you generate a video of the entire painting process, from line draft to finished product. follow. During the drawing process, the line changes are amazing. The final video result is very similar to the original image: Let’s take a look at a complete drawing.

Topping the list of open source AI software engineers, UIUC's agent-less solution easily solves SWE-bench real programming problems Topping the list of open source AI software engineers, UIUC's agent-less solution easily solves SWE-bench real programming problems Jul 17, 2024 pm 10:02 PM

The AIxiv column is a column where this site publishes academic and technical content. In the past few years, the AIxiv column of this site has received more than 2,000 reports, covering top laboratories from major universities and companies around the world, effectively promoting academic exchanges and dissemination. If you have excellent work that you want to share, please feel free to contribute or contact us for reporting. Submission email: liyazhou@jiqizhixin.com; zhaoyunfeng@jiqizhixin.com The authors of this paper are all from the team of teacher Zhang Lingming at the University of Illinois at Urbana-Champaign (UIUC), including: Steven Code repair; Deng Yinlin, fourth-year doctoral student, researcher

Posthumous work of the OpenAI Super Alignment Team: Two large models play a game, and the output becomes more understandable Posthumous work of the OpenAI Super Alignment Team: Two large models play a game, and the output becomes more understandable Jul 19, 2024 am 01:29 AM

If the answer given by the AI ​​model is incomprehensible at all, would you dare to use it? As machine learning systems are used in more important areas, it becomes increasingly important to demonstrate why we can trust their output, and when not to trust them. One possible way to gain trust in the output of a complex system is to require the system to produce an interpretation of its output that is readable to a human or another trusted system, that is, fully understandable to the point that any possible errors can be found. For example, to build trust in the judicial system, we require courts to provide clear and readable written opinions that explain and support their decisions. For large language models, we can also adopt a similar approach. However, when taking this approach, ensure that the language model generates

From RLHF to DPO to TDPO, large model alignment algorithms are already 'token-level' From RLHF to DPO to TDPO, large model alignment algorithms are already 'token-level' Jun 24, 2024 pm 03:04 PM

The AIxiv column is a column where this site publishes academic and technical content. In the past few years, the AIxiv column of this site has received more than 2,000 reports, covering top laboratories from major universities and companies around the world, effectively promoting academic exchanges and dissemination. If you have excellent work that you want to share, please feel free to contribute or contact us for reporting. Submission email: liyazhou@jiqizhixin.com; zhaoyunfeng@jiqizhixin.com In the development process of artificial intelligence, the control and guidance of large language models (LLM) has always been one of the core challenges, aiming to ensure that these models are both powerful and safe serve human society. Early efforts focused on reinforcement learning methods through human feedback (RL

arXiv papers can be posted as 'barrage', Stanford alphaXiv discussion platform is online, LeCun likes it arXiv papers can be posted as 'barrage', Stanford alphaXiv discussion platform is online, LeCun likes it Aug 01, 2024 pm 05:18 PM

cheers! What is it like when a paper discussion is down to words? Recently, students at Stanford University created alphaXiv, an open discussion forum for arXiv papers that allows questions and comments to be posted directly on any arXiv paper. Website link: https://alphaxiv.org/ In fact, there is no need to visit this website specifically. Just change arXiv in any URL to alphaXiv to directly open the corresponding paper on the alphaXiv forum: you can accurately locate the paragraphs in the paper, Sentence: In the discussion area on the right, users can post questions to ask the author about the ideas and details of the paper. For example, they can also comment on the content of the paper, such as: "Given to

A significant breakthrough in the Riemann Hypothesis! Tao Zhexuan strongly recommends new papers from MIT and Oxford, and the 37-year-old Fields Medal winner participated A significant breakthrough in the Riemann Hypothesis! Tao Zhexuan strongly recommends new papers from MIT and Oxford, and the 37-year-old Fields Medal winner participated Aug 05, 2024 pm 03:32 PM

Recently, the Riemann Hypothesis, known as one of the seven major problems of the millennium, has achieved a new breakthrough. The Riemann Hypothesis is a very important unsolved problem in mathematics, related to the precise properties of the distribution of prime numbers (primes are those numbers that are only divisible by 1 and themselves, and they play a fundamental role in number theory). In today's mathematical literature, there are more than a thousand mathematical propositions based on the establishment of the Riemann Hypothesis (or its generalized form). In other words, once the Riemann Hypothesis and its generalized form are proven, these more than a thousand propositions will be established as theorems, which will have a profound impact on the field of mathematics; and if the Riemann Hypothesis is proven wrong, then among these propositions part of it will also lose its effectiveness. New breakthrough comes from MIT mathematics professor Larry Guth and Oxford University

Axiomatic training allows LLM to learn causal reasoning: the 67 million parameter model is comparable to the trillion parameter level GPT-4 Axiomatic training allows LLM to learn causal reasoning: the 67 million parameter model is comparable to the trillion parameter level GPT-4 Jul 17, 2024 am 10:14 AM

Show the causal chain to LLM and it learns the axioms. AI is already helping mathematicians and scientists conduct research. For example, the famous mathematician Terence Tao has repeatedly shared his research and exploration experience with the help of AI tools such as GPT. For AI to compete in these fields, strong and reliable causal reasoning capabilities are essential. The research to be introduced in this article found that a Transformer model trained on the demonstration of the causal transitivity axiom on small graphs can generalize to the transitive axiom on large graphs. In other words, if the Transformer learns to perform simple causal reasoning, it may be used for more complex causal reasoning. The axiomatic training framework proposed by the team is a new paradigm for learning causal reasoning based on passive data, with only demonstrations

The first Mamba-based MLLM is here! Model weights, training code, etc. have all been open source The first Mamba-based MLLM is here! Model weights, training code, etc. have all been open source Jul 17, 2024 am 02:46 AM

The AIxiv column is a column where this site publishes academic and technical content. In the past few years, the AIxiv column of this site has received more than 2,000 reports, covering top laboratories from major universities and companies around the world, effectively promoting academic exchanges and dissemination. If you have excellent work that you want to share, please feel free to contribute or contact us for reporting. Submission email: liyazhou@jiqizhixin.com; zhaoyunfeng@jiqizhixin.com. Introduction In recent years, the application of multimodal large language models (MLLM) in various fields has achieved remarkable success. However, as the basic model for many downstream tasks, current MLLM consists of the well-known Transformer network, which

See all articles