Upload FORMAT_ISSUE_ANALYSIS.md with huggingface_hub
Browse files- FORMAT_ISSUE_ANALYSIS.md +61 -0
FORMAT_ISSUE_ANALYSIS.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 🔍 Format Issue Analysis
|
| 2 |
+
|
| 3 |
+
## ❌ Problem Identified
|
| 4 |
+
|
| 5 |
+
**Issue:** Model generating unrelated text (Kotlin code instead of Verilog)
|
| 6 |
+
|
| 7 |
+
**Root Cause:** Format mismatch between training and CodeLlama-Instruct expectations
|
| 8 |
+
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
## 📊 Format Comparison
|
| 12 |
+
|
| 13 |
+
### CodeLlama-Instruct Expected Format:
|
| 14 |
+
```
|
| 15 |
+
<s>[INST] <<SYS>>
|
| 16 |
+
System message
|
| 17 |
+
<</SYS>>
|
| 18 |
+
|
| 19 |
+
User message [/INST] Response </s>
|
| 20 |
+
```
|
| 21 |
+
|
| 22 |
+
### Current Training Format:
|
| 23 |
+
```
|
| 24 |
+
instruction + EOS + response + EOS
|
| 25 |
+
```
|
| 26 |
+
|
| 27 |
+
### During Training (Current):
|
| 28 |
+
```python
|
| 29 |
+
text = f"{instruction}{tokenizer.eos_token}{response}{tokenizer.eos_token}"
|
| 30 |
+
# Result: "System prompt + task</s>Code here</s>"
|
| 31 |
+
```
|
| 32 |
+
|
| 33 |
+
### During Inference (Current):
|
| 34 |
+
```python
|
| 35 |
+
prompt = f"{instruction}{tokenizer.eos_token}"
|
| 36 |
+
# Result: "System prompt + task</s>"
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
---
|
| 40 |
+
|
| 41 |
+
## 🔧 Solution Options
|
| 42 |
+
|
| 43 |
+
### Option 1: Use CodeLlama Chat Template (RECOMMENDED)
|
| 44 |
+
- Update training script to use CodeLlama's chat template
|
| 45 |
+
- Reformat dataset to use chat template format
|
| 46 |
+
- Retrain with proper format
|
| 47 |
+
- **Pros:** Proper format, better results
|
| 48 |
+
- **Cons:** Need to retrain
|
| 49 |
+
|
| 50 |
+
### Option 2: Keep Simple Format (QUICK FIX)
|
| 51 |
+
- Use simple format for both training and inference
|
| 52 |
+
- Ensure inference matches training exactly
|
| 53 |
+
- **Pros:** No retraining needed
|
| 54 |
+
- **Cons:** Not using CodeLlama's optimized format
|
| 55 |
+
|
| 56 |
+
---
|
| 57 |
+
|
| 58 |
+
## ✅ Recommended: Use CodeLlama Chat Template
|
| 59 |
+
|
| 60 |
+
CodeLlama-Instruct is designed to work with the chat template format. Using it will give better results.
|
| 61 |
+
|