当前位置:首页 > 报告详情

NVIDIA 的 BERT 量化方法与工具.pdf

上传人: li 编号:29479 2021-02-07 54页 1.17MB

1、NVIDIAQUANTIZATION METHODS AND TOOLSFOR BERTHongxiaoBai,2020/12#page#AGENDAINT8 inference and quantizationBasic conceptsQuantization and calibration methodsMethods to determine scales and weightsWorkflow and network structureHow to quantize a model (BERT)Results and further improvementAbout accuracy

2、 and performance#page#INT8 INFERENCEAND QUANTIZATION#page#INT8 INFERENCEWhy need INT8 inferenceNowadays, the latency and throughput of inference is criticalThe complexity of models is increasing exponentially, such as BERTINT8 can speed up inference greatly:NVIDIAT4NVIDIA A100 Speed up computation31

3、2TFLOPSPeak FP16 Tensor Core65TFLOPSUp to 2X peak performance speedup compared with FP16Speed up memory access130 TOPS624TOPSPeak INT8 Tensor CoreHalf the bandwidth requirement compared with FP16#page#INT8 INFERENCEHow to do INT8 inferenceIf we want to do inference in INT8 precision, we need:Do quan

4、tization to get a model that can be inferenced in INT8 precisionThis talk focuses on this, especially for BERTDo inference with the quantized modelICNS20306The INT8 Quantization of FasterTransformer3.0 EncoderImplementtation andinference details of BERTINT8inference in FasterTransformer3.0#page#QUAN

5、TIZATIONWhy need quantization-Weights and activations are float numbers in a small rangeUnlike FP32-FP16,it cannot be directly cast from FP32/FP16 to INT8Dynamic rangeMin positive valueFP32-3.4*1033.4*10351.4*104FP16-65504-655045.96*103INI-128-1271Quantization:convert float model to INT8 without sii

6、gniffiicant accuracy loss#page#QUANTIZATIONWhatisquantization-Quantize: map the FLOAT values to discrete INT values using linear/non-linear scaling techniques.Dequantize: recover FLOAT values from INT values.Quantization object:convert from high precision to low precision with minimal information lo

word格式文档无特别注明外均可编辑修改,预览文件经过压缩,下载原文更清晰!
三个皮匠报告文库所有资源均是客户上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作商用。
本文主要介绍了FasterTransformer 3.0编码器中INT8量化的原理和策略,以及如何使用cuBLASLt和INT8张量核来加速实现。主要内容包括: 1. INT8量化的基本概念和策略,包括对称和非对称量化,以及按张量和按通道量化。 2. 量化方法,包括后训练量化(PTQ)和量化感知训练(QAT),以及不同的校准方法,如最大值校准器、均方误差校准器和熵校准器。 3. 量化工作流程和网络结构,包括插入量化节点、加载微调权重、进行校准等步骤。 4. 量化节点的实现细节,包括收集最小/最大值或直方图统计数据、计算阈值值等。 5. 不同量化策略和校准算法下的准确性和性能比较。 通过这些内容,本文展示了如何有效地实现BERT模型的INT8量化,以提高推理速度和降低计算资源消耗。
如何使用FasterTransformer 3.0进行BERT的INT8量化? INT8量化对BERT模型的准确性和性能有何影响? 如何在BERT量化中选择合适的量化策略和校准算法?
客服
商务合作
小程序
服务号
折叠