# Pragma Insertion Dataset for LLM Fine-tune

Our dataset has a large number of C++ kernels without the HLS pragma, and corresponding designs with pragma. It is not difficult to envision the potential for utilizing our HLS data to training an automatic pragma inserter based on LLM.&#x20;

```
{
"instruction": "optimize for low resource usage.", 
"input": origin code, 
"output": code with HLS pragma consuming low resource usage"
}.
```

Out of the LLM Synthetic Code designs, we use 90% as the training set and reserve the remaining 10% as the test set. We retain the Pareto-optimal points from the resulting two-dimensional latency-resource design space.&#x20;

Then we divide the designs on Pareto curve into three categories: high, medium, and low resource usage. The top one-third of the points in terms of ARU are classified as high, the middle one-third as medium, and the remaining one-third as low. Next, we construct training dataset for the three categories. By doing so, our trained pragma inserter can generate Pareto-optimal pragma designs for varying resource.

<figure><img src="https://204291402-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqpjfvyQt0RAeOzMVWp4g%2Fuploads%2FNNK2YY01FiNdtznCh6Yx%2Fimage.png?alt=media&#x26;token=9d294cdc-e1c1-4dbc-bfa9-b4f7b2d274f7" alt="" width="563"><figcaption></figcaption></figure>

{% embed url="<https://drive.google.com/file/d/1CdR8I8SShXFwhWJKJw78bS0i6Xl0MBsK/view>" %}
