Skip to main content
QUICK REVIEW

[논문 리뷰] FP8 versus INT8 for efficient deep learning inference

Mart van Baalen, Andrey N. Kuzmin|arXiv (Cornell University)|2023. 03. 31.
Ferroelectric and Negative Capacitance Devices인용 수 24
한 줄 요약

논문은 FP8 vs INT8의 현장(on-device) 추론 효율성을 분석하며, FP8가 일반적으로 하드웨어 효율 및 정확도 측면에서 INT8보다 불리한 경우가 많고, 특정 외삽치(outlier)가 많은 트랜스포머의 경우를 제외하면 대체로 INT8이 추론 효율성 측면에서 바람직한 선택으로 남아 있다.

ABSTRACT

Recently, the idea of using FP8 as a number format for neural network training has been floating around the deep learning world. Given that most training is currently conducted with entire networks in FP32, or sometimes FP16 with mixed-precision, the step to having some parts of a network run in FP8 with 8-bit weights is an appealing potential speed-up for the generally costly and time-intensive training procedures in deep learning. A natural question arises regarding what this development means for efficient inference on edge devices. In the efficient inference device world, workloads are frequently executed in INT8. Sometimes going even as low as INT4 when efficiency calls for it. In this whitepaper, we compare the performance for both the FP8 and INT formats for efficient on-device inference. We theoretically show the difference between the INT and FP formats for neural networks and present a plethora of post-training quantization and quantization-aware-training results to show how this theory translates to practice. We also provide a hardware analysis showing that the FP formats are somewhere between 50-180% less efficient in terms of compute in dedicated hardware than the INT format. Based on our research and a read of the research field, we conclude that although the proposed FP8 format could be good for training, the results for inference do not warrant a dedicated implementation of FP8 in favor of INT8 for efficient inference. We show that our results are mostly consistent with previous findings but that important comparisons between the formats have thus far been lacking. Finally, we discuss what happens when FP8-trained networks are converted to INT8 and conclude with a brief discussion on the most efficient way for on-device deployment and an extensive suite of INT8 results for many models.

연구 동기 및 목표

  • 온-디바이스 추론에 대한 INT8의 잠재적 대안으로 FP8 평가를 추진한다.
  • 표준 DL 가속기에서 FP8 vs INT8의 하드웨어 면적과 에너지 영향력을 정량화한다.
  • 다양한 모델에서 PTQ와 QAT 성능을 평가한다.
  • FP8 vs INT8의 트레이드오프를 고려한 온-디바이스 배포 전략에 대한 지침을 제공한다.

제안 방법

  • FP8 형식을 4 또는 5 비트 지수로 정의하고(FP8-E4, FP8-E5), 이를 INT8과 하드웨어 및 정확도 측면에서 비교한다.
  • 누적기 구현을 이론적으로 분석하고(Fixed-point Kulisch 대 Floating-point) 게이트 수/면적에 대한 영향을 추정한다.
  • 다양한 모델(CV, NLP, 분할, 3D)에 걸친 PTQ 및 QAT 실험을 실시하여 정확도를 비교한다.
  • 가중치/활성화 분포의 이상치가 양자화 성능에 미치는 영향을 검토한다.
  • FP8-학습 네트워크를 INT8로 변환하여 변환 이후 정확도 영향력을 평가한다.
Figure 1 : A schematic overview of a deep learning accelerator. Weights and activations are stored in memory and moved to the MatMul calculation unit. The bit-width matters for both latency and energy consumed for transferring the data. The calculation unit does a matrix multiplication; here, both t
Figure 1 : A schematic overview of a deep learning accelerator. Weights and activations are stored in memory and moved to the MatMul calculation unit. The bit-width matters for both latency and energy consumed for transferring the data. The calculation unit does a matrix multiplication; here, both t

실험 결과

연구 질문

  • RQ1FP8(다양한 지수 비트 포함)이 온-디바이스 추론에서 하드웨어 효율성(면적/전력) 측면에서 INT8과 어떻게 비교되는가?
  • RQ2어떤 포맷(INT8 vs FP8-E4/FP8-E3/FP8-E2)이 PTQ와 QAT에서 일반적인 DL 작업에 대해 가장 우수한 추론 정확도를 제공하는가?
  • RQ3실무에서 FP8 네트워크는 경쟁력 있는 성능을 달성하기 위해 특별한 처리(예: 트랜스포머 특화 조정)가 필요한가?
  • RQ4FP8-학습 네트워크를 INT8로 변환하는 것이 배포에 어떤 함의를 가지는가?
  • RQ5실세계 엣지 배포에서 FP8이 학습(그래디언트)보다는 추론에 더 적합한가?

주요 결과

  • FP8-E4는 INT8에 비해 하드웨어 비용이 크게 증가하며, FP8-E4가 FP32 또는 FP16 누적을 사용할 때 유사한 누적기 기준으로 게이트 수가 INT8의 50% 이상 더 필요하다.
  • 활성화 대역폭이 지배적인 네트워크의 경우 FP16/FP8 활성화가 병목이 되어 FP8의 속도 향상이 INT8 대비 감소할 수 있다.
  • PTQ 결과는 잘 동작하는(가우시안 유사한) 네트워크에서 INT8이 종종 FP8-E4/E5보다 우수한 반면, FP8-E4/E5는 이상치가 많은 네트워크(예: 일부 트랜스포머 계층)에서 우수점을 보일 수 있다.
  • QAT 결과는 대개 포맷 간 FP32 성능 회복을 보이며, 많은 CV 네트워크에서 INT8이 최상의 결과를 제공하는 경우가 많고 FP8-E3가 종종 FP8-E4보다 우수한 경우가 많다.
  • 대부분의 네트워크에서 FP8-E5는 추론에 선호되지 않으며, QAT 이후 FP8-E4가 최상의 선택인 경우는 드물다; INT8 또는 FP8-E3/E2가 더 견고한 정확도를 제공한다.
  • W4A8(4비트 가중치, 8비트 활성화)은 경우에 따라 FP8-E4와 일치하거나 이를 초과할 수 있어 저정밀 포맷으로의 효율 향상을 시사한다.
  • FP8-E4로 학습된 모델을 INT8로 변환하면 일부 아키텍처에서 정확도가 유지되거나 소폭 향상될 수 있어, 경쟁력 있는 INT8 성능을 위해 FP8 학습이 반드시 필요하지 않을 수 있음을 시사한다.
(a) Fixed-point accumulation
(a) Fixed-point accumulation

더 나은 연구,지금 바로 시작하세요

논문 읽기부터 검토까지, 연구 시간을 획기적으로 줄여보세요.

카드 등록 없음 · 무료 플랜 제공

이 리뷰는 AI가 만들고, 인간 에디터가 검토했습니다.