Skip to content

Overview

Whether you are looking to classify text, answer questions, interact with internal tools, or solve other language tasks, our step-by-step workflow will take you from initial concept to production-ready model. Let’s dive in!

First, authenticate with the distil labs platform:

distil login

Register a new model to track your experiment:

# Returns your model ID
distil model create my-model-name

You can list all your models with:

distil model list

Step 2: Task selection and data preparation

Section titled “Step 2: Task selection and data preparation”

Begin by identifying the specific task you want your model to perform. Different tasks require different approaches to data preparation and model configuration.

Learn more about task selection →

Prepare your data and configuration files according to your chosen task type. A training job requires the following files in a directory:

FileFormatRequiredDescription
job_description.jsonJSONYesTask objectives and configuration
train.csvCSV or JSONLYes20+ labeled (question, answer) pairs
test.csvCSV or JSONLYesHeld-out evaluation set
config.yamlYAMLYesTraining hyperparameters
unstructured.csvCSV or JSONLNoText documents relating to your problem domain which we may use for synthetic data generation

Learn more about data preparation →

Upload your data to the model (from your local ./data directory):

distil model upload-data <model-id> --data ./data

Before training your specialized small model, validate whether a large language model can accurately solve your task with the provided examples. If the teacher model can solve the task, the student model will be able to learn from it effectively. Learn about teacher evaluation →

# Start teacher evaluation
distil model run-teacher-evaluation <model-id>

# Check status
distil model teacher-evaluation <model-id>

Once your teacher evaluation shows satisfactory results, train your specialized small language model using knowledge distillation.

Understand the model training process →

# Start training
distil model run-training <model-id>

# Check status
distil model training <model-id>

Once training is complete, download your model:

distil model download <model-id>

Deploy your trained model locally or using distil labs inference for immediate integration with your applications.

Explore deployment options →

Use the distil CLI with llama-cpp as the inference backend:

distil model deploy local <model-id>

Once running, get a ready-to-run invocation script with distil model invoke:

distil model invoke <model-id>

This outputs a command using uv that you can copy and run directly:

uv run $PATH_TO_CLIENT --question "Your question here"

For question answering models that require context, use the --context flag:

uv run $PATH_TO_CLIENT --question "Your question here" --context "Your context here"

Alternatively, deploy your model on distil-managed remote infrastructure using the inference playground:

distil model deploy remote <model-id>

The CLI will provision your deployment and display the endpoint URL, API key, and a client script you can use to query your model.

Once deployed, you can also use distil model invoke to get a ready-to-run invocation script for your remote deployment:

distil model invoke <model-id>

You’ve successfully trained and deployed a specialized small language model! For more details, explore: