# \[GN\] PowerInfer - 소비자용 GPU를 사용해서 빠르게 LLM 서빙하기

**URL:** <https://discuss.pytorch.kr/t/gn-powerinfer-gpu-llm/3088>\
**Category:** 읽을거리&정보공유\
**Tags:** gguf, ggml, llamacpp, falcon, geeknews, llm-framework, llm-in-production, powerinfer\
**Created:** [12월 21, 2023, 2:32오전 UTC](https://discuss.pytorch.kr/t/gn-powerinfer-gpu-llm/3088 "2023-12-21T02:32:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![9bow](https://discuss.pytorch.kr/user_avatar/discuss.pytorch.kr/9bow/32/16301_2.png) [@9bow](https://discuss.pytorch.kr/u/9bow)\
**Post date:** [12월 21, 2023, 2:32오전 UTC](https://discuss.pytorch.kr/t/gn-powerinfer-gpu-llm/3088/1 "2023-12-21T02:32:55Z")

</div>

_[GeekNews](https://news.hada.io/?utm_source=pytorchkr)의 [xguru](https://news.hada.io/user?id=xguru&utm_source=pytorchkr)님께 허락을 받고 GN에 올라온 글들 중에 AI 관련된 소식들을 공유하고 있습니다. 😺_

* * *

## 소개

![[GN] PowerInfer - 소비자용 GPU를 사용해서 빠르게 LLM 서빙하기](https://discuss.pytorch.kr/uploads/default/original/2X/9/950c4bf9abe4167c31d7aca516fab5fba375d5e7.gif)

- RTX 4090(24G)에서 Falcon(ReLU)-40B-FP16 실행시 llama.cpp 보다 11배 빠름

- 기기의 Activation Locality를 활용하는 CPU/GPU 하이브리드 LLM 추론엔진

- 적응형 예측기와 뉴런 인식 희소 연산자를 통합하여 뉴런 활성화와 계산 희소성의 효율성을 최적화

- 단일 NVIDIA RTX 4090 GPU에서 다양한 LLM(OPT-175B 포함)에 걸쳐 평균 13.20 토큰/초, 최고 29.08 토큰/초의 토큰 생성 속도를 달성

## 모델 가중치 (Model Weights)

PowerInfer 모델은 LLM 가중치와 예측자 가중치로 구성된 GGUF 형식을 기반으로 하는 _PowerInfer GGUF_라는 특수 포맷으로 저장됩니다.

### Download PowerInfer GGUF via Hugging Face

아래 `*.powerinfer.gguf`에서 PowerInfer GGUF 가중치와 '핫' 뉴런 오프로딩에 대한 프로파일링된 모델 활성화 통계를 각 허깅 페이스 리포지토리에서 얻을 수 있습니다.

| Base Model | PowerInfer GGUF |
| --- | --- |
| LLaMA(ReLU)-2-7B | [PowerInfer/ReluLLaMA-7B-PowerInfer-GGUF](https://huggingface.co/PowerInfer/ReluLLaMA-7B-PowerInfer-GGUF) |
| LLaMA(ReLU)-2-13B | [PowerInfer/ReluLLaMA-13B-PowerInfer-GGUF](https://huggingface.co/PowerInfer/ReluLLaMA-13B-PowerInfer-GGUF) |
| Falcon(ReLU)-40B | [PowerInfer/ReluFalcon-40B-PowerInfer-GGUF](https://huggingface.co/PowerInfer/ReluFalcon-40B-PowerInfer-GGUF) |
| LLaMA(ReLU)-2-70B | [PowerInfer/ReluLLaMA-70B-PowerInfer-GGUF](https://huggingface.co/PowerInfer/ReluLLaMA-70B-PowerInfer-GGUF) |

전체 리포지토리를 다운로드/복제하여 PowerInfer가 자동으로 이러한 디렉터리 구조를 사용하여 기능을 갖춘 모델을 오프로드할 수 있도록 하는 것이 좋습니다:

```auto
.
├── *.powerinfer.gguf (Unquantized PowerInfer model)
├── *.q4.powerinfer.gguf (INT4 quantized PowerInfer model, if available)
├── activation (Profiled activation statistics for fine-grained FFN offloading)
│ ├── activation_x.pt (Profiled activation statistics for layer x)
│ └── ...
├── *.[q4].powerinfer.gguf.generated.gpuidx (Generated GPU index at runtime for corresponding model)

```

### 원래 모델 가중치 + 예측자 가중치에서 변환하기

Hugging Face는 단일 모델 가중치를 50GiB로 제한합니다. 정량화되지 않은 모델 \>= 40B의 경우, 원래 모델 가중치와 허깅 페이스에서 얻은 예측자 가중치에서 PowerInfer GGUF를 변환할 수 있습니다.

| Base Model | Original Model | Predictor |
| --- | --- | --- |
| LLaMA(ReLU)-2-7B | [SparseLLM/ReluLLaMA-7B](https://huggingface.co/SparseLLM/ReluLLaMA-7B) | [PowerInfer/ReluLLaMA-7B-Predictor](https://huggingface.co/PowerInfer/ReluLLaMA-7B-Predictor) |
| LLaMA(ReLU)-2-13B | [SparseLLM/ReluLLaMA-13B](https://huggingface.co/SparseLLM/ReluLLaMA-13B) | [PowerInfer/ReluLLaMA-13B-Predictor](https://huggingface.co/PowerInfer/ReluLLaMA-13B-Predictor) |
| Falcon(ReLU)-40B | [SparseLLM/ReluFalcon-40B](https://huggingface.co/SparseLLM/ReluFalcon-40B) | [PowerInfer/ReluFalcon-40B-Predictor](https://huggingface.co/PowerInfer/ReluFalcon-40B-Predictor) |
| LLaMA(ReLU)-2-70B | [SparseLLM/ReluLLaMA-70B](https://huggingface.co/SparseLLM/ReluLLaMA-70B) | [PowerInfer/ReluLLaMA-70B-Predictor](https://huggingface.co/PowerInfer/ReluLLaMA-70B-Predictor) |

 ![PowerInfer - Evaluation: PowerInfer vs. llama.cpp](https://discuss.pytorch.kr/uploads/default/original/2X/6/6ca70410f708eb14057471e71a567289a9ac5bef.png)  
 ![PowerInfer - Evaluation: PowerInfer vs. llama.cpp](https://discuss.pytorch.kr/uploads/default/original/2X/2/2cc535f5154323a1a0868c4a651ba76dfadd6072.png)

## 원문

[https://github.com/SJTU-IPADS/PowerInfer](https://github.com/SJTU-IPADS/PowerInfer)

## 출처 / [GeekNews](https://news.hada.io/topic?id=12457)

> **[PowerInfer - 소비자용 GPU를 사용해서 빠르게 LLM 서빙하기 | GeekNews](https://news.hada.io/topic?id=12457)**
>
> RTX 4090(24G)에서 Falcon(ReLU)-40B-FP16 실행시 llama.cpp 보다 11배 빠름기기의 Activation Locality를 활용하는 CPU/GPU 하이브리드 LLM 추론엔진일관되게 활성화되는 일부의 핫뉴런, 특정 입력에 따라 달라지는 대다수의 콜드뉴런으로 구분핫 뉴런은 GPU에 미리 로드하여 빠르게 활성화, 콜드 뉴런은 CPU
