Transformers documentation

AutoRound

You are viewing main version, which requires installation from source. If you'd like regular pip install, checkout the latest stable version (v5.22.2).
Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

AutoRound

AutoRound는 2-bit 정밀도에서도 높은 정확도를 제공하는 고급 양자화 알고리즘입니다. 부호 기하급수적 감소(sign gradient descent)를 활용하여 반올림 값과 min-max 클리핑 임계값을 단 200단계로 미세 조정합니다. 광범위한 호환성을 위해 설계되어 다양한 LLM을 원활하게 지원하며, 더 많은 VLM을 포괄하도록 지속적으로 확장되고 있습니다. 또한 CPU, XPU, CUDA를 포함한 여러 하드웨어 플랫폼에서 양자화 및 추론을 지원합니다.

AutoRound은 자동 혼합 비트 튜닝 및 추론, MXFP4 및 NVFP4 데이터 유형 지원, 모델 없이 수행되는 양자화, GPTQ, AWQ, GGUF, LLM-Compressor와 같은 형식으로 내보내기, 유연한 튜닝 레시피 등 다양한 유용한 기능을 제공합니다. 포괄적인 개요와 최신 업데이트는 AutoRound README를 확인하세요.

AutoRound은 Intel Neural Compressor의 일부로 처음 개발되었으며, 딥러닝을 위한 범용 모델 압축 라이브러리로 기능했습니다. 이후에는 대규모 언어 모델(LLM)의 저정밀도 최적화에 특화된 독립형 라이브러리로 발전했습니다. AutoRound는 여전히 Intel Neural Compressor와 완전히 통합되어 있으며, 자세한 내용은 저장소를 참고하세요.

설치

pip install auto-round

지원되는 양자화 구성

AutoRound은 다음 양자화 구성을 지원합니다:

  1. INT2–INT8 가중치 전용
  2. 혼합 비트 가중치 전용
  3. GGUF Q*_K
  4. MXFP (제한된 지원)
  5. NVFP4 (제한된 지원)

하드웨어 호환성

양자화 및 추론 모두에 CPU, XPU, CUDA를 지원합니다.

양자화 및 직렬화(오프라인)

현재 양자화 모델 생성에는 오프라인 모드만 지원됩니다.

quantization cmd
auto scheme cmd
The input "alg combinations" is a fragment, likely a heading or label. "alg" is a common abbreviation for "algorithm". In a technical context, this would be translated as "알고리즘 조합" (algorithm combinations).
quantization auto-round api
quantization auto-round-best
quantization auto-round-light

명령줄 사용

auto-round \
    --model Qwen/Qwen3-0.6B \
    --scheme "W4A16" \
    --group_size 128 \
    --output_dir ./tmp_autoround

AutoRound는 최적의 정확도와 향상된 속도를 위해 각각 설계된 auto-round-best, auto-round-light, auto-round-opt-rtn, auto-round-rtn의 네 가지 레시피를 추가로 제공합니다. 2비트인 경우 auto-round-best를 --enable_alg_ext와 함께 사용하는 것을 권장합니다.

W4G128의 13개 작업(mmlu-pro, if_eval, gsm8k 등)의 평균 정확도 및 시간 비용 결과(테스트는 enable_torch_compile이 활성화된 PyTorch 2.6.0 버전으로 Nvidia A100 80G에서 수행됨):

모델Qwen2.5-0.5B-InstructFalcon3-3BQwen2.5-7B-InstructMeta-Llama-3.1-8B-InstructFalcon3-10BQwen2.5-72B-Instruct
16bits0.41920.52030.64700.62120.61510.7229
최고0.4137(7m)0.5142(23m)0.6426(58m)0.6116(65m)0.6092(81m)0.7242(575m)
기본값0.4129(2m)0.5133(6m)0.6441(13m)0.6106(13m)0.6080(18m)0.7252(118m)
라이트0.4052(2m)0.5108(3m)0.6453(5m)0.6104(6m)0.6063(6m)0.7243(37m)

추론

AutoRound은 설치된 라이브러리를 기반으로 가장 적합한 백엔드를 자동으로 선택하며, 더 나은 백엔드가 발견되면 사용자에게 추가 라이브러리 설치를 안내합니다.

추론 cpu
추론 xpu
inference cuda
추론 백엔드
형식 변환

CPU

2, 4, 8 비트를 지원합니다. 추론에는 AutoRound Kernel(ARK) 백엔드를 사용하는 것을 권장합니다. ARK를 사용하려면 PyTorch 2.8.0 이상이 필요합니다.

from transformers import AutoModelForCausalLM, AutoTokenizer

model_name = "OPEA/Qwen2.5-1.5B-Instruct-int4-sym-inc"
model = AutoModelForCausalLM.from_pretrained(model_name, device_map="cpu", dtype="auto")
tokenizer = AutoTokenizer.from_pretrained(model_name)
text = "There is a girl who likes adventure,"
inputs = tokenizer(text, return_tensors="pt").to(model.device)
print(tokenizer.decode(model.generate(**inputs, max_new_tokens=50, do_sample=False)[0]))

이슈

transformers 통합에서 문제가 발생하면 transformers 저장소에 이슈를 등록해 주세요.
auto-round에서 문제가 발생하면 AutoRound 저장소에 이슈를 등록해 주세요.

감사

AutoGPTQ, AutoAWQ, GPTQModel, Triton, Marlin, ExLLaMAV2와 같은 오픈소스 저정밀 라이브러리가 AutoRound에서 활용되는 저정밀 CUDA 커널을 제공해 주셔서 특별히 감사드립니다.

기여

AutoRound에 대한 기여를 환영하며, 매우 감사드립니다! 버그 수정, 문서 개선, 새로운 기능 추가, 개선 사항 제안 등 어떤 도움도 항상 소중히 여깁니다.

Update on GitHub