> For the complete documentation index, see [llms.txt](https://paper.lingyunyang.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://paper.lingyunyang.com/reading-notes/miscellaneous/arxiv/2023/flexgen.md).

# High-throughput generative inference of large language models with a single GPU

## Meta Info

Presented in [arxiv:2303.06865](https://arxiv.org/abs/2303.06865). (Accepted in ICML 2023)

Authors: Ying Sheng (*Stanford*), Lianmin Zheng (*UC Berkeley*), Binhang Yuan (*ETH*), Zhuohan Li (*UC Berkeley*), Max Ryabinin (*Yandex & HSE University*), Daniel Y. Fu, Zhiqiang Xie (*Stanford*), Beidi Chen (*Meta & CMU*), Clark Barrett (*Stanford*), Joseph E. Gonzalez (*UC Berkeley*), Percy Liang, Christopher Ré (*Stanford*), Ion Stoica (*UC Berkeley*), Ce Zhang (*ETH*).

Code: <https://github.com/FMInference/FlexGen>

## Understanding the paper

### TL;DRs

This paper presents **FlexGen**, *an offloading framework* for *high-throughput LLM inference*.\
It *aggregates memory* from the *GPU, CPU, and disk*, and efficiently *schedules I/O operations*, along with *possible compression methods* and *distributed pipeline parallelism*.

### Evaluation

* NVIDIA T4 GPU instances from Google Cloud.
  * GPU: NVIDIA T4, 16 GB
  * CPU: Intel Xeon @ 2.00GHz, 208 GB
  * Disk: Cloud default SSD (NVMe), 1.5 TB
* Model
  * [OPT](https://ai.facebook.com/blog/democratizing-access-to-large-scale-language-models-with-opt-175b/) models with 6.7B to 175 parameters.
* Baseline
  * DeepSpeed-Inference

### Implementation

* Implemented on top of **PyTorch**.
* Manage *multiple CUDA streams* and *CPU threads* to overlap I/O with compute.
* Create files for tensors stored on the disk and maps them as virtual memory.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://paper.lingyunyang.com/reading-notes/miscellaneous/arxiv/2023/flexgen.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
