Fine-Tuning

Create custom models by fine-tuning base models with your own datasets for domain-specific tasks.

Overview

Fine-tuning lets you adapt base models to your domain, improving accuracy, tone, and output consistency. Use it to build domain-specific chatbots, customer support agents, or technical models with a unique style.

Preparing Your Dataset

• Format your dataset as JSONL (JSON Lines) • Each line must contain an object with 'input' and 'output' fields Tips: • Use at least a few hundred high-quality examples • Keep examples consistent • Use a validation dataset to evaluate performance Example line:
json
{"input": "Translate to French: Hello", "output": "Bonjour"}

Uploading Datasets

Upload your JSONL dataset to Dendrer:
curl -X POST https://api.dendrer.com/v1/files \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "file=@dataset.jsonl"

Deploying a Fine-Tuned Model

Start a fine-tuning job and deploy your model with one command:
dendrer deploy --model mistral-7b --dataset ./faq.jsonl

✓ Dataset uploaded successfully
✓ Fine-tuning job started: ft_abc123  
✓ Model deployed: mistral-7b-faq-v1

🎉 Your model is ready!
Model ID: mistral-7b-faq-v1
Job ID: ft_abc123
Preview URL: https://dendrer.com/preview/mistral-7b-faq-v1

Checking Training Status

Monitor your fine-tuning job progress:
dendrer status ft_abc123

Job ID: ft_abc123
Status: completed
Model: mistral-7b-faq-v1
Progress: 100% (3/3 epochs)
Started: 2025-01-30 14:30:22
Completed: 2025-01-30 14:45:18
Duration: 14m 56s

✓ Training completed successfully
✓ Model validation passed
✓ Deployed to production

Listing All Fine-Tuned Models

View all your custom models:
dendrer list models

┌──────────────────────┬─────────────┬──────────────────────┬─────────────┐
│ Model ID             │ Base Model  │ Created              │ Status      │
├──────────────────────┼─────────────┼──────────────────────┼─────────────┤
│ mistral-7b-faq-v1    │ mistral-7b  │ 2025-01-30 14:30:22  │ active      │
│ llama3-8b-support-v2 │ llama3-8b   │ 2025-01-29 09:15:33  │ active      │
│ mistral-7b-docs-v1   │ mistral-7b  │ 2025-01-28 16:42:11  │ deprecated  │
└──────────────────────┴─────────────┴──────────────────────┴─────────────┘

3 models found

Checking Training Logs

View detailed training logs for debugging:
dendrer logs ft_abc123

[2025-01-30 14:30:22] Starting fine-tuning job ft_abc123
[2025-01-30 14:30:25] Loading base model: mistral-7b
[2025-01-30 14:30:28] Dataset loaded: 1,247 examples
[2025-01-30 14:30:30] Epoch 1/3 starting...
[2025-01-30 14:35:15] Epoch 1/3 completed - Loss: 2.31
[2025-01-30 14:35:18] Epoch 2/3 starting...
[2025-01-30 14:40:02] Epoch 2/3 completed - Loss: 1.89
[2025-01-30 14:40:05] Epoch 3/3 starting...
[2025-01-30 14:44:51] Epoch 3/3 completed - Loss: 1.65
[2025-01-30 14:45:15] Model validation completed
[2025-01-30 14:45:18] Deployment successful

Rolling Back to a Previous Version

Easily rollback to a previous version of your model:
dendrer rollback mistral-7b-faq-v1 --to mistral-7b-faq-v0.3

✓ Rolled back to mistral-7b-faq-v0.3
✓ Deployed to production
✓ Preview URL: https://dendrer.com/preview/mistral-7b-faq-v0.3

Using Your Fine-Tuned Model

curl -X POST https://api.dendrer.com/v1/inference \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "ft:dendrer-chat-13b:custom-support-v1",
    "input": "Answer the customer question: ..."
  }'

Best Practices

• Start with small datasets and fewer epochs, then iterate • Keep examples clean and consistent • Use a validation dataset to evaluate performance • Use versioning to test changes safely • Combine fine-tuning with prompt engineering for best results
Dendrer - AI Model-as-a-Service Platform