Fine-Tuning
Fine-tuning is a powerful tool for customizing pre-trained models to fit specific needs. At Hyperstack Gen AI Platform, we've made it easier than ever for users to fine-tune their models using our User Interface or API.
Fine-tuning Through API
You can start a fine-tuning job by making a POST request to the training pod endpoint:
MODEL_NAME="finetuned-mistral-7b"
BASE_MODEL="mistral-7b-instruct-v0.3"
curl -X POST https://api.genai.hyperstack.cloud/tailor/v1/training-pod \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"base_model": "'$BASE_MODEL'",
"model_name": "'$MODEL_NAME'",
"tags": ["tag1", "tag2"],
"custom_logs_filename": "optional-filename",
"save_logs_with_tags": true,
"custom_dataset": "optional-dataset-name",
"skip_logs_with_errors": true,
"use_synthetic_data": true,
"parent_model_id": "optional-parent-model-id",
"batch_size": 1,
"epoch": 1,
"learning_rate": 0.0001,
"lora_r": 8,
"lora_alpha": 16,
"lora_dropout": 0.1
}'
Required Parameters:
base_model
: The name of the base model to fine-tunemodel_name
: A unique name for your fine-tuned model (cannot start with reserved prefixes)
Optional Parameters:
tags
: Array of tags to filter training datacustom_logs_filename
: Filename for custom logs uploadsave_logs_with_tags
: Whether to save uploaded logs with tagscustom_dataset
: Name of a custom dataset to useskip_logs_with_errors
: Whether to skip invalid logs (default: true)use_synthetic_data
: Whether to use synthetic data (default: true)parent_model_id
: ID of the parent model for incremental trainingbatch_size
: Training batch sizeepoch
: Number of training epochslearning_rate
: Learning rate for traininglora_r
: LoRA rank parameterlora_alpha
: LoRA alpha parameterlora_dropout
: LoRA dropout rate
Fine-tuning Through UI
The starting a training job page guides you through the process of initiating model training.
Step by Step Guide:
1. Configure Basic Settings
- Model Name: Enter a name for your fine-tuned model.
- Base Model: Select the base model you would like to use for fine-tuning.
2. Select Training Data
Users can choose the type of data to use for the training:
- All logs: Use all available logs.
- By tags: Select logs based on specific tags.
- By dataset: Select logs based on the dataset name.
- Upload logs: Upload logs specifically for this training job. You can choose to save these logs with custom tags or not save them, in which case the data will not be stored on our servers after the training.
3. Adjust Advanced Settings
For advanced users, we provide the option to adjust the following parameters:
- Epochs: The number of complete passes through the training dataset.
- Batch Size: The number of training examples utilized in one iteration.
- Learning Rate: The step size at each iteration while moving toward a minimum of the loss function.
- LoRA Rank (r): The rank of the low-rank adaptation matrices.
- LoRA Alpha: The scaling factor for the LoRA weights.
- LoRA Dropout: The dropout rate for LoRA layers.
The fine-tuning process may take some time depending on the size of your dataset and the complexity of the model. You can monitor the progress of your fine-tuning job through the UI or by making GET requests to the training pod endpoint.
4. Review Estimates
To help users make informed decisions, we provide an estimation box that includes:
- Estimated Time to Train: An estimate of how long the training will take.
- Training Progress: The current status of the training job.
- Recommended Minimum Number of Logs: A recommendation on the minimum number of logs needed for significant model improvement.
5. Start Training!
Once you've configured all the necessary parameters, click the "Start Training" button to begin the fine-tuning process. Here's what happens next:
-
Data Validation: The system will validate your training data:
- If no specific data selection is made (tags, custom logs, or dataset), all available chat logs in your account will be used
- Invalid logs will be handled according to your error handling preference
- You'll be notified if there are insufficient valid logs for training
-
Training Initialization:
- The system will allocate necessary computing resources
- You'll receive a confirmation that training has started
-
Progress Monitoring:
- Track the training progress in real-time through the UI
- View metrics such as training loss and validation loss
See more details about monitoring your training job in the Monitoring Jobs section.