Introduction
OpenAI is the most popular fine-tuning platform — large ecosystem, good documentation, but inference is more expensive than Google. This article compares hands-on.
1. OpenAI Fine-tuning Workflow
from openai import OpenAI
client = OpenAI()
# Upload dataset
file = client.files.create(file=open("data.jsonl","rb"), purpose="fine-tune")
# Create fine-tuning job
job = client.fine_tuning.jobs.create(
training_file=file.id,
model="gpt-4o-mini-2024-07-18",
hyperparameters={"n_epochs": 3}
)
# Monitor
while True:
status = client.fine_tuning.jobs.retrieve(job.id)
print(f"Status: {status.status}")
if status.status in ["succeeded", "failed"]:
break
time.sleep(60)
# Use fine-tuned model
response = client.chat.completions.create(
model=status.fine_tuned_model,
messages=[{"role": "user", "content": "Test query"}]
)
2. OpenAI vs Google — When to use what?
| OpenAI | Google Vertex AI | |
|---|---|---|
| Training cost | $3.00/1M tokens (mini) | ~$0.40/1M tokens |
| Inference cost | 2x base price | Equals base price |
| Ecosystem | Biggest | In development |
| Ease of use | Very easy | Need GCP setup |
| Best for | Prototype, small scale | Production, large scale |
Summary
- OpenAI fine-tuning is simple: upload → create job → wait → use
- Inference is 2x more expensive than the base model — need to calculate carefully for production
- Use OpenAI for prototype, turn to Google for production scale
Exercises
- Fine-tune GPT-4o-mini with the same dataset used for Gemini
- Compare output quality: Gemini FT vs OpenAI FT
- Cost comparison: training + 30 days inference
- Conclusion: which provider is suitable for your use case?