Skip to content

Commit 9b574f4

Browse files
Quantstruct: add screenshot and update changelog and finetuning guide
1 parent ea6beba commit 9b574f4

File tree

3 files changed

+74
-21
lines changed

3 files changed

+74
-21
lines changed

changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,6 @@ Example Payload:
3737
}
3838
}
3939
```
40+
41+
![Fine-tuning Dashboard](images/finetuning-dashboard.png)
42+
Access fine-tuning UI at https://platform.openai.com/finetune

finetuning-guide.md

Lines changed: 71 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,83 @@
11
# OpenAI Fine-tuning Guide
2-
32
## Overview
4-
Fine-tuning lets you customize OpenAI models by training them on your data to improve style, reliability, and task-specific performance.
5-
3+
Fine-tuning allows you to customize OpenAI's models for specific use cases by training them on your own data([1](https://platform.openai.com/docs/guides/fine-tuning)). This is particularly useful for:
64
- Setting specific style, tone, or format
75
- Improving reliability for desired outputs
86
- Handling complex prompts and edge cases
97
- Teaching new skills or tasks
10-
118
## Currently Available Models
12-
139
- `gpt-4o-mini` (recommended for most users)
1410
- `gpt-3.5-turbo`
1511
- `babbage-002`
1612
- `davinci-002`
17-
18-
Note: GPT-4 fine-tuning is in experimental access.
19-
13+
Note: GPT-4 fine-tuning is currently in experimental access([1](https://platform.openai.com/docs/guides/fine-tuning)).
2014
## Step-by-Step Guide
21-
22-
### 1. Prepare Dataset
23-
Create a JSONL file with conversation examples:
24-
25-
### 2. Create Fine-tuning Job
26-
Use the OpenAI API to create a fine-tuning job:
27-
28-
### 3. Monitor Job
29-
Use the dashboard to track job status and progress.
30-
31-
### 4. Evaluate Model
32-
33-
### 5. Deploy Model
15+
### 1. Prepare Your Dataset
16+
Create a JSONL file with your training examples. Each example should be a conversation in this format:
17+
```jsonl
18+
{"messages": [
19+
{"role": "system", "content": "System message here"},
20+
{"role": "user", "content": "User message here"},
21+
{"role": "assistant", "content": "Assistant response here"}
22+
]}
23+
```
24+
Best practices:
25+
- Include at least 10 examples
26+
- Make examples diverse and representative
27+
- Target specific cases where the base model isn't performing as desired
28+
- Include ideal responses in the assistant messages
29+
### 2. Validate and Upload Your Data
30+
```python
31+
from openai import OpenAI
32+
client = OpenAI()
33+
# Upload the training file
34+
file = client.files.create(
35+
file=open("training_data.jsonl", "rb"),
36+
purpose="fine-tune"
37+
)
38+
```
39+
### 3. Create Fine-tuning Job
40+
Based on the recent changelog, use this updated format:
41+
```python
42+
client.fine_tuning.jobs.create(
43+
training_file="file-abc123",
44+
model="gpt-3.5-turbo",
45+
method={
46+
"type": "supervised",
47+
"supervised": {
48+
"hyperparameters": {
49+
"n_epochs": 2
50+
}
51+
}
52+
}
53+
)
54+
```
55+
### 4. Configure Hyperparameters (Optional)
56+
Key hyperparameters to consider:
57+
- `n_epochs`: Increase by 1-2 if model isn't following training data enough
58+
- Decrease epochs if model becomes less diverse than desired
59+
- Adjust learning rate if model isn't converging
60+
### 5. Monitor Training Progress
61+
```python
62+
# Get the status of your fine-tuning job
63+
job = client.fine_tuning.jobs.retrieve("job-id")
64+
print(job.status)
65+
```
66+
## Cost Considerations
67+
- Fine-tuning costs vary based on model and data size
68+
- Training tokens and usage tokens have different pricing
69+
- Consider testing with a smaller dataset first
70+
## Best Practices
71+
1. **Start Simple**: Begin with base model prompt engineering before fine-tuning
72+
2. **Quality Data**: Ensure training data is high-quality and well-formatted
73+
3. **Test Thoroughly**: Compare fine-tuned model against base model using test cases
74+
4. **Iterate**: Monitor performance and adjust hyperparameters as needed
75+
## Rate Limits
76+
- Fine-tuned models share rate limits with their base models
77+
- For example, if you use 50% of `gpt-3.5-turbo`'s TPM limit, your fine-tuned version will only have the remaining 50% available
78+
## Evaluation
79+
To evaluate your fine-tuned model:
80+
1. Generate samples from both base and fine-tuned models
81+
2. Compare responses side-by-side
82+
3. Consider using OpenAI's evals framework for comprehensive testing
83+
Remember that fine-tuning can be complementary to retrieval strategies - they're not mutually exclusive approaches to improving model performance.

images/finetuning-dashboard.png

204 KB
Loading

0 commit comments

Comments
 (0)