AirLLM은 4GB GPU 하나로 70B LLM 추론을 가능하게 합니다

개요

AirLLM은 한 번에 하나의 모델 레이어만 디바이스에 유지함으로써 소비자용 GPU에서도 매우 큰 언어 모델을 실행할 수 있게 합니다.

AirLLM 작동 방식

이 라이브러리는 모델을 개별 레이어로 분할하고, 계산에 필요할 때만 디스크에서 GPU로 해당 레이어를 스트리밍합니다. 따라서 VRAM 요구량은 전체 파라미터 수가 아니라 가장 큰 레이어의 크기에 의해 결정됩니다.

지원 모델 및 VRAM 요구 사항

AirLLM은 다양한 오픈 LLM을 지원합니다. 아래 표는 기본(압축 없음) 모드 사용 시 각 모델에 필요한 대략적인 VRAM을 보여줍니다:

  • Qwen3, Mistral, Phi (≈8 B) – ~1–2 GB
  • Qwen3‑30B, Mixtral (MoE) – ~1–3 GB
  • Qwen3‑235B (MoE) – ~3 GB
  • Llama 3.x 70B (전체 정밀도) – ~4 GB
  • Llama 3.1 405B – ~8 GB
  • DeepSeek‑V3 (671 B) – ~12 GB
  • Kimi K3 (2.8 T) – RTX 6000 Ada에서 측정된 ~3.72 GB VRAM (추가 종속성 필요)

성능 특성

기본 모드로 모델을 실행하면 각 토큰마다 레이어를 디스크에서 로드하기 때문에 지연 시간이 높습니다. 라이브러리는 선택적인 블록‑단위 압축을 제공하며, 이는 정확도 손실이 거의 없으면서 추론 속도를 최대 3배까지 높일 수 있습니다. RTX 6000 Ada에서 Kimi K3에 대해 사용자가 보고한 측정값은 토큰당 약 292 초입니다.

설정 및 사용법

  1. 패키지 설치: pip install airllm.
  2. AutoModel.from_pretrained(<repo_id>) 로 모델 초기화.
  3. (선택) 압축 활성화: compression='4bit' 또는 compression='8bit' 를 추가하고 bitsandbytes 가 설치되어 있는지 확인.
  4. (선택) 게이트된 모델을 위해 hf_token 인자로 Hugging Face 토큰 제공.
  5. (선택) layer_shards_saving_path 로 분할 레이어 저장 위치 지정.
  6. (선택) profiling_mode=True 로 타이밍 분해 보기.
  7. 빠른 시작 예시와 같이 생성 실행.

Note: The first run decomposes the model and saves layer shards, so sufficient free disk space in the Hugging Face cache directory is required.

플랫폼 지원

  • Linux 및 Windows: 표준 PyTorch 설치.
  • macOS: Apple Silicon만 지원; macOS 섹션에 설명된 대로 mlxtorch를 설치해야 합니다.

제한 사항 및 트레이드‑오프

  • 지연 시간: 레이어‑별 스트리밍으로 인터랙티브 채팅이 느려지며, 배치 또는 야간 작업에 더 적합합니다.
  • 디스크 사용량: 모든 레이어 샤드를 저장하면 상당한 공간이 필요합니다; delete_original=True 를 활성화하면 변환된 버전만 남길 수 있습니다.
  • 기본적으로 양자화 없음: 기본 접근 방식은 정확도 유지를 위해 양자화를 피합니다; 압축은 선택적 추가 기능입니다.
  • 특정 모델(e.g., Kimi K3)에는 compressed-tensors, flash-attn, CUDA 12 빌드 PyTorch, transformers 4.56.x 등 추가 요구 사항이 있습니다.

커뮤니티 관점

Hacker News의 댓글자들은 흥미와 실용적 우려를 동시에 강조했습니다:

  • "Kimi K3 on RTX 6000 Ada (48GB) takes 292 s/token" – @imenani
  • "Seeing a lot of these ‘run 1TB models with 1GB RAM’ projects recently. Most seem vibe coded and probably won’t be maintained." – @roger_
  • "I love it how the rampocalypse is pushing people to squash all the performance they can. I hope that this also leads to rethinking model architecture." – @seu
  • "I’m still slightly confused on what this adds… Does this basically load layers in and out on demand? So I still have to download the full model to disk…" – @cpfohl
  • "You can run any frontier model on your PC if you just wait long enough…" – @xg15
  • "The layer‑by‑layer streaming is clever. Curious how the throughput compares to running a quantized model on the same GPU — seems like quantization might still win on speed?" – @junsu22
  • "‘Can run’ and ‘is useful interactively’ are different benchmarks. At this latency, I can still imagine batch or overnight jobs being interesting; for chat, time to first useful answer matters much more…" – @Alisaqqt

이러한 의견은 AirLLM이 인상적인 메모리 효율성을 달성했지만, 결과적인 지연 시간이 인터랙티브 사용을 제한하고 llama.cpp나 unsloth와 같은 양자화 추론 엔진과의 비교를 촉발한다는 점을 강조합니다.

Sources

관련