컴백부터 K-뷰티까지 — K-컬쳐의 모든 것을 메일로 받아보세요메일로 받아보기

METAL MEDIA

인텔 연구진이 파이토치 기본 기능만으로 BERT류 모델을 서버 CPU에서 최대 5.8배 빠르게 만들었다

arXiv:2608.181822026-08-20

Efficient INT8 Inference of Small NLP Models on Server CPUs with PyTorch Native Stack

인텔 연구진이 파이토치 기본 기능만으로 BERT류 모델을 서버 CPU에서 최대 5.8배 빠르게 만들었다

대형 언어모델이 주목받는 시대에도 BERT 계열의 작은 자연어처리 모델은 분류, 순위매기기, 검색 같은 실무 작업에 여전히 널리 쓰인다. 이 연구는 모델 숫자를 8비트 정수(INT8)로 압축해 속도를 높이는 SmoothQuant 기법을 별도 외부 도구 없이 파이토치 자체 컴파일러 스택에 직접 통합했다. 그 결과 인텔 제온 서버 CPU에서 정확도 손실은 거의 없이 처리량을 최대 5.8배까지 끌어올렸다.

METAL MEDIA 해설 도표

인텔 연구진이 파이토치 기본 기능만으로 BERT류 모델을 서버 CPU에서 최대 5.8배 빠르게 만들었다

  1. 01활성화값의 계산 난이도를 가중치 쪽으로 옮겨 INT8 압축을 쉽게 만드는 SmoothQuant 기법을, 파이토치 공식 양자화 라이브러리인 TorchAO에 통합해 외부 도구 없이 바로 쓸 수 있게 했다
  2. 02파이토치 컴파일러인 TorchInductor에 그래프 융합 기능을 추가해, INT8 행렬곱과 스케일 조정·편향 더하기 같은 후속 연산을 하나의 효율적인 연산으로 합치고 런타임에서 데이터 배치를 바꾸는 낭비를 없앴다
  3. 03AVX512_VNNI와 AMX(정수 연산을 빠르게 처리하는 인텔 CPU 전용 명령어 세트)를 활용한 저수준 커널을 직접 구현해, 구형 Ice Lake 칩과 신형 Granite Rapids 칩 모두에서 최적 속도를 내도록 했다
  4. 04특정 명령어 지원이 없는 Ice Lake CPU에서도 INT8 연산이 효율적으로 돌아가도록 s8s8에서 u8s8로 바꾸는 변환 기법을 고안했다
  5. 05BERT-large, DistilBERT, XLM-RoBERTa로 실험한 결과, 기존 32비트 부동소수점(FP32) 대비 Ice Lake에서는 처리량이 1.9~2.6배, Granite Rapids에서는 4.2~5.8배 향상됐고, SQuAD와 MultiNLI 과제에서 정확도 손실은 1% 미만이었다
METAL MEDIA이 원문을 바탕으로 재구성한 해설 도표이며, 논문 저자의 원문 figure가 아닙니다.

무엇을 했나

  1. 활성화값의 계산 난이도를 가중치 쪽으로 옮겨 INT8 압축을 쉽게 만드는 SmoothQuant 기법을, 파이토치 공식 양자화 라이브러리인 TorchAO에 통합해 외부 도구 없이 바로 쓸 수 있게 했다
  2. 파이토치 컴파일러인 TorchInductor에 그래프 융합 기능을 추가해, INT8 행렬곱과 스케일 조정·편향 더하기 같은 후속 연산을 하나의 효율적인 연산으로 합치고 런타임에서 데이터 배치를 바꾸는 낭비를 없앴다
  3. AVX512_VNNI와 AMX(정수 연산을 빠르게 처리하는 인텔 CPU 전용 명령어 세트)를 활용한 저수준 커널을 직접 구현해, 구형 Ice Lake 칩과 신형 Granite Rapids 칩 모두에서 최적 속도를 내도록 했다
  4. 특정 명령어 지원이 없는 Ice Lake CPU에서도 INT8 연산이 효율적으로 돌아가도록 s8s8에서 u8s8로 바꾸는 변환 기법을 고안했다
  5. BERT-large, DistilBERT, XLM-RoBERTa로 실험한 결과, 기존 32비트 부동소수점(FP32) 대비 Ice Lake에서는 처리량이 1.9~2.6배, Granite Rapids에서는 4.2~5.8배 향상됐고, SQuAD와 MultiNLI 과제에서 정확도 손실은 1% 미만이었다
Figure 1: SmoothQuant workflow built on TorchAO and TorchInductor. TorchAO prepares and quantizes the model, TorchInductor fuses INT8 subgraphs, and the CPP backend selects between oneDNN and template-based GEMM kernels. C++ code is generated and compiled for deployment.
Figure 1: SmoothQuant workflow built on TorchAO and TorchInductor. TorchAO prepares and quantizes the model, TorchInductor fuses INT8 subgraphs, and the CPP backend selects between oneDNN and template-based GEMM kernels. C++ code is generated and compiled for deployment.
Table 1: Hardware platforms used for baseline collection.
Xeon GenerationCodenameModelPhysical CoresInstruction Support
3rd GenIce Lake835864AVX512F, AVX512_VNNI
6th GenGranite Rapids6980P256AVX512F, AVX512_VNNI, AMX
Table 2: Baseline collection setup.
ItemValue
ModelBERT-large
Input shapeBatch size 1, sequence length 256
Precision modesFP32 on both platforms; BF16 on Granite Rapids
Launch strategyMulti-instance with weight-sharing on each socket
Cores per instance4
Number of instancesNumber of physical cores / 4
Deployment pathAOTI enabled
Input dataSynthetic
Table 3: Baseline hotspot breakdown for the BERT-large analysis case under the same multi-instance setup used for throughput benchmarking. Operator shares are aggregated from representative profiler logs. The linear-block consists of GEMM and fused post-operations such as bias addition, activation, and residual addition.
BaselineLinear-BlockAttentionLayerNormOther
FP32 on Ice Lake88.5%10.4%0.6%0.5%
FP32 on Granite Rapids86.9%11.8%0.8%0.5%
BF16 on Granite Rapids72.70%19.75%5.99%1.56%
Table 4: Estimated peak compute and measured memory bandwidth per socket, balance point for different data types on the evaluated platforms.
PlatformFP32 Throughput (TFLOPS)BF16 Throughput (TFLOPS)INT8 Throughput (TOPS)Memory Bandwidth (GB/s)FP32 Balance Point (FLOPs/byte)BF16 Balance Point (FLOPs/byte)INT8 Balance Point (OPs/byte)
Ice Lake6.76N/A27.03175.0038.63N/A154.46
Granite Rapids19.66262.14524.29700.0028.09374.49748.99
Table 5: BERT-large GEMM shapes and their arithmetic intensity.
Arithmetic Intensity (ops/byte)
GEMM Shape M × K × NOccurrences per forward passFP32BF16INT8
256×1024×10249685.33146.29227.56
256×1024×40962497.52163.84248.24
256×4096×10242497.52186.18341.33
Table 6: Effective memory bandwidth and balance point for INT8 GEMM on Granite Rapids.
GEMM ShapeEffective Memory Bandwidth (GB/s)Arithmetic Intensity (OPs/byte)Balance Point (OPs/byte)
256×1024×1024807.69227.56649.12
256×1024×4096819.15248.24640.04
256×4096×1024875.00341.33599.19
Table 7: Estimated GEMM throughput and speedup on Granite Rapids.
GEMM ShapeFP32 Throughput (TFLOPS)BF16 Throughput (TFLOPS)INT8 Throughput (TOPS)INT8 vs FP32 SpeedupINT8 vs BF16 Speedup
256×1024×102419.66102.40183.799.35×1.79×
256×1024×409619.66114.69203.3510.34×1.77×
256×4096×102419.66130.33298.6715.19×2.29×
Weighted Average19.66114.69218.8711.13×1.91×
Table 8: Models used for the performance benchmark.
ModelModel ID
BERT-largebert-large-uncased
DistilBERTdistilbert-base-uncased
XLM-RoBERTaxlm-roberta-base
Table 9: Task-finetuned checkpoints used for accuracy evaluation. The model marked by * is finetuned on SQuAD 2.0 but still workable for the test on SQuAD 1.1.
DatasetModelModel ID
SQuAD 1.1BERT-largegoogle-bert/bert-large-uncased-whole-word-masking-finetuned-squad
SQuAD 1.1DistilBERTdistilbert/distilbert-base-cased-distilled-squad
SQuAD 1.1XLM-RoBERTadeepset/xlm-roberta-base-squad2*
MultiNLIBERT-largeyoshitomo-matsubara/bert-large-uncased-mnli
MultiNLIDistilBERTtypeform/distilbert-base-uncased-mnli
MultiNLIXLM-RoBERTasymanto/xlm-roberta-base-snli-mnli-anli-xnli
Table 10: Quantization methods used in the experiments.
MethodShort Name
No quantization, no AMPFP32
No quantization, with AMPBF16
SmoothQuant, static quantizationSmooth-Static
SmoothQuant, dynamic quantizationSmooth-Dynamic
Table 11: INT8 speedup over FP32 on Ice Lake.
ModelMethodThroughput SpeedupLinear-Block Speedup
BERT-largeSmooth-Dynamic2.22×3.59×
BERT-largeSmooth-Static2.58×3.87×
DistilBERTSmooth-Dynamic1.90×3.31×
DistilBERTSmooth-Static2.30×3.35×
XLM-RoBERTaSmooth-Dynamic1.86×3.05×
XLM-RoBERTaSmooth-Static2.17×3.71×
Table 12: INT8 speedup over FP32 on Granite Rapids.
ModelMethodThroughput SpeedupLinear-Block Speedup
BERT-largeSmooth-Dynamic5.02×9.92×
BERT-largeSmooth-Static5.82×8.67×
DistilBERTSmooth-Dynamic4.24×7.60×
DistilBERTSmooth-Static5.37×8.84×
XLM-RoBERTaSmooth-Dynamic4.17×7.58×
XLM-RoBERTaSmooth-Static5.41×8.71×
Table 13: INT8 speedup over BF16 on Granite Rapids.
ModelMethodThroughput SpeedupLinear-Block Speedup
BERT-largeSmooth-Dynamic1.37×1.84×
BERT-largeSmooth-Static1.59×1.61×
DistilBERTSmooth-Dynamic0.98×1.45×
DistilBERTSmooth-Static1.24×1.69×
XLM-RoBERTaSmooth-Dynamic0.99×1.50×
XLM-RoBERTaSmooth-Static1.29×1.67×
Table 14: Realized speedup of BERT-large over estimated speedup ceiling on both evaluated platforms.
Throughput SpeedupLinear-Block Speedup
PlatformMethodBaselineRealizedEstimatedGapRealizedEstimatedGap
Ice LakeSmooth-DynamicFP322.22×3.15×29.59%3.59×4.00×10.22%
Ice LakeSmooth-StaticFP322.58×3.15×18.17%3.87×4.00×3.21%
Granite RapidsSmooth-DynamicFP325.02×7.06×28.89%9.92×11.13×10.89%
Granite RapidsSmooth-StaticFP325.82×7.06×17.56%8.67×11.13×22.12%
Granite RapidsSmooth-DynamicBF161.37×1.53×10.41%1.84×1.91×3.58%
Granite RapidsSmooth-StaticBF161.59×1.53×-3.98%1.61×1.91×15.64%
Table 15: Accuracy results on Granite Rapids.
ModelMetricFP32BF16Smooth-StaticAlphaLossSmooth-DynamicAlphaLoss
BERT-largeSQuAD F192.6492.6792.660.60.0%92.630.60.0%
BERT-largeSQuAD EM86.4186.4586.490.6-0.1%86.440.60.0%
BERT-largeMultiNLI Accuracy64.5564.5864.730.7-0.3%64.520.60.0%
DistilBERTSQuAD F186.3986.4186.000.70.5%86.400.60.0%
DistilBERTSQuAD EM79.0279.0478.490.70.7%79.040.60.0%
DistilBERTMultiNLI Accuracy82.2182.1682.260.8-0.1%82.170.60.0%
XLM-RoBERTaSQuAD F176.4376.3476.470.55-0.1%76.590.6-0.2%
XLM-RoBERTaSQuAD EM69.9569.8970.040.55-0.1%70.300.6-0.5%
XLM-RoBERTaMultiNLI Accuracy82.2682.2382.310.7-0.1%82.260.60.0%

왜 중요한가

많은 기업이 검색 순위 매기기, 텍스트 분류 같은 일상적인 작업에는 여전히 저렴한 CPU에서 돌아가는 작은 NLP 모델을 쓴다. 이 기술이 별도 플러그인 없이 파이토치 표준 기능만으로 제공되면, 어떤 팀이든 코드를 크게 바꾸지 않고도 몇 배 빠르고 저렴한 추론을 얻을 수 있다.

이 논문의 용어

  • INT8 양자화 · 숫자를 32비트 대신 8비트 정수로 저장·계산해 속도는 빨라지지만 정확도가 떨어질 수 있는 압축 기법
  • SmoothQuant · 활성화값과 가중치 사이의 수치 균형을 조정해 INT8 압축 시 정확도 손실을 줄이는 기법
  • TorchAO · 모델에 양자화 등 저정밀 기법을 적용하는 파이토치 공식 라이브러리
  • TorchInductor · 파이토치 2에서 모델 연산 그래프를 최적화하고 빠른 코드를 생성하는 컴파일러 백엔드
  • GEMM · 신경망 계층 내부에서 반복되는 핵심 연산인 행렬곱셈
  • AVX512_VNNI / AMX · 인텔 제온 CPU에 내장된, INT8 정수 연산 속도를 높이는 전용 명령어 세트
  • 루프라인 모델 · 연산이 프로세서 속도에 의해 제한되는지 메모리 대역폭에 의해 제한되는지를 분석하는 성능 평가 방법

저자 · Weiwen Xia, Yuxin Cui, E Cao

arXiv에서 원문 보기

최신 논문

논문 전체 보기 →

METAL MEDIA 최신 기사

그림 출처: Weiwen Xia et al., arXiv:2608.18182, CC BY 4.0