File size: 2,156 Bytes
597b65c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# πŸš€ Quick Test Command for Single Training Sample

## βœ… Updated Command (With Fixes Applied)

```bash
cd /workspace/ftt/codellama-migration && source /venv/main/bin/activate && python3 test_single_training_sample.py
```

**This will:**
- Load the first training sample
- Test with temperatures: 0.1, 0.2, 0.3
- Show expected vs generated output
- Help you find the best temperature

---

## πŸ”§ Manual Test Command (Custom Temperature)

```bash
cd /workspace/ftt/codellama-migration
source /venv/main/bin/activate

# Extract sample #1 instruction
INSTRUCTION=$(sed -n '1p' datasets/processed/split/train.jsonl | python3 -c "import sys, json; print(json.load(sys.stdin)['instruction'])")

# Test with optimized parameters
python3 scripts/inference/inference_codellama.py \
    --mode local \
    --model-path training-outputs/codellama-fifo-v1 \
    --prompt "$INSTRUCTION" \
    --max-new-tokens 1000 \
    --temperature 0.1
```

---

## 🎯 Key Hyperparameter Changes Made

| Parameter | Old | New | Impact |
|-----------|-----|-----|--------|
| **Repetition Penalty** | 1.1 | **1.2** | βœ… Prevents repetitive text |
| **Prompt Format** | No EOS | **+ EOS token** | βœ… Matches training format |
| **Temperature** | 0.3 | **0.1 (recommended)** | βœ… More deterministic |
| **Response Extraction** | Full decode | **New tokens only** | βœ… Cleaner output |

---

## πŸ“Š Expected Results

With these changes, you should see:
- βœ… **Verilog code generation** (not text notes)
- βœ… **Complete modules** (module ... endmodule)
- βœ… **No repetitive "Note:" statements**
- βœ… **Better match with training data**

---

## πŸ” If Still Getting Text Instead of Code

Try these in order:

1. **Lower temperature to 0.05:**
   ```bash
   --temperature 0.05
   ```

2. **Increase repetition penalty to 1.3:**
   (Edit inference script or add as parameter)

3. **Check prompt format:**
   - Ensure instruction matches training data exactly
   - No extra formatting or wrappers

4. **Verify training data format:**
   - Should be: `instruction + EOS + response + EOS`
   - Response should start with ```verilog

---

**Test and let me know the results!**