readme: ---
  license: apache-2.0
  library_name: paddlenlp
  language:
  - zh
  ---
  
  [![paddlenlp-banner](https://user-images.githubusercontent.com/1371212/175816733-8ec25eb0-9af3-4380-9218-27c154518258.png)](https://github.com/PaddlePaddle/PaddleNLP)
  
  # PaddlePaddle/ernie-3.0-micro-zh
  
  ## Intro
  [ERNIE 3.0 Models](https://github.com/paddlepaddle/PaddleNLP/tree/develop/model_zoo/ernie-3.0) are lightweight models obtained from Wenxin large model ERNIE 3.0 using distillation technology. The model structure is consistent with ERNIE 2.0, and has a stronger Chinese effect than ERNIE 2.0.
  
  For a detailed explanation of related technologies, please refer to the article [_解析全球最大中文单体模型鹏城-百度·文心技术细节_](https://www.jiqizhixin.com/articles/2021-12-08-9)
  
  ## How to Use
  
  Click on the "Use in paddlenlp" on the top right corner!
  
  
  ## Performance
  
  ERNIE 3.0 open sources six models: **ERNIE 3.0 _XBase_**, **ERNIE 3.0 _Base_**, **ERNIE 3.0 _Medium_**, **ERNIE 3.0 _Mini_**, **ERNIE 3.0 _Micro_**, **ERNIE 3.0 _Nano_**:
  
  - **ERNIE 3.0-_XBase_** (_20-layer, 1024-hidden, 16-heads_)
  - **ERNIE 3.0-_Base_** (_12-layer, 768-hidden, 12-heads_)
  - **ERNIE 3.0-_Medium_** (_6-layer, 768-hidden, 12-heads_)
  - **ERNIE 3.0-_Mini_** (_6-layer, 384-hidden, 12-heads_)
  - **ERNIE 3.0-_Micro_** (_4-layer, 384-hidden, 12-heads_)
  - **ERNIE 3.0-_Nano_** (_4-layer, 312-hidden, 12-heads_)
  
  
  Below is the **precision-latency graph** of the small Chinese models in PaddleNLP. The abscissa represents the latency (unit: ms) tested on CLUE IFLYTEK dataset (maximum sequence length is set to 128), and the ordinate is the average accuracy on 10 CLUE tasks (including text classification, text matching, natural language inference, Pronoun disambiguation, machine reading comprehension and other tasks), among which the metric of CMRC2018 is Exact Match (EM), and the metric of other tasks is Accuracy. The closer the model to the top left in the figure, the higher the level of accuracy and performance.The top left model in the figure has the highest level of accuracy and performance.
  
  The number of parameters of the model are marked under the model name in the figure. For the test environment, see [Performance Test](https://github.com/paddlepaddle/PaddleNLP/tree/develop/model_zoo/ernie-3.0#%E6%80%A7%E8%83%BD%E6%B5%8B%E8%AF%95) in details.
  
  precision-latency graph under CPU (number of threads: 1 and 8), batch_size = 32:
  
  <table>
      <tr>
          <td><a><img src="https://user-images.githubusercontent.com/26483581/175852121-2798b5c9-d122-4ac0-b4c8-da46b89b5512.png"></a></td>
          <td><a><img src="https://user-images.githubusercontent.com/26483581/175852129-bbe58835-8eec-45d5-a4a9-cc2cf9a3db6a.png"></a></td>
      </tr>
  </table>
  
  precision-latency graph under CPU (number of threads: 1 and 8), batch_size = 1:
  <table>
      <tr>
          <td><a><img src="https://user-images.githubusercontent.com/26483581/175852106-658e18e7-705b-4f53-bad0-027281163ae3.png"></a></td>
          <td><a><img src="https://user-images.githubusercontent.com/26483581/175852112-4b89d675-7c95-4d75-84b6-db5a6ea95e2c.png"></a></td>
      </tr>
  </table>
  
  
  precision-latency graph under GPU, batch_size = 32, 1:
  <table>
      <tr>
          <td><a><img src="https://user-images.githubusercontent.com/26483581/175854679-3247f42e-8716-4a36-b5c6-9ce4661b36c7.png"></a></td>
          <td><a><img src="https://user-images.githubusercontent.com/26483581/175854670-57878b34-c213-47ac-b620-aaaec082f435.png"></a></td>
      </tr>
  </table>
  
  As can be seen from the figure, the comprehensive performance of the ERNIE Tiny 3.0 models has been comprehensively ahead of UER-py, Huawei-Noah and HFL in terms of accuracy and performance. And when batch_size=1 and the precision mode is FP16, the inference performance of the wide and shallow model on the GPU is more advantageous.
  
  The precision data on the CLUE **validation set** are shown in the following table:
  
  <table style="width:100%;" cellpadding="2" cellspacing="0" border="1" bordercolor="#000000">
      <tbody>
          <tr>
              <td style="text-align:center;vertical-align:middle">
                  <span style="font-size:18px;">Arch</span>
              </td>
              <td style="text-align:center">
                  <span style="font-size:18px;">Model</span>
              </td>
              <td style="text-align:center">
                  <span style="font-size:18px;">AVG</span>
              </td>
              <td style="text-align:center">
                  <span style="font-size:18px;">AFQMC</span>
              </td>
              <td style="text-align:center;">
                  <span style="font-size:18px;">TNEWS</span>
              </td>
              <td style="text-align:center;">
                  <span style="font-size:18px;">IFLYTEK</span>
              </td>
              <td style="text-align:center;">
                  <span style="font-size:18px;">CMNLI</span>
              </td>
              <td style="text-align:center;">
                  <span style="font-size:18px;">OCNLI</span>
              </td>
              <td style=